From 0a2febe334a751395265990298a9dec323e6deeb Mon Sep 17 00:00:00 2001 From: Gerald Leban Date: Tue, 6 Oct 2026 11:32:13 +0200 Subject: [PATCH] refactor(layouts): consolidate to single BaseLayout, remove app/auth/settings layouts --- inertia/layouts/app.tsx | 103 ---------------------- inertia/layouts/auth.tsx | 10 --- inertia/layouts/base.tsx | 6 ++ inertia/layouts/settings.tsx | 35 -------- inertia/pages/auth/login.tsx | 163 ++++++++++++++++++----------------- inertia/pages/kits/edit.tsx | 144 ++++++++++++++++--------------- inertia/pages/kits/new.tsx | 50 +++++------ 7 files changed, 189 insertions(+), 322 deletions(-) delete mode 100644 inertia/layouts/app.tsx delete mode 100644 inertia/layouts/auth.tsx delete mode 100644 inertia/layouts/settings.tsx diff --git a/inertia/layouts/app.tsx b/inertia/layouts/app.tsx deleted file mode 100644 index b6af78f..0000000 --- a/inertia/layouts/app.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import { useState } from 'react' -import Logo from '~/components/logo' -import { type ReactNode } from 'react' -import { LogOut, Menu, X } from 'lucide-react' -import { Form } from '@adonisjs/inertia/react' -import { usePage } from '@inertiajs/react' -import FlashToasts from '~/components/flash_toasts' -import ThemeToggle from '~/components/theme_toggle' -import { Button } from '~/components/ui/button' -import { Avatar, AvatarFallback } from '~/components/ui/avatar' - -function UserAvatar({ did }: { did: string }) { - const initials = did.replace('did:', '').slice(0, 2).toUpperCase() - return ( - - {initials} - - ) -} - -export default function AppLayout({ children }: { children: ReactNode }) { - const { props } = usePage() - const user = props.user as { did: string } | undefined - const [drawerOpen, setDrawerOpen] = useState(false) - - return ( -
-
-
- - -
- - {user && } -
- -
-
- -
- {user && } - -
-
-
- - {drawerOpen && ( - <> -
setDrawerOpen(false)} - aria-hidden - /> - - - )} - -
{children}
- - -
- ) -} diff --git a/inertia/layouts/auth.tsx b/inertia/layouts/auth.tsx deleted file mode 100644 index 3482b8b..0000000 --- a/inertia/layouts/auth.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { type ReactNode } from 'react' -import BaseLayout from '~/layouts/base' - -export default function AuthLayout({ children }: { children: ReactNode }) { - return ( - -
{children}
-
- ) -} diff --git a/inertia/layouts/base.tsx b/inertia/layouts/base.tsx index ccc85f0..2523b84 100644 --- a/inertia/layouts/base.tsx +++ b/inertia/layouts/base.tsx @@ -23,6 +23,12 @@ export default function BaseLayout({ children }: { children: ReactNode }) {
+
+ +
+
diff --git a/inertia/layouts/settings.tsx b/inertia/layouts/settings.tsx deleted file mode 100644 index a64e246..0000000 --- a/inertia/layouts/settings.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import Page from '~/components/page' -import { type ReactNode } from 'react' -import NavLink, { type NavItem } from '~/components/nav_link' - -/** - * The pages of the settings area, listed in the sidebar. Register a route - * for each page and add it here, for example: - * - * `{ label: 'Profile', route: 'settings.profile', icon: User }` - */ -const items: NavItem[] = [] - -/** - * Renders the settings heading, a sidebar of links and a card holding the - * current page. Nest it under the app layout from each settings page: - * - * `Profile.layout = [AppLayout, SettingsLayout]` - */ -export default function SettingsLayout({ children }: { children: ReactNode }) { - return ( - -
- -
{children}
-
-
- ) -} diff --git a/inertia/pages/auth/login.tsx b/inertia/pages/auth/login.tsx index abfc4ef..71dbe9e 100644 --- a/inertia/pages/auth/login.tsx +++ b/inertia/pages/auth/login.tsx @@ -1,5 +1,5 @@ import { useState, useRef } from 'react' -import AuthLayout from '~/layouts/auth' +import BaseLayout from '~/layouts/base' import { Form } from '@adonisjs/inertia/react' import { usePage } from '@inertiajs/react' import { Button } from '~/components/ui/button' @@ -24,92 +24,97 @@ export default function Login() { } return ( -
-
-
-

- Open your Gunpla hangar. -

+
+
+
+
+

+ Open your Gunpla hangar. +

-

- Sign in to track your kits, log your build progress, and share your shelf with the - community. -

+

+ Sign in to track your kits, log your build progress, and share your shelf with the + community. +

-
- {({ errors, processing }) => ( - <> - - - Bluesky Handle or DID - - - - {errors.input && ( - - {errors.input} - - )} - - - - - )} -
+ Bluesky Handle or DID + + + + {errors.input && ( + + {errors.input} + + )} + - -
+ + + )} + -
-
-
+ +
+
+ +
+
-
-
+
+ ) } -Login.layout = [AuthLayout] +Login.layout = [BaseLayout] diff --git a/inertia/pages/kits/edit.tsx b/inertia/pages/kits/edit.tsx index b670c55..f795bee 100644 --- a/inertia/pages/kits/edit.tsx +++ b/inertia/pages/kits/edit.tsx @@ -1,5 +1,5 @@ import { useState, useMemo } from 'react' -import AppLayout from '~/layouts/app' +import BaseLayout from '~/layouts/base' import Page from '~/components/page' import { Form } from '@adonisjs/inertia/react' import { Button } from '~/components/ui/button' @@ -63,84 +63,86 @@ export default function KitsEdit({ kit }: PageProps) { const [photos, setPhotos] = useState(initialPhotos) return ( - -
-
- {({ errors, processing }) => ( - <> - - {photos - .filter( - (p): p is Extract => p.kind === 'existing' - ) - .map((p) => ( - - ))} - - - -
- -
-
- - )} - +
+ +
+
+ {({ errors, processing }) => ( + <> + + {photos + .filter( + (p): p is Extract => p.kind === 'existing' + ) + .map((p) => ( + + ))} + + + +
+ +
+
+ + )} + - + -
-

Danger Zone

-

- Deleting this kit permanently removes it from your shelf and deletes the record from - your ATProto repository. -

- {!confirmDelete ? ( - - ) : ( -
-
- {({ processing }) => ( - - )} -
+
+

Danger Zone

+

+ Deleting this kit permanently removes it from your shelf and deletes the record from + your ATProto repository. +

+ {!confirmDelete ? ( -
- )} + ) : ( +
+
+ {({ processing }) => ( + + )} +
+ +
+ )} +
-
-
+ +
) } -KitsEdit.layout = [AppLayout] +KitsEdit.layout = [BaseLayout] diff --git a/inertia/pages/kits/new.tsx b/inertia/pages/kits/new.tsx index b17971d..6cc7d77 100644 --- a/inertia/pages/kits/new.tsx +++ b/inertia/pages/kits/new.tsx @@ -1,5 +1,5 @@ import { useState } from 'react' -import AppLayout from '~/layouts/app' +import BaseLayout from '~/layouts/base' import Page from '~/components/page' import { Form } from '@adonisjs/inertia/react' import { Button } from '~/components/ui/button' @@ -23,30 +23,32 @@ export default function KitsNew() { setValues((prev) => ({ ...prev, [field]: value })) return ( - -
-
- {({ errors, processing }) => ( - - - -
- -
-
- )} -
+
+ +
+
+ {({ errors, processing }) => ( + + + +
+ +
+
+ )} +
- -
-
+ +
+
+ ) } -KitsNew.layout = [AppLayout] +KitsNew.layout = [BaseLayout] -- 2.54.0