{isOpen && (
- {poll?.userId === userInfo?.userID && -
+ {poll?.userId === userInfo?.userID &&
-
+ {<>Delete >}
}
-
-
@@ -285,7 +285,7 @@ const deletePoll=async(id)=>{
->
+ >
)
}
diff --git a/frontend/src/components/Sidenav.jsx b/frontend/src/components/Sidenav.jsx
index 1ede5dc..2f37072 100644
--- a/frontend/src/components/Sidenav.jsx
+++ b/frontend/src/components/Sidenav.jsx
@@ -107,8 +107,9 @@ const Sidenav = () => {
-
{dispatch(setShowSideNav(false))
-
+ {
+ dispatch(setShowSideNav(false))
+
}} to={"/"} className={(e) => { return e.isActive ? 'w-full flex rounded-2xl items-center gap-2 px-4 py-2 bg-[#65692375]' : 'w-full flex rounded items-center gap-2 px-4 py-2' }}>Home
dispatch(setShowSideNav(false))} to={"/popular"} className={(e) => { return e.isActive ? 'flex w-full rounded-2xl items-center gap-2 px-4 py-2 bg-[#65692375]' : 'flex w-full rounded items-center gap-2 px-4 py-2' }}>Popular
{!isLogin && dispatch(setShowSideNav(false))} to={"/about/"} className={(e) => { return e.isActive ? 'flex w-full rounded-2xl items-center gap-2 px-4 py-2 bg-[#65692375]' : 'flex w-full rounded items-center gap-2 px-4 py-2' }}>About}
@@ -128,7 +129,10 @@ const Sidenav = () => {
{roomLoader ?
: (myAllRoom?.map(function (val) {
- return dispatch(setShowSideNav(false))} key={val.room.id} to={`/room/${val?.room?.CreatorId}/${val?.room?.title}`} state={{ joined: true }} className={'w-full flex rounded items-center gap-2 pl-4 py-1 hover:bg-[#65692375]'}>{val?.room.title}
+ return dispatch(setShowSideNav(false))} key={val.room.id} to={`/room/${val?.room?.CreatorId}/${val?.room?.title}`} state={{ joined: true }} className={({ isActive }) =>
+ `w-full flex rounded-xl items-center gap-2 pl-4 py-1 hover:bg-[#65692375]
+ ${isActive ? 'bg-[#65692375] font-semibold' : ''}`
+ }>{val?.room.title}
}))}
@@ -150,7 +154,10 @@ const Sidenav = () => {
{roomLoader2 ?
: (notJoinedRooms?.map(function (val) {
- return
dispatch(setShowSideNav(false))} key={val.id} to={`/room/${val?.CreatorId}/${val?.title}`} className={'w-full flex rounded items-center gap-2 pl-4 py-1 hover:bg-[#65692375]'}>{val?.title}
+ return
dispatch(setShowSideNav(false))} key={val.id} to={`/room/${val?.CreatorId}/${val?.title}`} className={({ isActive }) =>
+ `w-full flex rounded-xl items-center gap-2 pl-4 py-1 hover:bg-[#65692375]
+ ${isActive ? 'bg-[#65692375] font-semibold' : ''}`
+ }>{val?.title}
}))}
}
diff --git a/frontend/src/pages/CreatePost.jsx b/frontend/src/pages/CreatePost.jsx
index dbd2954..3a8ff47 100644
--- a/frontend/src/pages/CreatePost.jsx
+++ b/frontend/src/pages/CreatePost.jsx
@@ -309,7 +309,7 @@ export const CreatePoll = () => {
const dispatch = useDispatch()
const Navigate = useNavigate()
const { roomTitle,roomCreatorId } = useOutletContext()
- const [selectedOption, setSelectedOption] = useState(null);
+ const [selectedOption, setSelectedOption] = useState("");
const handleSelectChange = (event) => {
setSelectedOption(event.target.value);
diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx
index 12aa2c6..0676af9 100644
--- a/frontend/src/pages/Home.jsx
+++ b/frontend/src/pages/Home.jsx
@@ -16,6 +16,8 @@ import Polls from '../components/Polls';
import { clearOffset, setPollOffset, setPostOffset } from '../redux/offset';
import { addRoomCreatorId, addRoomTitle, setOnNewRoomPost } from '../redux/RoomCreatePosts';
import SmoothLoader from '../assets/SmoothLoader';
+import { VscFoldDown } from "react-icons/vsc";
+import SmoothLoaderHome, { AnimatedFoldDownArrow } from '../assets/SmoothLoaderHome';
const Home = () => {
@@ -117,53 +119,68 @@ const Home = () => {
getPost(); // Fetch next set of data
};
- return (
-
}
- endMessage={
-
- {`${posts.length === 0 ? "It looks like there's no posts to display." : "You've reached the end of the page!"}`}
-
- }
- >
- {isLogin &&
}
-
- handleNewPost()} className='bg-[#eff1d3] rounded-full p-1'>
- {isLoading ? : }
-
-
-
-
- { (posts.length === 0) ? (
-
- ) :(
- posts?.map((post) => (
- 'body' in post ? (
-
- ) : (
-
- )
- ))
- )}
-
-
+ // Refresh function for pull down to refresh
+ const refresh = async () => {
+ console.log("refresh");
+
+ setHasMore(true);
+ await handleNewPost(); // Clear posts and reset offsets
+ };
+
+ return (<>
+
+
}
+ endMessage={
+
+ {`${posts.length === 0 ? "It looks like there's no posts to display." : "You've reached the end of the page!"}`}
+
+ }
+ refreshFunction={refresh}
+ pullDownToRefresh={true}
+ pullDownToRefreshThreshold={100}
+ pullDownToRefreshContent={
+
+ }
+ releaseToRefreshContent={
+
+ }
+ scrollableTarget="scrollableDiv" // Specify the scrollable div
+ >
+ {isLogin &&
}
+
+ {posts.length === 0 ? (
+
+ ) : (
+ posts.map(post =>
+ 'body' in post ? (
+
+ ) : (
+
+ )
+ )
+ )}
+
+
+
+ >
);
};
diff --git a/frontend/src/pages/HotTopicPosts.jsx b/frontend/src/pages/HotTopicPosts.jsx
index c05f746..a95e88f 100644
--- a/frontend/src/pages/HotTopicPosts.jsx
+++ b/frontend/src/pages/HotTopicPosts.jsx
@@ -149,7 +149,7 @@ const HotTopicPosts = ({ title, topic, dp, bg }) => {
}, [page]);
const fetchMoreData = () => {
- if (isLoading || !hasMore) return;
+ if (!hasMore || isLoading) return;
setPage((prevPage) => prevPage + 1); // Increment page number for infinite scroll
};
@@ -175,7 +175,7 @@ const HotTopicPosts = ({ title, topic, dp, bg }) => {
}
>