Skip to content

Commit 0b90c4c

Browse files
committed
Add user feed
1 parent 3be55f9 commit 0b90c4c

File tree

8 files changed

+268
-158
lines changed

8 files changed

+268
-158
lines changed

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from 'react-router-dom';
1717
import HashtagTool from './components/HashtagTool';
1818
import ProfilePage from './components/LoginDropDownComponent/ProfilePage.js';
19-
import UserProfilePage from './components/LoginDropDownComponent/UserProfilePage.js';
19+
import UserProfilePage from './components/Profile/UserProfilePage.js';
2020

2121
function SearchRouteWrapper() {
2222
let { searchQuery } = useParams();

src/components/Feed/index.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Posts from '../Posts';
22
import './index.css';
33
import React, { useEffect, useRef } from 'react';
4+
import { PageContext } from '../../context/PageContext';
45

56
function useIntersectionObserver(loadMore, options = {}) {
67
const targetRef = useRef(null);
@@ -54,14 +55,19 @@ function Feed(props) {
5455
const triggerPoint = Math.max(0, props.notes.length - 10);
5556

5657
return (
57-
<div className="feed-container pt-8 mx-auto max-w-xl">
58-
{props.notes.map((note, index) => (
59-
<div key={note.id}>
60-
<Posts note={note} />
61-
{index === triggerPoint && <div ref={loadMoreRef} />}
62-
</div>
63-
))}
64-
</div>
58+
<PageContext.Provider value={props.isHomePage}>
59+
<div className="feed-container pt-8 mx-auto max-w-xl">
60+
{props.notes.length > 0 &&
61+
props.notes.map((note, index) => (
62+
<div key={note.id}>
63+
<Posts note={note} />
64+
{index === triggerPoint && (
65+
<div ref={loadMoreRef} />
66+
)}
67+
</div>
68+
))}
69+
</div>
70+
</PageContext.Provider>
6571
);
6672
}
6773

src/components/HashtagTool/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export function HashtagTool() {
118118
<main className="flex-1 overflow-y-auto bg-gray-50">
119119
{isLoading && <Spinner />}
120120
<Feed
121+
isHomePage={true}
121122
notes={notes}
122123
onLoadMore={handleLoadMore}
123124
isLoading={isLoading || loadingMorePosts}

src/components/Login/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function HeaderBar({ isSearchVisible }) {
5151
<div className={headerClasses}>
5252
<header
5353
className={
54-
'flex flex-row items-center h-14 px-3 lg:pr-96 md:pl-64'
54+
'flex flex-row items-center h-14 mb-8 px-3 lg:pr-96 md:pl-64'
5555
}>
5656
<div className="flex basis-1/3 justify-start ">
5757
<Menu />

src/components/LoginDropDownComponent/UserProfilePage.js

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)