From 610351758024ff9dfcd7de913661564b8917279e Mon Sep 17 00:00:00 2001 From: "whey.party" Date: Fri, 31 Jul 2026 18:53:02 +0700 Subject: [PATCH] gate moderation page behind __MODERATION_PAGE__ --- src/routes/__root.tsx | 175 +++++++++++++++++++++++----------------- src/routes/settings.tsx | 30 ++++--- vite.config.ts | 6 +- 3 files changed, 123 insertions(+), 88 deletions(-) diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx index 6ad3149..4373c90 100644 --- a/src/routes/__root.tsx +++ b/src/routes/__root.tsx @@ -57,9 +57,10 @@ import { useQueryProfile, } from "~/utils/useQuery"; -declare const __INSTANCE_MODEL__: boolean -declare const __VERSION_NUMBER__: string -export const HARDCODED_TEXT = ` is ${__INSTANCE_MODEL__ ? " a hosted Red Dwarf instance" : " an app"} that you can use to participate in the Bluesky social network.` +declare const __INSTANCE_MODEL__: boolean; +declare const __MODERATION_PAGE__: boolean; +declare const __VERSION_NUMBER__: string; +export const HARDCODED_TEXT = ` is ${__INSTANCE_MODEL__ ? " a hosted Red Dwarf instance" : " an app"} that you can use to participate in the Bluesky social network.`; export const Route = createRootRouteWithContext<{ queryClient: QueryClient; @@ -102,14 +103,15 @@ export const Route = createRootRouteWithContext<{ }), errorComponent: import.meta.env.DEV ? (props) => ( - - - - ) : (props) => ( - - - - ), + + + + ) + : (props) => ( + + + + ), notFoundComponent: () => , component: RootComponent, }); @@ -157,11 +159,11 @@ export function renderSnack({ button={ button?.label ? { - label: button?.label, - onClick: () => { - button?.onClick?.(); - }, - } + label: button?.label, + onClick: () => { + button?.onClick?.(); + }, + } : undefined } /> @@ -227,10 +229,8 @@ function Snack(props: ToastProps) { ); } -function DotDivider(){ - return ( - · - ) +function DotDivider() { + return · ; } /* Types */ @@ -270,20 +270,20 @@ function RootDocument({ children }: { children: React.ReactNode }) { | "moderation" | "about" | "home" = isFeeds - ? "feeds" - : isSearch - ? "search" - : isSettings - ? "settings" - : isNotifications - ? "notifications" - : isProfile - ? "profile" - : isModeration - ? "moderation" - : isAbout - ? "about" - : "home"; + ? "feeds" + : isSearch + ? "search" + : isSettings + ? "settings" + : isNotifications + ? "notifications" + : isProfile + ? "profile" + : isModeration + ? "moderation" + : isAbout + ? "about" + : "home"; const [, setComposerPost] = useAtom(composerAtom); @@ -367,19 +367,21 @@ function RootDocument({ children }: { children: React.ReactNode }) { } text="Feeds" /> - } - ActiveIcon={} - active={locationEnum === "moderation"} - onClickCallbback={() => - navigate({ - to: "/moderation", - //params: { did: agent.assertDid }, - }) - } - text="Moderation" - /> + {__MODERATION_PAGE__ && ( + } + ActiveIcon={} + active={locationEnum === "moderation"} + onClickCallbback={() => + navigate({ + to: "/moderation", + //params: { did: agent.assertDid }, + }) + } + text="Moderation" + /> + )} - } - ActiveIcon={} - active={locationEnum === "moderation"} - onClickCallbback={() => - navigate({ - to: "/moderation", - //params: { did: agent.assertDid }, - }) - } - text="Moderation" - /> + {__MODERATION_PAGE__ && ( + } + ActiveIcon={} + active={locationEnum === "moderation"} + onClickCallbback={() => + navigate({ + to: "/moderation", + //params: { did: agent.assertDid }, + }) + } + text="Moderation" + /> + )} - {__INSTANCE_MODEL__ ? window.location.host : "Red Dwarf"}{HARDCODED_TEXT} + + {__INSTANCE_MODEL__ ? window.location.host : "Red Dwarf"} + + {HARDCODED_TEXT} - {__INSTANCE_MODEL__ && ( - {HOST_DESCRIPTION} - )} + {__INSTANCE_MODEL__ && ( + + {HOST_DESCRIPTION} + + )}
{__INSTANCE_MODEL__ ? "ADMINISTERED BY:" : "APP PROFILE:"} - +
)} @@ -799,9 +814,18 @@ function RootDocument({ children }: { children: React.ReactNode }) { {/* TODO: add red dwarf the software policy along with instance policy here */} Red Dwarf: - About + + About + - View source code + + View source code + {__VERSION_NUMBER__ || "v????"} @@ -1038,10 +1062,11 @@ export function MaterialNavItem({ if (small) return (