From 728cfebeb763d021f619d44772f019c7e0f02ac3 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Sat, 4 Oct 2025 14:02:34 +0200 Subject: [PATCH] refactor: extract grid background --- .../client/app/components/grid-background.tsx | 25 +++ apps/client/app/components/layout.tsx | 18 +- apps/client/app/components/ui/input.tsx | 4 +- apps/client/app/routes/home.tsx | 176 +++++++++--------- apps/client/app/routes/login.tsx | 8 +- apps/client/app/routes/onboarding.tsx | 10 +- 6 files changed, 126 insertions(+), 115 deletions(-) create mode 100644 apps/client/app/components/grid-background.tsx diff --git a/apps/client/app/components/grid-background.tsx b/apps/client/app/components/grid-background.tsx new file mode 100644 index 0000000..fd51ca0 --- /dev/null +++ b/apps/client/app/components/grid-background.tsx @@ -0,0 +1,25 @@ +import type { ReactNode } from "react"; +import { cn } from "~/lib/utils"; + +interface GridBackgroundProps { + children: ReactNode; + className?: string; + containerClassName?: string; +} + +export function GridBackground({ children, className, containerClassName }: GridBackgroundProps) { + return ( +
+
+
{children}
+
+ ); +} diff --git a/apps/client/app/components/layout.tsx b/apps/client/app/components/layout.tsx index cfb4be0..14ce1b5 100644 --- a/apps/client/app/components/layout.tsx +++ b/apps/client/app/components/layout.tsx @@ -3,10 +3,10 @@ import { Outlet, useNavigate } from "react-router"; import { toast } from "sonner"; import { logoutMutation } from "~/api-client/@tanstack/react-query.gen"; import { appContext } from "~/context"; -import { cn } from "~/lib/utils"; import { authMiddleware } from "~/middleware/auth"; import type { Route } from "./+types/layout"; import { AppBreadcrumb } from "./app-breadcrumb"; +import { GridBackground } from "./grid-background"; import { Button } from "./ui/button"; export const clientMiddleware = [authMiddleware]; @@ -31,16 +31,8 @@ export default function Layout({ loaderData }: Route.ComponentProps) { }); return ( -
-
-
+ +
{loaderData.user && ( @@ -55,9 +47,9 @@ export default function Layout({ loaderData }: Route.ComponentProps) { )}
-
+
-
+ ); } diff --git a/apps/client/app/components/ui/input.tsx b/apps/client/app/components/ui/input.tsx index c3044cb..2e12f56 100644 --- a/apps/client/app/components/ui/input.tsx +++ b/apps/client/app/components/ui/input.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import type * as React from "react"; import { cn } from "~/lib/utils"; @@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) { type={type} data-slot="input" className={cn( - "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", + "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 border bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className, diff --git a/apps/client/app/routes/home.tsx b/apps/client/app/routes/home.tsx index 7cd35e4..0ab88ab 100644 --- a/apps/client/app/routes/home.tsx +++ b/apps/client/app/routes/home.tsx @@ -60,97 +60,91 @@ export default function Home({ loaderData }: Route.ComponentProps) { }) || []; return ( - <> - {/*

Ironmount

*/} - {/*

*/} - {/* Create, manage, monitor, and automate your volumes with ease. */} - {/*

*/} - -
- - setSearchQuery(e.target.value)} - /> - - - {(searchQuery || statusFilter || backendFilter) && ( - - )} - - -
-
- - - - Name - Backend - Mountpoint - Status - - - - {filteredVolumes.map((volume) => ( - navigate(`/volumes/${volume.name}`)} - > - {volume.name} - - - - - - - {volume.path} - - - - - - - - - ))} - -
-
-
- {filteredVolumes.length === 0 ? ( - "No volumes found." - ) : ( - - {filteredVolumes.length} volume - {filteredVolumes.length > 1 ? "s" : ""} - + +
+ + setSearchQuery(e.target.value)} + /> + + + {(searchQuery || statusFilter || backendFilter) && ( + )} -
-
- + + +
+
+ + + + Name + Backend + Mountpoint + Status + + + + {filteredVolumes.map((volume) => ( + navigate(`/volumes/${volume.name}`)} + > + {volume.name} + + + + + + + {volume.path} + + + + + + + + + ))} + +
+
+
+ {filteredVolumes.length === 0 ? ( + "No volumes found." + ) : ( + + {filteredVolumes.length} volume + {filteredVolumes.length > 1 ? "s" : ""} + + )} +
+
); } diff --git a/apps/client/app/routes/login.tsx b/apps/client/app/routes/login.tsx index 3477d45..5254d43 100644 --- a/apps/client/app/routes/login.tsx +++ b/apps/client/app/routes/login.tsx @@ -5,6 +5,7 @@ import { useForm } from "react-hook-form"; import { useNavigate } from "react-router"; import { toast } from "sonner"; import { loginMutation } from "~/api-client/@tanstack/react-query.gen"; +import { GridBackground } from "~/components/grid-background"; import { Button } from "~/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "~/components/ui/form"; @@ -49,9 +50,8 @@ export default function LoginPage() { }; return ( -
-
- + + Welcome Back Sign in to your account @@ -98,6 +98,6 @@ export default function LoginPage() { -
+ ); } diff --git a/apps/client/app/routes/onboarding.tsx b/apps/client/app/routes/onboarding.tsx index 511e37e..b74c769 100644 --- a/apps/client/app/routes/onboarding.tsx +++ b/apps/client/app/routes/onboarding.tsx @@ -5,6 +5,7 @@ import { useForm } from "react-hook-form"; import { useNavigate } from "react-router"; import { toast } from "sonner"; import { registerMutation } from "~/api-client/@tanstack/react-query.gen"; +import { GridBackground } from "~/components/grid-background"; import { Button } from "~/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card"; import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "~/components/ui/form"; @@ -60,9 +61,8 @@ export default function OnboardingPage() { }; return ( -
-
- + + Welcome to Ironmount Create the admin user to get started @@ -79,7 +79,7 @@ export default function OnboardingPage() { - Choose a username for the admin account (2-50 characters). + Choose a username for the admin account )} @@ -128,6 +128,6 @@ export default function OnboardingPage() { -
+ ); }