mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-07-14 18:15:56 -04:00
- Merge `auth-client.ts`, `cached-session.ts`, `server-reachability.ts`, and `server-url.ts` into `lib/server.ts`; update all import sites to use `@/lib/server` - Replace the standalone `registerServer` + `setServerUrl` calls with a `serverManager.connectToServer()` method and expose `serverManager.normalizeUrl`, `serverManager.validateServerUrl`, and `serverManager.hasStoredServerUrl` - Move `use-server-connection.ts` from `lib/` to `hooks/` and remove the `seedSessionFromCache` export; replace with an `initialize()` helper called at module scope in the root layout - Add `getScopeKey()` to derive the TanStack Query persistence scope key, removing the inline computation from `QueryProvider` - Clear the query cache on server URL change inside `useServerConnection`
20 lines
628 B
TypeScript
20 lines
628 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { NativeTabBar } from "@/components/navigation/native-tab-bar";
|
|
import { orpc } from "@/lib/orpc";
|
|
import { authClient } from "@/lib/server";
|
|
|
|
export default function TabLayout() {
|
|
const { data: session } = authClient.useSession();
|
|
const isAdmin = session?.user?.role === "admin";
|
|
|
|
const updateCheck = useQuery({
|
|
...orpc.admin.updateCheck.queryOptions(),
|
|
enabled: isAdmin,
|
|
staleTime: 10 * 60 * 1000,
|
|
});
|
|
|
|
const showSettingsBadge = !!updateCheck.data?.updateCheck?.updateAvailable;
|
|
|
|
return <NativeTabBar showSettingsBadge={showSettingsBadge} />;
|
|
}
|