/// // dont forget to run this // npx @tanstack/router-cli generate import type { QueryClient } from "@tanstack/react-query"; import { createRootRouteWithContext, // Link, // Outlet, Scripts, useLocation, useNavigate, } from "@tanstack/react-router"; import { TanStackRouterDevtools } from "@tanstack/react-router-devtools"; import { useAtom } from "jotai"; import * as React from "react"; import { KeepAliveOutlet, KeepAliveProvider } from "tanstack-router-keepalive"; import { Composer } from "~/components/Composer"; import { DefaultCatchBoundary } from "~/components/DefaultCatchBoundary"; import { Import } from "~/components/Import"; import Login from "~/components/Login"; import { NotFound } from "~/components/NotFound"; import { FluentEmojiHighContrastGlowingStar } from "~/components/Star"; import { UnifiedAuthProvider, useAuth } from "~/providers/UnifiedAuthProvider"; import { composerAtom, hueAtom, useAtomCssVar } from "~/utils/atoms"; import { seo } from "~/utils/seo"; export const Route = createRootRouteWithContext<{ queryClient: QueryClient; }>()({ head: () => ({ meta: [ { charSet: "utf-8", }, { name: "viewport", content: "width=device-width, initial-scale=1", }, ...seo({ title: "Red Dwarf", description: `Distributed Bluesky Client`, }), ], links: [ { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png", }, { rel: "icon", type: "image/png", sizes: "32x32", href: "/redstar.png?whatwg", }, { rel: "icon", type: "image/png", sizes: "16x16", href: "/redstar.png?whatwg", }, { rel: "manifest", href: "/site.webmanifest", color: "#fffff" }, { rel: "icon", href: "/favicon.ico" }, ], }), errorComponent: import.meta.env.DEV ? undefined : (props) => ( ), notFoundComponent: () => , component: RootComponent, }); function RootComponent() { return ( ); } function RootDocument({ children }: { children: React.ReactNode }) { useAtomCssVar(hueAtom, "--tw-gray-hue"); const location = useLocation(); const navigate = useNavigate(); const { agent } = useAuth(); const authed = !!agent?.did; const isHome = location.pathname === "/"; const isNotifications = location.pathname.startsWith("/notifications"); const isProfile = agent && (location.pathname === `/profile/${agent?.did}` || location.pathname === `/profile/${encodeURIComponent(agent?.did ?? "")}`); const isSettings = location.pathname.startsWith("/settings"); const isSearch = location.pathname.startsWith("/search"); const isFeeds = location.pathname.startsWith("/feeds"); const locationEnum: | "feeds" | "search" | "settings" | "notifications" | "profile" | "home" = isFeeds ? "feeds" : isSearch ? "search" : isSettings ? "settings" : isNotifications ? "notifications" : isProfile ? "profile" : "home"; const [, setComposerPost] = useAtom(composerAtom); return ( <>
{agent?.did && ( )}
{children}
{agent?.did ? ( ) : (
Red Dwarf{" "} {/* lite */}
)} ); } function MaterialNavItem({ InactiveIcon, ActiveIcon, text, active, onClickCallbback, small, }: { InactiveIcon: React.ReactElement; ActiveIcon: React.ReactElement; text: string; active: boolean; onClickCallbback: () => void; small?: boolean | string; }) { if (small) return ( ); return ( ); } function MaterialPillButton({ InactiveIcon, ActiveIcon, text, //active, onClickCallbback, small, }: { InactiveIcon: React.ReactElement; ActiveIcon: React.ReactElement; text: string; //active: boolean; onClickCallbback: () => void; small?: boolean | string; }) { const active = false; return ( ); }