v3: journal becomes the default feed tab for visitors and for users who haven't picked one
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useState } from "react";
|
||||
import { FEED_TABS, type FeedTab } from "../config/feedTabs.ts";
|
||||
import { DEFAULT_FEED_TAB, FEED_TABS, type FeedTab } from "../config/feedTabs.ts";
|
||||
|
||||
const STORAGE_KEY = "default-feed-tab";
|
||||
|
||||
@@ -7,12 +7,12 @@ function readStored(): FeedTab {
|
||||
const stored = localStorage.getItem(STORAGE_KEY);
|
||||
return stored && (FEED_TABS as readonly string[]).includes(stored)
|
||||
? stored as FeedTab
|
||||
: "hot";
|
||||
: DEFAULT_FEED_TAB;
|
||||
}
|
||||
|
||||
/**
|
||||
* User preference for which feed tab the index opens on, persisted to
|
||||
* localStorage (defaults to "hot"). Returns the stored tab and a setter that
|
||||
* localStorage (defaults to DEFAULT_FEED_TAB). Returns the stored tab and a setter that
|
||||
* persists the choice. Consumers that only need to honour the preference (e.g.
|
||||
* the index default) can ignore the setter.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user