diff --git a/client/web/src/components/app.tsx b/client/web/src/components/app.tsx index b8ec34a6c..aefa81a7d 100644 --- a/client/web/src/components/app.tsx +++ b/client/web/src/components/app.tsx @@ -13,50 +13,67 @@ import DeviceDetailsView from "./views/device-details-view" export default function App() { const { data: auth, loading: loadingAuth, newSession } = useAuth() - const { data, refreshData, updateNode } = useNodeData() - useEffect(() => { - refreshData() - }, [auth, refreshData]) return (
- {loadingAuth || !data ? ( + {loadingAuth ? (
Loading...
// TODO(sonia): add a loading view ) : ( - <> - {/* TODO(sonia): get rid of the conditions here once full/readonly - * views live on same components */} - {data.DebugMode === "full" && auth?.ok &&
} - - - - - {data.DebugMode !== "" && ( - <> - - - - {/* TODO */}Subnet router - {/* TODO */}Tailscale SSH server - {/* TODO */}Share local content - - )} - -

Page not found

-
-
- + )}
) } +function WebClient({ + auth, + newSession, +}: { + auth?: AuthResponse + newSession: () => Promise +}) { + const { data, refreshData, updateNode } = useNodeData() + useEffect(() => { + refreshData() + }, [auth, refreshData]) + + if (!data) { + return
Loading...
// TODO(sonia): add a loading view + } + + return ( + <> + {/* TODO(sonia): get rid of the conditions here once full/readonly + * views live on same components */} + {data.DebugMode === "full" && auth?.ok &&
} + + + + + {data.DebugMode !== "" && ( + <> + + + + {/* TODO */}Subnet router + {/* TODO */}Tailscale SSH server + {/* TODO */}Share local content + + )} + +

Page not found

+
+
+ + ) +} + function HomeView({ auth, data,