diff --git a/src/app/page.tsx b/src/app/page.tsx index fcd1af2..01a1f68 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -9,6 +9,7 @@ import { Compose } from '@/components/Compose'; import { Post } from '@/lib/types'; import { EyeOff } from 'lucide-react'; import { signedAPI } from '@/lib/api/signed-fetch'; +import { DEFAULT_HOME_FEED, HOME_FEED_LABELS, type HomeFeedType } from '@/lib/posts/home-feed'; interface FeedMeta { score: number; @@ -28,7 +29,7 @@ export default function Home() { const [loadingMore, setLoadingMore] = useState(false); const [nextCursor, setNextCursor] = useState(null); const [replyingTo, setReplyingTo] = useState(null); - const [feedType, setFeedType] = useState<'following' | 'curated'>('following'); + const [feedType, setFeedType] = useState(DEFAULT_HOME_FEED); const [feedMeta, setFeedMeta] = useState<{ algorithm: string; windowHours: number; @@ -57,7 +58,7 @@ export default function Home() { feedTypeRef.current = feedType; }, [feedType]); - const loadFeed = async (type: 'following' | 'curated', cursor?: string | null) => { + const loadFeed = async (type: HomeFeedType, cursor?: string | null) => { if (cursor && loadingCursorRef.current === cursor) return; if (cursor) loadingCursorRef.current = cursor; @@ -232,13 +233,13 @@ export default function Home() { className={`feed-toggle-btn ${feedType === 'following' ? 'active' : ''}`} onClick={() => setFeedType('following')} > - Following + {HOME_FEED_LABELS.following} @@ -261,7 +262,7 @@ export default function Home() { {feedType === 'curated' && feedMeta && (
-
Curated feed
+
For You
This feed highlights fresh posts and active discussions, with a boost for people you follow. It is designed to surface what matters without hiding your own activity.
@@ -278,7 +279,7 @@ export default function Home() { <>

No posts from the swarm yet

- The curated feed shows posts from other nodes in the Synapsis network. + The For You feed shows posts from other nodes in the Synapsis network. Check back later as nodes are discovered, or switch to Following to see posts from people you follow.

diff --git a/src/lib/posts/home-feed.test.ts b/src/lib/posts/home-feed.test.ts new file mode 100644 index 0000000..b1f3db0 --- /dev/null +++ b/src/lib/posts/home-feed.test.ts @@ -0,0 +1,13 @@ +import { describe, expect, it } from 'vitest'; +import { DEFAULT_HOME_FEED, HOME_FEED_LABELS } from './home-feed'; + +describe('home feed defaults', () => { + it('opens on the For You feed by default', () => { + expect(DEFAULT_HOME_FEED).toBe('curated'); + expect(HOME_FEED_LABELS[DEFAULT_HOME_FEED]).toBe('For You'); + }); + + it('retains Following as the chronological alternative', () => { + expect(HOME_FEED_LABELS.following).toBe('Following'); + }); +}); diff --git a/src/lib/posts/home-feed.ts b/src/lib/posts/home-feed.ts new file mode 100644 index 0000000..0f81c76 --- /dev/null +++ b/src/lib/posts/home-feed.ts @@ -0,0 +1,8 @@ +export type HomeFeedType = 'following' | 'curated'; + +export const DEFAULT_HOME_FEED: HomeFeedType = 'curated'; + +export const HOME_FEED_LABELS: Record = { + following: 'Following', + curated: 'For You', +};