a tool for shared writing and social publishing

render what's hot for logged out users and don't render subs

+17 -4
+8 -4
app/(home-pages)/reader/layout.tsx
··· 8 8 import { MobileNavigation } from "components/ActionBar/MobileNavigation"; 9 9 import { MediaContents } from "components/Media"; 10 10 import { DashboardIdContext } from "components/PageLayouts/DashboardLayout"; 11 + import { useIdentityData } from "components/IdentityProvider"; 11 12 12 - const tabs = [ 13 - { name: "Subs", href: "/reader" }, 14 - { name: "What's Hot", href: "/reader/hot" }, 15 - { name: "New", href: "/reader/new" }, 13 + const allTabs = [ 14 + { name: "Subs", href: "/reader", requiresAuth: true }, 15 + { name: "What's Hot", href: "/reader/hot", requiresAuth: false }, 16 + { name: "New", href: "/reader/new", requiresAuth: false }, 16 17 ]; 17 18 18 19 export default function ReaderLayout({ ··· 21 22 children: React.ReactNode; 22 23 }) { 23 24 const pathname = usePathname(); 25 + const { identity } = useIdentityData(); 26 + const isLoggedIn = !!identity?.atp_did; 27 + const tabs = allTabs.filter((tab) => !tab.requiresAuth || isLoggedIn); 24 28 25 29 const isActive = (href: string) => { 26 30 if (href === "/reader") return pathname === "/reader";
+9
app/(home-pages)/reader/page.tsx
··· 1 + import { getIdentityData } from "actions/getIdentityData"; 1 2 import { getReaderFeed } from "./getReaderFeed"; 3 + import { getHotFeed } from "./getHotFeed"; 2 4 import { InboxContent } from "./InboxContent"; 5 + import { GlobalContent } from "./GlobalContent"; 3 6 4 7 export default async function Reader() { 8 + let identityData = await getIdentityData(); 9 + if (!identityData?.atp_did) { 10 + const feedPromise = getHotFeed(); 11 + return <GlobalContent promise={feedPromise} />; 12 + } 13 + 5 14 const feedPromise = getReaderFeed(); 6 15 return <InboxContent promise={feedPromise} />; 7 16 }