Rename the curated home feed to For You and make it the default
Hop-State: A_06FPF4V1ESCBH4BJ55X3HV8 Hop-Proposal: R_06FPF4TFZHHSV6AT4P2H7T8 Hop-Task: T_06FPF4GA0DSNYMNFNA36MT0 Hop-Attempt: AT_06FPF4GA0E3BNBSZWWPG8KR
This commit is contained in:
+7
-6
@@ -9,6 +9,7 @@ import { Compose } from '@/components/Compose';
|
|||||||
import { Post } from '@/lib/types';
|
import { Post } from '@/lib/types';
|
||||||
import { EyeOff } from 'lucide-react';
|
import { EyeOff } from 'lucide-react';
|
||||||
import { signedAPI } from '@/lib/api/signed-fetch';
|
import { signedAPI } from '@/lib/api/signed-fetch';
|
||||||
|
import { DEFAULT_HOME_FEED, HOME_FEED_LABELS, type HomeFeedType } from '@/lib/posts/home-feed';
|
||||||
|
|
||||||
interface FeedMeta {
|
interface FeedMeta {
|
||||||
score: number;
|
score: number;
|
||||||
@@ -28,7 +29,7 @@ export default function Home() {
|
|||||||
const [loadingMore, setLoadingMore] = useState(false);
|
const [loadingMore, setLoadingMore] = useState(false);
|
||||||
const [nextCursor, setNextCursor] = useState<string | null>(null);
|
const [nextCursor, setNextCursor] = useState<string | null>(null);
|
||||||
const [replyingTo, setReplyingTo] = useState<Post | null>(null);
|
const [replyingTo, setReplyingTo] = useState<Post | null>(null);
|
||||||
const [feedType, setFeedType] = useState<'following' | 'curated'>('following');
|
const [feedType, setFeedType] = useState<HomeFeedType>(DEFAULT_HOME_FEED);
|
||||||
const [feedMeta, setFeedMeta] = useState<{
|
const [feedMeta, setFeedMeta] = useState<{
|
||||||
algorithm: string;
|
algorithm: string;
|
||||||
windowHours: number;
|
windowHours: number;
|
||||||
@@ -57,7 +58,7 @@ export default function Home() {
|
|||||||
feedTypeRef.current = feedType;
|
feedTypeRef.current = feedType;
|
||||||
}, [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) return;
|
||||||
if (cursor) loadingCursorRef.current = cursor;
|
if (cursor) loadingCursorRef.current = cursor;
|
||||||
|
|
||||||
@@ -232,13 +233,13 @@ export default function Home() {
|
|||||||
className={`feed-toggle-btn ${feedType === 'following' ? 'active' : ''}`}
|
className={`feed-toggle-btn ${feedType === 'following' ? 'active' : ''}`}
|
||||||
onClick={() => setFeedType('following')}
|
onClick={() => setFeedType('following')}
|
||||||
>
|
>
|
||||||
Following
|
{HOME_FEED_LABELS.following}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className={`feed-toggle-btn ${feedType === 'curated' ? 'active' : ''}`}
|
className={`feed-toggle-btn ${feedType === 'curated' ? 'active' : ''}`}
|
||||||
onClick={() => setFeedType('curated')}
|
onClick={() => setFeedType('curated')}
|
||||||
>
|
>
|
||||||
Curated
|
{HOME_FEED_LABELS.curated}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -261,7 +262,7 @@ export default function Home() {
|
|||||||
|
|
||||||
{feedType === 'curated' && feedMeta && (
|
{feedType === 'curated' && feedMeta && (
|
||||||
<div className="feed-meta card">
|
<div className="feed-meta card">
|
||||||
<div className="feed-meta-title">Curated feed</div>
|
<div className="feed-meta-title">For You</div>
|
||||||
<div className="feed-meta-body">
|
<div className="feed-meta-body">
|
||||||
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.
|
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.
|
||||||
</div>
|
</div>
|
||||||
@@ -278,7 +279,7 @@ export default function Home() {
|
|||||||
<>
|
<>
|
||||||
<p>No posts from the swarm yet</p>
|
<p>No posts from the swarm yet</p>
|
||||||
<p style={{ fontSize: '13px', marginTop: '8px' }}>
|
<p style={{ fontSize: '13px', marginTop: '8px' }}>
|
||||||
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.
|
Check back later as nodes are discovered, or switch to Following to see posts from people you follow.
|
||||||
</p>
|
</p>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -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');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export type HomeFeedType = 'following' | 'curated';
|
||||||
|
|
||||||
|
export const DEFAULT_HOME_FEED: HomeFeedType = 'curated';
|
||||||
|
|
||||||
|
export const HOME_FEED_LABELS: Record<HomeFeedType, string> = {
|
||||||
|
following: 'Following',
|
||||||
|
curated: 'For You',
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user