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:
khannurien
2026-09-19 20:39:17 +00:00
parent 20d717f879
commit 6026286bbf
6 changed files with 14 additions and 9 deletions

View File

@@ -9,6 +9,7 @@ import { createPortal } from "react-dom";
import { useNavigate, useParams } from "react-router";
import { t } from "@lingui/core/macro";
import { useCategories } from "../hooks/useCategories.ts";
import { DEFAULT_FEED_TAB } from "../config/feedTabs.ts";
/**
* Header dropdown that switches the feed scope between "All" and a category,
@@ -73,7 +74,7 @@ export function CategorySwitcher() {
if (categories.length === 0) return null;
const value = categorySlug ?? "~";
const tab = feedTab ?? "hot";
const tab = feedTab ?? DEFAULT_FEED_TAB;
const currentLabel = categorySlug
? categories.find((c) => c.slug === categorySlug)?.name ?? categorySlug
: t`All`;

View File

@@ -1,7 +1,7 @@
import { useNavigate, useParams } from "react-router";
import { Trans } from "@lingui/react/macro";
import { useAuth } from "../hooks/useAuth.ts";
import { FEED_TABS, type FeedTab } from "../config/feedTabs.ts";
import { DEFAULT_FEED_TAB, FEED_TABS, type FeedTab } from "../config/feedTabs.ts";
import { useDefaultFeedTab } from "../hooks/useDefaultFeedTab.ts";
import { TabBar } from "./TabBar.tsx";
import { CategorySwitcher } from "./CategorySwitcher.tsx";
@@ -18,7 +18,7 @@ export function FeedTabBar() {
const [preferredTab] = useDefaultFeedTab();
const defaultTab: FeedTab = preferredTab === "followed" && !user
? "hot"
? DEFAULT_FEED_TAB
: preferredTab;
const active: FeedTab = (FEED_TABS as readonly string[]).includes(feedTab ?? "")
? (feedTab as FeedTab)