From 6c3f0a512e98d1fde1024a3ac1df449d6b89982c Mon Sep 17 00:00:00 2001 From: bender Date: Fri, 17 Apr 2026 11:50:16 +0000 Subject: [PATCH] Update src/app/feed/page.tsx --- src/app/feed/page.tsx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/app/feed/page.tsx b/src/app/feed/page.tsx index 33bc72e..2e23469 100644 --- a/src/app/feed/page.tsx +++ b/src/app/feed/page.tsx @@ -5,7 +5,7 @@ import ReactLenis from "lenis/react"; import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple'; import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal'; import { Heart, MessageCircle, Share2, MoreHorizontal } from "lucide-react"; -import { useState, useEffect, useCallback } from "react"; +import { useState, useEffect, useCallback, useRef } from "react"; const POSTS_DATA = [ { id: "1", author: "Alex J.", content: "Just launched the new version of our platform! So excited to share it with everyone. #tech #launch", likes: 120, comments: 45 }, @@ -18,6 +18,7 @@ const POSTS_DATA = [ export default function FeedPage() { const [posts, setPosts] = useState(POSTS_DATA); const [loading, setLoading] = useState(false); + const lenisRef = useRef(null); const loadMore = useCallback(() => { if (loading) return; @@ -28,16 +29,6 @@ export default function FeedPage() { }, 1000); }, [loading]); - useEffect(() => { - const handleScroll = () => { - if (window.innerHeight + window.scrollY >= document.body.offsetHeight - 500) { - loadMore(); - } - }; - window.addEventListener('scroll', handleScroll); - return () => window.removeEventListener('scroll', handleScroll); - }, [loadMore]); - return ( - +

Community Feed

{posts.map((post) => ( -
+
{ + const lenis = lenisRef.current?.lenis; + if (lenis) lenis.scrollTo(`#post-${post.id}`, { offset: -100 }); + }} + id={`post-${post.id}`} + className="p-6 rounded-2xl border bg-card shadow-sm hover:shadow-md transition-shadow cursor-pointer" + >
-- 2.49.1