import { useLocation, useNavigate } from "react-router"; import { Trans } from "@lingui/react/macro"; import { useAuth } from "../hooks/useAuth.ts"; import { type FeedTab, VALID_TABS } from "../config/feedTabs.ts"; export function FeedTabBar() { const location = useLocation(); const navigate = useNavigate(); const { user } = useAuth(); const rawTab = new URLSearchParams(location.search).get("tab") ?? "hot"; const tab: FeedTab = VALID_TABS.has(rawTab) ? (rawTab as FeedTab) : "hot"; function setTab(t: FeedTab) { navigate(`/?tab=${t}`, { replace: true }); } return (
{user && ( )}
); }