diff --git a/apps/web/src/routes/_view/oss-friends.tsx b/apps/web/src/routes/_view/oss-friends.tsx index e54eb2385a..b8834e194e 100644 --- a/apps/web/src/routes/_view/oss-friends.tsx +++ b/apps/web/src/routes/_view/oss-friends.tsx @@ -40,8 +40,12 @@ export const Route = createFileRoute("/_view/oss-friends")({ }), }); +const INITIAL_DISPLAY_COUNT = 12; +const LOAD_MORE_COUNT = 12; + function Component() { const [search, setSearch] = useState(""); + const [displayCount, setDisplayCount] = useState(INITIAL_DISPLAY_COUNT); const filteredFriends = useMemo(() => { if (!search.trim()) return allOssFriends; @@ -53,6 +57,16 @@ function Component() { ); }, [search]); + const isSearching = search.trim().length > 0; + const displayedFriends = isSearching + ? filteredFriends + : filteredFriends.slice(0, displayCount); + const hasMore = !isSearching && displayCount < filteredFriends.length; + + const handleLoadMore = () => { + setDisplayCount((prev) => prev + LOAD_MORE_COUNT); + }; + return (
- +
@@ -115,7 +133,15 @@ function HeroSection({ ); } -function FriendsSection({ friends }: { friends: typeof allOssFriends }) { +function FriendsSection({ + friends, + hasMore, + onLoadMore, +}: { + friends: typeof allOssFriends; + hasMore: boolean; + onLoadMore: () => void; +}) { return (
@@ -166,6 +192,21 @@ function FriendsSection({ friends }: { friends: typeof allOssFriends }) { ))}
+ {hasMore && ( +
+ +
+ )}
); }