social bookmarking for atproto
1/*
2 * clippr: a social bookmarking service for the AT Protocol
3 * Copyright (c) 2025 clippr contributors.
4 * SPDX-License-Identifier: AGPL-3.0-only
5 */
6
7import { RouteSectionProps } from "@solidjs/router";
8import { Header } from "./components/header.tsx";
9import { Footer } from "./components/footer.tsx";
10import { onMount, createSignal, Show } from "solid-js";
11import { loginState, retrieveSession } from "./components/loginForm.tsx";
12
13const Layout = (props: RouteSectionProps<unknown>) => {
14 const [isLoading, setIsLoading] = createSignal(true);
15
16 onMount(async () => {
17 await retrieveSession();
18 if (loginState() && location.pathname === "/") {
19 window.location.href = "/home";
20 }
21 setIsLoading(false);
22 });
23
24 return (
25 <Show when={!isLoading()} fallback={<></>}>
26 <>
27 <Header />
28 {props.children}
29 <Footer />
30 </>
31 </Show>
32 );
33};
34
35export { Layout };