mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
fix: accessibility and responsiveness fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*
|
**
|
||||||
|
|
||||||
!turbo.json
|
!turbo.json
|
||||||
!bun.lock
|
!bun.lock
|
||||||
@@ -20,6 +20,11 @@
|
|||||||
!packages/**/src/**
|
!packages/**/src/**
|
||||||
|
|
||||||
# License files and attributions
|
# License files and attributions
|
||||||
|
|
||||||
!LICENSE
|
!LICENSE
|
||||||
!NOTICES.md
|
!NOTICES.md
|
||||||
!LICENSES/**
|
!LICENSES/**
|
||||||
|
|
||||||
|
# Node modules
|
||||||
|
|
||||||
|
**/node_modules/**
|
||||||
|
|||||||
@@ -5,170 +5,171 @@
|
|||||||
@custom-variant dark (&:is(.dark *));
|
@custom-variant dark (&:is(.dark *));
|
||||||
|
|
||||||
@theme {
|
@theme {
|
||||||
--font-sans:
|
--breakpoint-xs: 32rem;
|
||||||
"Google Sans Code", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
|
--font-sans:
|
||||||
"Noto Color Emoji";
|
"Google Sans Code", ui-sans-serif, system-ui, sans-serif,
|
||||||
|
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
@apply bg-white dark:bg-[#131313];
|
overflow-x: hidden;
|
||||||
overflow-x: hidden;
|
width: 100%;
|
||||||
width: 100%;
|
position: relative;
|
||||||
position: relative;
|
overscroll-behavior: none;
|
||||||
overscroll-behavior: none;
|
scrollbar-width: thin;
|
||||||
scrollbar-width: thin;
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
body {
|
||||||
color-scheme: dark;
|
@apply bg-[#131313];
|
||||||
}
|
min-height: 100dvh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-content {
|
.main-content {
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
scrollbar-gutter: stable;
|
scrollbar-gutter: stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@theme inline {
|
@theme inline {
|
||||||
--radius-sm: calc(var(--radius) - 4px);
|
--radius-sm: calc(var(--radius) - 4px);
|
||||||
--radius-md: calc(var(--radius) - 2px);
|
--radius-md: calc(var(--radius) - 2px);
|
||||||
--radius-lg: var(--radius);
|
--radius-lg: var(--radius);
|
||||||
--radius-xl: calc(var(--radius) + 4px);
|
--radius-xl: calc(var(--radius) + 4px);
|
||||||
--color-background: var(--background);
|
--color-background: var(--background);
|
||||||
--color-foreground: var(--foreground);
|
--color-foreground: var(--foreground);
|
||||||
--color-card: var(--card);
|
--color-card: var(--card);
|
||||||
--color-card-foreground: var(--card-foreground);
|
--color-card-foreground: var(--card-foreground);
|
||||||
--color-card-header: var(--card-header);
|
--color-card-header: var(--card-header);
|
||||||
--color-popover: var(--popover);
|
--color-popover: var(--popover);
|
||||||
--color-popover-foreground: var(--popover-foreground);
|
--color-popover-foreground: var(--popover-foreground);
|
||||||
--color-primary: var(--primary);
|
--color-primary: var(--primary);
|
||||||
--color-primary-foreground: var(--primary-foreground);
|
--color-primary-foreground: var(--primary-foreground);
|
||||||
--color-secondary: var(--secondary);
|
--color-secondary: var(--secondary);
|
||||||
--color-secondary-foreground: var(--secondary-foreground);
|
--color-secondary-foreground: var(--secondary-foreground);
|
||||||
--color-muted: var(--muted);
|
--color-muted: var(--muted);
|
||||||
--color-muted-foreground: var(--muted-foreground);
|
--color-muted-foreground: var(--muted-foreground);
|
||||||
--color-accent: var(--accent);
|
--color-accent: var(--accent);
|
||||||
--color-accent-foreground: var(--accent-foreground);
|
--color-accent-foreground: var(--accent-foreground);
|
||||||
--color-destructive: var(--destructive);
|
--color-destructive: var(--destructive);
|
||||||
--color-border: var(--border);
|
--color-border: var(--border);
|
||||||
--color-input: var(--input);
|
--color-input: var(--input);
|
||||||
--color-ring: var(--ring);
|
--color-ring: var(--ring);
|
||||||
--color-chart-1: var(--chart-1);
|
--color-chart-1: var(--chart-1);
|
||||||
--color-chart-2: var(--chart-2);
|
--color-chart-2: var(--chart-2);
|
||||||
--color-chart-3: var(--chart-3);
|
--color-chart-3: var(--chart-3);
|
||||||
--color-chart-4: var(--chart-4);
|
--color-chart-4: var(--chart-4);
|
||||||
--color-chart-5: var(--chart-5);
|
--color-chart-5: var(--chart-5);
|
||||||
--color-sidebar: var(--sidebar);
|
--color-sidebar: var(--sidebar);
|
||||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||||
--color-sidebar-primary: var(--sidebar-primary);
|
--color-sidebar-primary: var(--sidebar-primary);
|
||||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||||
--color-sidebar-accent: var(--sidebar-accent);
|
--color-sidebar-accent: var(--sidebar-accent);
|
||||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||||
--color-sidebar-border: var(--sidebar-border);
|
--color-sidebar-border: var(--sidebar-border);
|
||||||
--color-sidebar-ring: var(--sidebar-ring);
|
--color-sidebar-ring: var(--sidebar-ring);
|
||||||
--color-strong-accent: var(--strong-accent);
|
--color-strong-accent: var(--strong-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
color-scheme: dark;
|
--radius: 0.625rem;
|
||||||
|
--background: oklch(1 0 0);
|
||||||
--radius: 0.625rem;
|
--foreground: oklch(0.145 0 0);
|
||||||
--background: oklch(1 0 0);
|
--card: oklch(1 0 0);
|
||||||
--foreground: oklch(0.145 0 0);
|
--card-foreground: oklch(0.145 0 0);
|
||||||
--card: oklch(1 0 0);
|
--card-header: oklch(0.922 0 0);
|
||||||
--card-foreground: oklch(0.145 0 0);
|
--popover: oklch(1 0 0);
|
||||||
--card-header: oklch(0.922 0 0);
|
--popover-foreground: oklch(0.145 0 0);
|
||||||
--popover: oklch(1 0 0);
|
--primary: oklch(0.205 0 0);
|
||||||
--popover-foreground: oklch(0.145 0 0);
|
--primary-foreground: oklch(0.985 0 0);
|
||||||
--primary: oklch(0.205 0 0);
|
--secondary: oklch(0.97 0 0);
|
||||||
--primary-foreground: oklch(0.985 0 0);
|
--secondary-foreground: oklch(0.205 0 0);
|
||||||
--secondary: oklch(0.97 0 0);
|
--muted: oklch(0.97 0 0);
|
||||||
--secondary-foreground: oklch(0.205 0 0);
|
--muted-foreground: oklch(0.556 0 0);
|
||||||
--muted: oklch(0.97 0 0);
|
--accent: oklch(0.97 0 0);
|
||||||
--muted-foreground: oklch(0.556 0 0);
|
--accent-foreground: oklch(0.205 0 0);
|
||||||
--accent: oklch(0.97 0 0);
|
--destructive: oklch(0.577 0.245 27.325);
|
||||||
--accent-foreground: oklch(0.205 0 0);
|
--border: oklch(0.922 0 0);
|
||||||
--destructive: oklch(0.577 0.245 27.325);
|
--input: oklch(0.922 0 0);
|
||||||
--border: oklch(0.922 0 0);
|
--ring: oklch(0.708 0 0);
|
||||||
--input: oklch(0.922 0 0);
|
--chart-1: oklch(0.646 0.222 41.116);
|
||||||
--ring: oklch(0.708 0 0);
|
--chart-2: oklch(0.6 0.118 184.704);
|
||||||
--chart-1: oklch(0.646 0.222 41.116);
|
--chart-3: oklch(0.398 0.07 227.392);
|
||||||
--chart-2: oklch(0.6 0.118 184.704);
|
--chart-4: oklch(0.828 0.189 84.429);
|
||||||
--chart-3: oklch(0.398 0.07 227.392);
|
--chart-5: oklch(0.769 0.188 70.08);
|
||||||
--chart-4: oklch(0.828 0.189 84.429);
|
--sidebar: oklch(0.985 0 0);
|
||||||
--chart-5: oklch(0.769 0.188 70.08);
|
--sidebar-foreground: oklch(0.145 0 0);
|
||||||
--sidebar: oklch(0.985 0 0);
|
--sidebar-primary: oklch(0.205 0 0);
|
||||||
--sidebar-foreground: oklch(0.145 0 0);
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||||
--sidebar-primary: oklch(0.205 0 0);
|
--sidebar-accent: oklch(0.97 0 0);
|
||||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||||
--sidebar-accent: oklch(0.97 0 0);
|
--sidebar-border: oklch(0.922 0 0);
|
||||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
--sidebar-ring: oklch(0.708 0 0);
|
||||||
--sidebar-border: oklch(0.922 0 0);
|
--strong-accent: #ff543a;
|
||||||
--sidebar-ring: oklch(0.708 0 0);
|
|
||||||
--strong-accent: #ff543a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
--background: #131313;
|
color-scheme: dark;
|
||||||
--foreground: oklch(0.985 0 0);
|
|
||||||
--card: #131313;
|
--background: #131313;
|
||||||
--card-header: #1b1b1b;
|
--foreground: oklch(0.985 0 0);
|
||||||
/* --card: oklch(0.205 0 0); ORIGINAL */
|
--card: #131313;
|
||||||
--card-foreground: oklch(0.985 0 0);
|
--card-header: #1b1b1b;
|
||||||
--popover: oklch(0.205 0 0);
|
/* --card: oklch(0.205 0 0); ORIGINAL */
|
||||||
--popover-foreground: oklch(0.985 0 0);
|
--card-foreground: oklch(0.985 0 0);
|
||||||
--primary: oklch(0.922 0 0);
|
--popover: oklch(0.205 0 0);
|
||||||
--primary-foreground: oklch(0.205 0 0);
|
--popover-foreground: oklch(0.985 0 0);
|
||||||
--secondary: oklch(0.1448 0 0);
|
--primary: oklch(0.922 0 0);
|
||||||
/* --secondary: oklch(0.269 0 0); ORIGINAL */
|
--primary-foreground: oklch(0.205 0 0);
|
||||||
--secondary-foreground: oklch(0.985 0 0);
|
--secondary: oklch(0.1448 0 0);
|
||||||
--muted: oklch(0.269 0 0);
|
/* --secondary: oklch(0.269 0 0); ORIGINAL */
|
||||||
--muted-foreground: oklch(0.708 0 0);
|
--secondary-foreground: oklch(0.985 0 0);
|
||||||
--accent: oklch(0.269 0 0);
|
--muted: oklch(0.269 0 0);
|
||||||
--accent-foreground: oklch(0.985 0 0);
|
--muted-foreground: oklch(0.708 0 0);
|
||||||
--destructive: #ff543a;
|
--accent: oklch(0.269 0 0);
|
||||||
--border: oklch(1 0 0 / 10%);
|
--accent-foreground: oklch(0.985 0 0);
|
||||||
--input: oklch(1 0 0 / 15%);
|
--destructive: #ff543a;
|
||||||
--ring: oklch(0.556 0 0);
|
--border: oklch(1 0 0 / 10%);
|
||||||
--chart-1: oklch(0.488 0.243 264.376);
|
--input: oklch(1 0 0 / 15%);
|
||||||
--chart-2: oklch(0.696 0.17 162.48);
|
--ring: oklch(0.556 0 0);
|
||||||
--chart-3: oklch(0.769 0.188 70.08);
|
--chart-1: oklch(0.488 0.243 264.376);
|
||||||
--chart-4: oklch(0.627 0.265 303.9);
|
--chart-2: oklch(0.696 0.17 162.48);
|
||||||
--chart-5: oklch(0.645 0.246 16.439);
|
--chart-3: oklch(0.769 0.188 70.08);
|
||||||
--sidebar: oklch(0.205 0 0);
|
--chart-4: oklch(0.627 0.265 303.9);
|
||||||
--sidebar-foreground: oklch(0.985 0 0);
|
--chart-5: oklch(0.645 0.246 16.439);
|
||||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
--sidebar: oklch(0.205 0 0);
|
||||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
--sidebar-foreground: oklch(0.985 0 0);
|
||||||
--sidebar-accent: oklch(0.269 0 0);
|
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||||
--sidebar-border: oklch(1 0 0 / 10%);
|
--sidebar-accent: oklch(0.269 0 0);
|
||||||
--sidebar-ring: oklch(0.556 0 0);
|
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||||
--strong-accent: #ff543a;
|
--sidebar-border: oklch(1 0 0 / 10%);
|
||||||
|
--sidebar-ring: oklch(0.556 0 0);
|
||||||
|
--strong-accent: #ff543a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
* {
|
* {
|
||||||
@apply border-border outline-ring/50;
|
@apply border-border outline-ring/50;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
@apply bg-background text-foreground;
|
@apply bg-background text-foreground;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
:root {
|
:root {
|
||||||
--chart-1: oklch(0.646 0.222 41.116);
|
--chart-1: oklch(0.646 0.222 41.116);
|
||||||
--chart-2: oklch(0.6 0.118 184.704);
|
--chart-2: oklch(0.6 0.118 184.704);
|
||||||
--chart-3: oklch(0.398 0.07 227.392);
|
--chart-3: oklch(0.398 0.07 227.392);
|
||||||
--chart-4: oklch(0.828 0.189 84.429);
|
--chart-4: oklch(0.828 0.189 84.429);
|
||||||
--chart-5: oklch(0.769 0.188 70.08);
|
--chart-5: oklch(0.769 0.188 70.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
--chart-1: oklch(0.488 0.243 264.376);
|
--chart-1: oklch(0.488 0.243 264.376);
|
||||||
--chart-2: oklch(0.696 0.17 162.48);
|
--chart-2: oklch(0.696 0.17 162.48);
|
||||||
--chart-3: oklch(0.769 0.188 70.08);
|
--chart-3: oklch(0.769 0.188 70.08);
|
||||||
--chart-4: oklch(0.627 0.265 303.9);
|
--chart-4: oklch(0.627 0.265 303.9);
|
||||||
--chart-5: oklch(0.645 0.246 16.439);
|
--chart-5: oklch(0.645 0.246 16.439);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,33 +2,33 @@ import { Mountain } from "lucide-react";
|
|||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
type AuthLayoutProps = {
|
type AuthLayoutProps = {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function AuthLayout({ title, description, children }: AuthLayoutProps) {
|
export function AuthLayout({ title, description, children }: AuthLayoutProps) {
|
||||||
return (
|
return (
|
||||||
<div className="flex min-h-screen">
|
<div className="flex mt-[25%] lg:mt-0 lg:min-h-screen">
|
||||||
<div className="flex flex-1 items-center justify-center bg-background p-8">
|
<div className="flex flex-1 items-center justify-center bg-background p-8">
|
||||||
<div className="w-full max-w-md space-y-8">
|
<div className="w-full max-w-md space-y-8">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<Mountain className="size-5 text-strong-accent" />
|
<Mountain className="size-5 text-strong-accent" />
|
||||||
<span className="text-lg font-semibold">Ironmount</span>
|
<span className="text-lg font-semibold">Ironmount</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<h1 className="text-3xl font-bold tracking-tight">{title}</h1>
|
<h1 className="text-3xl font-bold tracking-tight">{title}</h1>
|
||||||
<p className="text-sm text-muted-foreground">{description}</p>
|
<p className="text-sm text-muted-foreground">{description}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="hidden lg:block lg:flex-1 dither-xl bg-cover bg-center"
|
className="hidden lg:block lg:flex-1 dither-lg bg-cover bg-center"
|
||||||
style={{ backgroundImage: "url(/images/background.jpg)" }}
|
style={{ backgroundImage: "url(/images/background.jpg)" }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,73 +15,84 @@ import { AppSidebar } from "./app-sidebar";
|
|||||||
export const clientMiddleware = [authMiddleware];
|
export const clientMiddleware = [authMiddleware];
|
||||||
|
|
||||||
export async function clientLoader({ context }: Route.LoaderArgs) {
|
export async function clientLoader({ context }: Route.LoaderArgs) {
|
||||||
const ctx = context.get(appContext);
|
const ctx = context.get(appContext);
|
||||||
|
|
||||||
if (ctx.user && !ctx.user.hasDownloadedResticPassword) {
|
if (ctx.user && !ctx.user.hasDownloadedResticPassword) {
|
||||||
throw redirect("/download-recovery-key");
|
throw redirect("/download-recovery-key");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Layout({ loaderData }: Route.ComponentProps) {
|
export default function Layout({ loaderData }: Route.ComponentProps) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const logout = useMutation({
|
const logout = useMutation({
|
||||||
...logoutMutation(),
|
...logoutMutation(),
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
navigate("/login", { replace: true });
|
navigate("/login", { replace: true });
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
toast.error("Logout failed", { description: error.message });
|
toast.error("Logout failed", { description: error.message });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarProvider defaultOpen={true}>
|
<SidebarProvider defaultOpen={true}>
|
||||||
<AppSidebar />
|
<AppSidebar />
|
||||||
<div className="w-full relative flex flex-col h-screen overflow-hidden">
|
<div className="w-full relative flex flex-col h-screen overflow-hidden">
|
||||||
<header className="z-50 bg-card-header border-b border-border/50 flex-shrink-0">
|
<header className="z-50 bg-card-header border-b border-border/50 flex-shrink-0">
|
||||||
<div className="flex items-center justify-between py-3 sm:py-4 px-2 sm:px-8 mx-auto container">
|
<div className="flex items-center justify-between py-3 sm:py-4 px-2 sm:px-8 mx-auto container">
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<SidebarTrigger />
|
<SidebarTrigger />
|
||||||
<AppBreadcrumb />
|
<AppBreadcrumb />
|
||||||
</div>
|
</div>
|
||||||
{loaderData.user && (
|
{loaderData.user && (
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<span className="text-sm text-muted-foreground hidden md:inline-flex">
|
<span className="text-sm text-muted-foreground hidden md:inline-flex">
|
||||||
Welcome,
|
Welcome,
|
||||||
<span className="text-strong-accent">{loaderData.user?.username}</span>
|
<span className="text-strong-accent">
|
||||||
</span>
|
{loaderData.user?.username}
|
||||||
<Button variant="default" size="sm" onClick={() => logout.mutate({})} loading={logout.isPending}>
|
</span>
|
||||||
Logout
|
</span>
|
||||||
</Button>
|
<Button
|
||||||
<Button variant="default" size="sm" className="relative overflow-hidden hidden lg:inline-flex">
|
variant="default"
|
||||||
<a
|
size="sm"
|
||||||
href="https://github.com/nicotsx/ironmount/issues/new"
|
onClick={() => logout.mutate({})}
|
||||||
target="_blank"
|
loading={logout.isPending}
|
||||||
rel="noreferrer"
|
>
|
||||||
className="flex items-center gap-2"
|
Logout
|
||||||
>
|
</Button>
|
||||||
<span className="flex items-center gap-2">
|
<Button
|
||||||
<LifeBuoy />
|
variant="default"
|
||||||
<span>Report an issue</span>
|
size="sm"
|
||||||
</span>
|
className="relative overflow-hidden hidden lg:inline-flex"
|
||||||
</a>
|
>
|
||||||
</Button>
|
<a
|
||||||
</div>
|
href="https://github.com/nicotsx/ironmount/issues/new"
|
||||||
)}
|
target="_blank"
|
||||||
</div>
|
rel="noreferrer"
|
||||||
</header>
|
className="flex items-center gap-2"
|
||||||
<div className="main-content flex-1 overflow-y-auto">
|
>
|
||||||
<GridBackground>
|
<span className="flex items-center gap-2">
|
||||||
<main className="flex flex-col p-2 pt-2 sm:p-8 sm:pt-6 mx-auto">
|
<LifeBuoy />
|
||||||
<Outlet />
|
<span>Report an issue</span>
|
||||||
</main>
|
</span>
|
||||||
</GridBackground>
|
</a>
|
||||||
</div>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</SidebarProvider>
|
)}
|
||||||
);
|
</div>
|
||||||
|
</header>
|
||||||
|
<div className="main-content flex-1 overflow-y-auto">
|
||||||
|
<GridBackground>
|
||||||
|
<main className="flex flex-col p-2 pb-6 pt-2 sm:p-8 sm:pt-6 mx-auto">
|
||||||
|
<Outlet />
|
||||||
|
</main>
|
||||||
|
</GridBackground>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</SidebarProvider>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,25 +2,36 @@ import { cn } from "~/lib/utils";
|
|||||||
import { Switch } from "./ui/switch";
|
import { Switch } from "./ui/switch";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isOn: boolean;
|
isOn: boolean;
|
||||||
toggle: (v: boolean) => void;
|
toggle: (v: boolean) => void;
|
||||||
enabledLabel: string;
|
enabledLabel: string;
|
||||||
disabledLabel: string;
|
disabledLabel: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const OnOff = ({ isOn, toggle, enabledLabel, disabledLabel, disabled }: Props) => {
|
export const OnOff = ({
|
||||||
return (
|
isOn,
|
||||||
<div
|
toggle,
|
||||||
className={cn(
|
enabledLabel,
|
||||||
"flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs font-semibold uppercase tracking-wide transition-colors",
|
disabledLabel,
|
||||||
isOn
|
disabled,
|
||||||
? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/40 dark:bg-emerald-500/10 dark:text-emerald-200"
|
}: Props) => {
|
||||||
: "border-muted bg-muted/40 text-muted-foreground dark:border-muted/60 dark:bg-muted/10",
|
return (
|
||||||
)}
|
<div
|
||||||
>
|
className={cn(
|
||||||
<span>{isOn ? enabledLabel : disabledLabel}</span>
|
"flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs font-semibold uppercase tracking-wide transition-colors",
|
||||||
<Switch disabled={disabled} checked={isOn} onCheckedChange={toggle} />
|
isOn
|
||||||
</div>
|
? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/40 dark:bg-emerald-500/10 dark:text-emerald-200"
|
||||||
);
|
: "border-muted bg-muted/40 text-muted-foreground dark:border-muted/60 dark:bg-muted/10"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span>{isOn ? enabledLabel : disabledLabel}</span>
|
||||||
|
<Switch
|
||||||
|
disabled={disabled}
|
||||||
|
checked={isOn}
|
||||||
|
onCheckedChange={toggle}
|
||||||
|
aria-label={isOn ? `Toggle ${enabledLabel}` : `Toggle ${disabledLabel}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,47 +3,53 @@ import { cn } from "~/lib/utils";
|
|||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
||||||
|
|
||||||
export const StatusDot = ({ status }: { status: VolumeStatus }) => {
|
export const StatusDot = ({ status }: { status: VolumeStatus }) => {
|
||||||
const statusMapping = {
|
const statusMapping = {
|
||||||
mounted: {
|
mounted: {
|
||||||
color: "bg-green-500",
|
color: "bg-green-500",
|
||||||
colorLight: "bg-emerald-400",
|
colorLight: "bg-emerald-400",
|
||||||
animated: true,
|
animated: true,
|
||||||
},
|
},
|
||||||
unmounted: {
|
unmounted: {
|
||||||
color: "bg-gray-500",
|
color: "bg-gray-500",
|
||||||
colorLight: "bg-gray-400",
|
colorLight: "bg-gray-400",
|
||||||
animated: false,
|
animated: false,
|
||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
color: "bg-red-500",
|
color: "bg-red-500",
|
||||||
colorLight: "bg-amber-700",
|
colorLight: "bg-amber-700",
|
||||||
animated: true,
|
animated: true,
|
||||||
},
|
},
|
||||||
unknown: {
|
unknown: {
|
||||||
color: "bg-yellow-500",
|
color: "bg-yellow-500",
|
||||||
colorLight: "bg-yellow-400",
|
colorLight: "bg-yellow-400",
|
||||||
animated: true,
|
animated: true,
|
||||||
},
|
},
|
||||||
}[status];
|
}[status];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<span className="relative flex size-3 mx-auto">
|
<span className="relative flex size-3 mx-auto">
|
||||||
{statusMapping.animated && (
|
{statusMapping.animated && (
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
"absolute inline-flex h-full w-full animate-ping rounded-full opacity-75",
|
"absolute inline-flex h-full w-full animate-ping rounded-full opacity-75",
|
||||||
`${statusMapping.colorLight}`,
|
`${statusMapping.colorLight}`
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<span className={cn("relative inline-flex size-3 rounded-full", `${statusMapping.color}`)} />
|
<span
|
||||||
</span>
|
aria-label={status}
|
||||||
</TooltipTrigger>
|
className={cn(
|
||||||
<TooltipContent>
|
"relative inline-flex size-3 rounded-full",
|
||||||
<p className="capitalize">{status}</p>
|
`${statusMapping.color}`
|
||||||
</TooltipContent>
|
)}
|
||||||
</Tooltip>
|
/>
|
||||||
);
|
</span>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent>
|
||||||
|
<p className="capitalize">{status}</p>
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ export const CreateScheduleForm = ({ initialValues, formId, onSubmit, volume }:
|
|||||||
onSelectionChange={handleSelectionChange}
|
onSelectionChange={handleSelectionChange}
|
||||||
withCheckboxes={true}
|
withCheckboxes={true}
|
||||||
foldersOnly={true}
|
foldersOnly={true}
|
||||||
className="overflow-auto flex-1 border rounded-md bg-card p-2 min-h-[300px] max-h-[400px]"
|
className="max-w-2xs xs:max-w-screen flex-1 border rounded-md bg-card p-2 min-h-[300px] max-h-[400px]"
|
||||||
/>
|
/>
|
||||||
{selectedPaths.size > 0 && (
|
{selectedPaths.size > 0 && (
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
|
|||||||
@@ -3,19 +3,19 @@ import { useNavigate, useParams, useSearchParams } from "react-router";
|
|||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import {
|
import {
|
||||||
deleteRepositoryMutation,
|
deleteRepositoryMutation,
|
||||||
getRepositoryOptions,
|
getRepositoryOptions,
|
||||||
listSnapshotsOptions,
|
listSnapshotsOptions,
|
||||||
} from "~/api-client/@tanstack/react-query.gen";
|
} from "~/api-client/@tanstack/react-query.gen";
|
||||||
import { Button } from "~/components/ui/button";
|
import { Button } from "~/components/ui/button";
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
AlertDialogAction,
|
AlertDialogAction,
|
||||||
AlertDialogCancel,
|
AlertDialogCancel,
|
||||||
AlertDialogContent,
|
AlertDialogContent,
|
||||||
AlertDialogDescription,
|
AlertDialogDescription,
|
||||||
AlertDialogHeader,
|
AlertDialogHeader,
|
||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
} from "~/components/ui/alert-dialog";
|
} from "~/components/ui/alert-dialog";
|
||||||
import { parseError } from "~/lib/errors";
|
import { parseError } from "~/lib/errors";
|
||||||
import { getRepository } from "~/api-client/sdk.gen";
|
import { getRepository } from "~/api-client/sdk.gen";
|
||||||
@@ -26,127 +26,137 @@ import { RepositoryInfoTabContent } from "../tabs/info";
|
|||||||
import { RepositorySnapshotsTabContent } from "../tabs/snapshots";
|
import { RepositorySnapshotsTabContent } from "../tabs/snapshots";
|
||||||
|
|
||||||
export function meta({ params }: Route.MetaArgs) {
|
export function meta({ params }: Route.MetaArgs) {
|
||||||
return [
|
return [
|
||||||
{ title: params.name },
|
{ title: params.name },
|
||||||
{
|
{
|
||||||
name: "description",
|
name: "description",
|
||||||
content: "View repository configuration, status, and snapshots.",
|
content: "View repository configuration, status, and snapshots.",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const clientLoader = async ({ params }: Route.ClientLoaderArgs) => {
|
export const clientLoader = async ({ params }: Route.ClientLoaderArgs) => {
|
||||||
const repository = await getRepository({ path: { name: params.name ?? "" } });
|
const repository = await getRepository({ path: { name: params.name ?? "" } });
|
||||||
if (repository.data) return repository.data;
|
if (repository.data) return repository.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RepositoryDetailsPage({ loaderData }: Route.ComponentProps) {
|
export default function RepositoryDetailsPage({
|
||||||
const { name } = useParams<{ name: string }>();
|
loaderData,
|
||||||
const navigate = useNavigate();
|
}: Route.ComponentProps) {
|
||||||
const queryClient = useQueryClient();
|
const { name } = useParams<{ name: string }>();
|
||||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
const navigate = useNavigate();
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||||
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const activeTab = searchParams.get("tab") || "info";
|
const activeTab = searchParams.get("tab") || "info";
|
||||||
|
|
||||||
const { data } = useQuery({
|
const { data } = useQuery({
|
||||||
...getRepositoryOptions({ path: { name: name ?? "" } }),
|
...getRepositoryOptions({ path: { name: name ?? "" } }),
|
||||||
initialData: loaderData,
|
initialData: loaderData,
|
||||||
refetchInterval: 10000,
|
refetchInterval: 10000,
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (name) {
|
if (name) {
|
||||||
queryClient.prefetchQuery(listSnapshotsOptions({ path: { name } }));
|
queryClient.prefetchQuery(listSnapshotsOptions({ path: { name } }));
|
||||||
}
|
}
|
||||||
}, [name, queryClient]);
|
}, [name, queryClient]);
|
||||||
|
|
||||||
const deleteRepo = useMutation({
|
const deleteRepo = useMutation({
|
||||||
...deleteRepositoryMutation(),
|
...deleteRepositoryMutation(),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success("Repository deleted successfully");
|
toast.success("Repository deleted successfully");
|
||||||
navigate("/repositories");
|
navigate("/repositories");
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
toast.error("Failed to delete repository", {
|
toast.error("Failed to delete repository", {
|
||||||
description: parseError(error)?.message,
|
description: parseError(error)?.message,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleConfirmDelete = () => {
|
const handleConfirmDelete = () => {
|
||||||
setShowDeleteConfirm(false);
|
setShowDeleteConfirm(false);
|
||||||
deleteRepo.mutate({ path: { name: name ?? "" } });
|
deleteRepo.mutate({ path: { name: name ?? "" } });
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return <div>Repository not found</div>;
|
return <div>Repository not found</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return <div>Loading...</div>;
|
return <div>Loading...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
<div>
|
<div className="text-sm font-semibold text-muted-foreground flex items-center gap-2">
|
||||||
<div className="text-sm font-semibold mb-2 text-muted-foreground flex items-center gap-2">
|
<span
|
||||||
<span
|
className={cn(
|
||||||
className={cn(
|
"inline-flex items-center gap-2 px-2 py-1 rounded-md text-xs bg-gray-500/10 text-gray-500",
|
||||||
"inline-flex items-center gap-2 px-2 py-1 rounded-md text-xs bg-gray-500/10 text-gray-500",
|
{
|
||||||
{
|
"bg-green-500/10 text-green-500": data.status === "healthy",
|
||||||
"bg-green-500/10 text-green-500": data.status === "healthy",
|
"bg-red-500/10 text-red-500": data.status === "error",
|
||||||
"bg-red-500/10 text-red-500": data.status === "error",
|
}
|
||||||
},
|
)}
|
||||||
)}
|
>
|
||||||
>
|
{data.status || "unknown"}
|
||||||
{data.status || "unknown"}
|
</span>
|
||||||
</span>
|
<span className="text-xs bg-primary/10 rounded-md px-2 py-1">
|
||||||
<span className="text-xs bg-primary/10 rounded-md px-2 py-1">{data.type}</span>
|
{data.type}
|
||||||
</div>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-4">
|
<div className="flex gap-4">
|
||||||
<Button variant="destructive" onClick={() => setShowDeleteConfirm(true)} disabled={deleteRepo.isPending}>
|
<Button
|
||||||
Delete
|
variant="destructive"
|
||||||
</Button>
|
onClick={() => setShowDeleteConfirm(true)}
|
||||||
</div>
|
disabled={deleteRepo.isPending}
|
||||||
</div>
|
>
|
||||||
|
Delete
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Tabs value={activeTab} onValueChange={(value) => setSearchParams({ tab: value })}>
|
<Tabs
|
||||||
<TabsList className="mb-2">
|
value={activeTab}
|
||||||
<TabsTrigger value="info">Configuration</TabsTrigger>
|
onValueChange={(value) => setSearchParams({ tab: value })}
|
||||||
<TabsTrigger value="snapshots">Snapshots</TabsTrigger>
|
>
|
||||||
</TabsList>
|
<TabsList className="mb-2">
|
||||||
<TabsContent value="info">
|
<TabsTrigger value="info">Configuration</TabsTrigger>
|
||||||
<RepositoryInfoTabContent repository={data} />
|
<TabsTrigger value="snapshots">Snapshots</TabsTrigger>
|
||||||
</TabsContent>
|
</TabsList>
|
||||||
<TabsContent value="snapshots">
|
<TabsContent value="info">
|
||||||
<RepositorySnapshotsTabContent repository={data} />
|
<RepositoryInfoTabContent repository={data} />
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
</Tabs>
|
<TabsContent value="snapshots">
|
||||||
|
<RepositorySnapshotsTabContent repository={data} />
|
||||||
|
</TabsContent>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
<AlertDialog open={showDeleteConfirm} onOpenChange={setShowDeleteConfirm}>
|
<AlertDialog open={showDeleteConfirm} onOpenChange={setShowDeleteConfirm}>
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>Delete repository?</AlertDialogTitle>
|
<AlertDialogTitle>Delete repository?</AlertDialogTitle>
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
Are you sure you want to delete the repository <strong>{name}</strong>? This action cannot be undone and
|
Are you sure you want to delete the repository{" "}
|
||||||
will remove all backup data.
|
<strong>{name}</strong>? This action cannot be undone and will
|
||||||
</AlertDialogDescription>
|
remove all backup data.
|
||||||
</AlertDialogHeader>
|
</AlertDialogDescription>
|
||||||
<div className="flex gap-3 justify-end">
|
</AlertDialogHeader>
|
||||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
<div className="flex gap-3 justify-end">
|
||||||
<AlertDialogAction
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||||
onClick={handleConfirmDelete}
|
<AlertDialogAction
|
||||||
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
onClick={handleConfirmDelete}
|
||||||
>
|
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
||||||
Delete repository
|
>
|
||||||
</AlertDialogAction>
|
Delete repository
|
||||||
</div>
|
</AlertDialogAction>
|
||||||
</AlertDialogContent>
|
</div>
|
||||||
</AlertDialog>
|
</AlertDialogContent>
|
||||||
</>
|
</AlertDialog>
|
||||||
);
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,90 +8,102 @@ import { getSnapshotDetails } from "~/api-client";
|
|||||||
import type { Route } from "./+types/snapshot-details";
|
import type { Route } from "./+types/snapshot-details";
|
||||||
|
|
||||||
export function meta({ params }: Route.MetaArgs) {
|
export function meta({ params }: Route.MetaArgs) {
|
||||||
return [
|
return [
|
||||||
{ title: `Snapshot ${params.snapshotId}` },
|
{ title: `Snapshot ${params.snapshotId}` },
|
||||||
{
|
{
|
||||||
name: "description",
|
name: "description",
|
||||||
content: "Browse and restore files from a backup snapshot.",
|
content: "Browse and restore files from a backup snapshot.",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const clientLoader = async ({ params }: Route.ClientLoaderArgs) => {
|
export const clientLoader = async ({ params }: Route.ClientLoaderArgs) => {
|
||||||
const snapshot = await getSnapshotDetails({ path: { name: params.name, snapshotId: params.snapshotId } });
|
const snapshot = await getSnapshotDetails({
|
||||||
if (snapshot.data) return snapshot.data;
|
path: { name: params.name, snapshotId: params.snapshotId },
|
||||||
|
});
|
||||||
|
if (snapshot.data) return snapshot.data;
|
||||||
|
|
||||||
return redirect("/repositories");
|
return redirect("/repositories");
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function SnapshotDetailsPage({ loaderData }: Route.ComponentProps) {
|
export default function SnapshotDetailsPage({
|
||||||
const { name, snapshotId } = useParams<{ name: string; snapshotId: string }>();
|
loaderData,
|
||||||
|
}: Route.ComponentProps) {
|
||||||
|
const { name, snapshotId } = useParams<{
|
||||||
|
name: string;
|
||||||
|
snapshotId: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
const { data } = useQuery({
|
const { data } = useQuery({
|
||||||
...listSnapshotFilesOptions({
|
...listSnapshotFilesOptions({
|
||||||
path: { name: name ?? "", snapshotId: snapshotId ?? "" },
|
path: { name: name ?? "", snapshotId: snapshotId ?? "" },
|
||||||
query: { path: "/" },
|
query: { path: "/" },
|
||||||
}),
|
}),
|
||||||
enabled: !!name && !!snapshotId,
|
enabled: !!name && !!snapshotId,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!name || !snapshotId) {
|
if (!name || !snapshotId) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center h-full">
|
<div className="flex items-center justify-center h-full">
|
||||||
<p className="text-destructive">Invalid snapshot reference</p>
|
<p className="text-destructive">Invalid snapshot reference</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-bold">{name}</h1>
|
<h1 className="text-2xl font-bold">{name}</h1>
|
||||||
<p className="text-sm text-muted-foreground">Snapshot: {snapshotId}</p>
|
<p className="text-sm text-muted-foreground">
|
||||||
</div>
|
Snapshot: {snapshotId}
|
||||||
<RestoreSnapshotDialog name={name} snapshotId={snapshotId} />
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<RestoreSnapshotDialog name={name} snapshotId={snapshotId} />
|
||||||
|
</div>
|
||||||
|
|
||||||
<SnapshotFileBrowser repositoryName={name} snapshot={loaderData} />
|
<SnapshotFileBrowser repositoryName={name} snapshot={loaderData} />
|
||||||
|
|
||||||
{data?.snapshot && (
|
{data?.snapshot && (
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>Snapshot Information</CardTitle>
|
<CardTitle>Snapshot Information</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-2 text-sm">
|
<CardContent className="space-y-2 text-sm">
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<span className="text-muted-foreground">Snapshot ID:</span>
|
<span className="text-muted-foreground">Snapshot ID:</span>
|
||||||
<p className="font-mono">{data.snapshot.id}</p>
|
<p className="font-mono break-all">{data.snapshot.id}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span className="text-muted-foreground">Short ID:</span>
|
<span className="text-muted-foreground">Short ID:</span>
|
||||||
<p className="font-mono">{data.snapshot.short_id}</p>
|
<p className="font-mono break-al">{data.snapshot.short_id}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span className="text-muted-foreground">Hostname:</span>
|
<span className="text-muted-foreground">Hostname:</span>
|
||||||
<p>{data.snapshot.hostname}</p>
|
<p>{data.snapshot.hostname}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span className="text-muted-foreground">Time:</span>
|
<span className="text-muted-foreground">Time:</span>
|
||||||
<p>{new Date(data.snapshot.time).toLocaleString()}</p>
|
<p>{new Date(data.snapshot.time).toLocaleString()}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-2">
|
<div className="col-span-2">
|
||||||
<span className="text-muted-foreground">Paths:</span>
|
<span className="text-muted-foreground">Paths:</span>
|
||||||
<div className="space-y-1 mt-1">
|
<div className="space-y-1 mt-1">
|
||||||
{data.snapshot.paths.map((path) => (
|
{data.snapshot.paths.map((path) => (
|
||||||
<p key={path} className="font-mono text-xs bg-muted px-2 py-1 rounded">
|
<p
|
||||||
{path}
|
key={path}
|
||||||
</p>
|
className="font-mono text-xs bg-muted px-2 py-1 rounded"
|
||||||
))}
|
>
|
||||||
</div>
|
{path}
|
||||||
</div>
|
</p>
|
||||||
</div>
|
))}
|
||||||
</CardContent>
|
</div>
|
||||||
</Card>
|
</div>
|
||||||
)}
|
</div>
|
||||||
</div>
|
</CardContent>
|
||||||
);
|
</Card>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,23 +3,23 @@ import { useNavigate, useParams, useSearchParams } from "react-router";
|
|||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import {
|
import {
|
||||||
deleteVolumeMutation,
|
deleteVolumeMutation,
|
||||||
getVolumeOptions,
|
getVolumeOptions,
|
||||||
getSystemInfoOptions,
|
getSystemInfoOptions,
|
||||||
mountVolumeMutation,
|
mountVolumeMutation,
|
||||||
unmountVolumeMutation,
|
unmountVolumeMutation,
|
||||||
} from "~/api-client/@tanstack/react-query.gen";
|
} from "~/api-client/@tanstack/react-query.gen";
|
||||||
import { StatusDot } from "~/components/status-dot";
|
import { StatusDot } from "~/components/status-dot";
|
||||||
import { Button } from "~/components/ui/button";
|
import { Button } from "~/components/ui/button";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs";
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
AlertDialogAction,
|
AlertDialogAction,
|
||||||
AlertDialogCancel,
|
AlertDialogCancel,
|
||||||
AlertDialogContent,
|
AlertDialogContent,
|
||||||
AlertDialogDescription,
|
AlertDialogDescription,
|
||||||
AlertDialogHeader,
|
AlertDialogHeader,
|
||||||
AlertDialogTitle,
|
AlertDialogTitle,
|
||||||
} from "~/components/ui/alert-dialog";
|
} from "~/components/ui/alert-dialog";
|
||||||
import { VolumeIcon } from "~/components/volume-icon";
|
import { VolumeIcon } from "~/components/volume-icon";
|
||||||
import { parseError } from "~/lib/errors";
|
import { parseError } from "~/lib/errors";
|
||||||
@@ -31,161 +31,169 @@ import { FilesTabContent } from "../tabs/files";
|
|||||||
import { DockerTabContent } from "../tabs/docker";
|
import { DockerTabContent } from "../tabs/docker";
|
||||||
|
|
||||||
export function meta({ params }: Route.MetaArgs) {
|
export function meta({ params }: Route.MetaArgs) {
|
||||||
return [
|
return [
|
||||||
{ title: params.name },
|
{ title: params.name },
|
||||||
{
|
{
|
||||||
name: "description",
|
name: "description",
|
||||||
content: "View and manage volume details, configuration, and files.",
|
content: "View and manage volume details, configuration, and files.",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const clientLoader = async ({ params }: Route.ClientLoaderArgs) => {
|
export const clientLoader = async ({ params }: Route.ClientLoaderArgs) => {
|
||||||
const volume = await getVolume({ path: { name: params.name ?? "" } });
|
const volume = await getVolume({ path: { name: params.name ?? "" } });
|
||||||
if (volume.data) return volume.data;
|
if (volume.data) return volume.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function VolumeDetails({ loaderData }: Route.ComponentProps) {
|
export default function VolumeDetails({ loaderData }: Route.ComponentProps) {
|
||||||
const { name } = useParams<{ name: string }>();
|
const { name } = useParams<{ name: string }>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const activeTab = searchParams.get("tab") || "info";
|
const activeTab = searchParams.get("tab") || "info";
|
||||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||||
|
|
||||||
const { data } = useQuery({
|
const { data } = useQuery({
|
||||||
...getVolumeOptions({ path: { name: name ?? "" } }),
|
...getVolumeOptions({ path: { name: name ?? "" } }),
|
||||||
initialData: loaderData,
|
initialData: loaderData,
|
||||||
refetchInterval: 10000,
|
refetchInterval: 10000,
|
||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data: systemInfo } = useQuery({
|
const { data: systemInfo } = useQuery({
|
||||||
...getSystemInfoOptions(),
|
...getSystemInfoOptions(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const deleteVol = useMutation({
|
const deleteVol = useMutation({
|
||||||
...deleteVolumeMutation(),
|
...deleteVolumeMutation(),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success("Volume deleted successfully");
|
toast.success("Volume deleted successfully");
|
||||||
navigate("/volumes");
|
navigate("/volumes");
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
toast.error("Failed to delete volume", {
|
toast.error("Failed to delete volume", {
|
||||||
description: parseError(error)?.message,
|
description: parseError(error)?.message,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const mountVol = useMutation({
|
const mountVol = useMutation({
|
||||||
...mountVolumeMutation(),
|
...mountVolumeMutation(),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success("Volume mounted successfully");
|
toast.success("Volume mounted successfully");
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
toast.error("Failed to mount volume", {
|
toast.error("Failed to mount volume", {
|
||||||
description: parseError(error)?.message,
|
description: parseError(error)?.message,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const unmountVol = useMutation({
|
const unmountVol = useMutation({
|
||||||
...unmountVolumeMutation(),
|
...unmountVolumeMutation(),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success("Volume unmounted successfully");
|
toast.success("Volume unmounted successfully");
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
toast.error("Failed to unmount volume", {
|
toast.error("Failed to unmount volume", {
|
||||||
description: parseError(error)?.message,
|
description: parseError(error)?.message,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleConfirmDelete = () => {
|
const handleConfirmDelete = () => {
|
||||||
setShowDeleteConfirm(false);
|
setShowDeleteConfirm(false);
|
||||||
deleteVol.mutate({ path: { name: name ?? "" } });
|
deleteVol.mutate({ path: { name: name ?? "" } });
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return <div>Volume not found</div>;
|
return <div>Volume not found</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return <div>Loading...</div>;
|
return <div>Loading...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { volume, statfs } = data;
|
const { volume, statfs } = data;
|
||||||
const dockerAvailable = systemInfo?.capabilities?.docker ?? false;
|
const dockerAvailable = systemInfo?.capabilities?.docker ?? false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex flex-col items-start xs:items-center xs:flex-row xs:justify-between">
|
||||||
<div>
|
<div className="text-sm font-semibold mb-2 xs:mb-0 text-muted-foreground flex items-center gap-2">
|
||||||
<div className="text-sm font-semibold mb-2 text-muted-foreground flex items-center gap-2">
|
<span className="flex items-center gap-2">
|
||||||
<span className="flex items-center gap-2">
|
<StatusDot status={volume.status} />{" "}
|
||||||
<StatusDot status={volume.status} /> {volume.status[0].toUpperCase() + volume.status.slice(1)}
|
{volume.status[0].toUpperCase() + volume.status.slice(1)}
|
||||||
</span>
|
</span>
|
||||||
<VolumeIcon size={14} backend={volume?.config.backend} />
|
<VolumeIcon size={14} backend={volume?.config.backend} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className="flex gap-4">
|
||||||
<div className="flex gap-4">
|
<Button
|
||||||
<Button
|
onClick={() => mountVol.mutate({ path: { name } })}
|
||||||
onClick={() => mountVol.mutate({ path: { name } })}
|
loading={mountVol.isPending}
|
||||||
loading={mountVol.isPending}
|
className={cn({ hidden: volume.status === "mounted" })}
|
||||||
className={cn({ hidden: volume.status === "mounted" })}
|
>
|
||||||
>
|
Mount
|
||||||
Mount
|
</Button>
|
||||||
</Button>
|
<Button
|
||||||
<Button
|
variant="secondary"
|
||||||
variant="secondary"
|
onClick={() => unmountVol.mutate({ path: { name } })}
|
||||||
onClick={() => unmountVol.mutate({ path: { name } })}
|
loading={unmountVol.isPending}
|
||||||
loading={unmountVol.isPending}
|
className={cn({ hidden: volume.status !== "mounted" })}
|
||||||
className={cn({ hidden: volume.status !== "mounted" })}
|
>
|
||||||
>
|
Unmount
|
||||||
Unmount
|
</Button>
|
||||||
</Button>
|
<Button
|
||||||
<Button variant="destructive" onClick={() => setShowDeleteConfirm(true)} disabled={deleteVol.isPending}>
|
variant="destructive"
|
||||||
Delete
|
onClick={() => setShowDeleteConfirm(true)}
|
||||||
</Button>
|
disabled={deleteVol.isPending}
|
||||||
</div>
|
>
|
||||||
</div>
|
Delete
|
||||||
<Tabs value={activeTab} onValueChange={(value) => setSearchParams({ tab: value })} className="mt-4">
|
</Button>
|
||||||
<TabsList className="mb-2">
|
</div>
|
||||||
<TabsTrigger value="info">Configuration</TabsTrigger>
|
</div>
|
||||||
<TabsTrigger value="files">Files</TabsTrigger>
|
<Tabs
|
||||||
{dockerAvailable && <TabsTrigger value="docker">Docker</TabsTrigger>}
|
value={activeTab}
|
||||||
</TabsList>
|
onValueChange={(value) => setSearchParams({ tab: value })}
|
||||||
<TabsContent value="info">
|
className="mt-4"
|
||||||
<VolumeInfoTabContent volume={volume} statfs={statfs} />
|
>
|
||||||
</TabsContent>
|
<TabsList className="mb-2">
|
||||||
<TabsContent value="files">
|
<TabsTrigger value="info">Configuration</TabsTrigger>
|
||||||
<FilesTabContent volume={volume} />
|
<TabsTrigger value="files">Files</TabsTrigger>
|
||||||
</TabsContent>
|
{dockerAvailable && <TabsTrigger value="docker">Docker</TabsTrigger>}
|
||||||
{dockerAvailable && (
|
</TabsList>
|
||||||
<TabsContent value="docker">
|
<TabsContent value="info">
|
||||||
<DockerTabContent volume={volume} />
|
<VolumeInfoTabContent volume={volume} statfs={statfs} />
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
)}
|
<TabsContent value="files">
|
||||||
</Tabs>
|
<FilesTabContent volume={volume} />
|
||||||
|
</TabsContent>
|
||||||
|
{dockerAvailable && (
|
||||||
|
<TabsContent value="docker">
|
||||||
|
<DockerTabContent volume={volume} />
|
||||||
|
</TabsContent>
|
||||||
|
)}
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
<AlertDialog open={showDeleteConfirm} onOpenChange={setShowDeleteConfirm}>
|
<AlertDialog open={showDeleteConfirm} onOpenChange={setShowDeleteConfirm}>
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>Delete volume?</AlertDialogTitle>
|
<AlertDialogTitle>Delete volume?</AlertDialogTitle>
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
Are you sure you want to delete the volume <strong>{name}</strong>? This action cannot be undone.
|
Are you sure you want to delete the volume <strong>{name}</strong>
|
||||||
</AlertDialogDescription>
|
? This action cannot be undone.
|
||||||
</AlertDialogHeader>
|
</AlertDialogDescription>
|
||||||
<div className="flex gap-3 justify-end">
|
</AlertDialogHeader>
|
||||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
<div className="flex gap-3 justify-end">
|
||||||
<AlertDialogAction
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||||
onClick={handleConfirmDelete}
|
<AlertDialogAction
|
||||||
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
onClick={handleConfirmDelete}
|
||||||
>
|
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
||||||
Delete volume
|
>
|
||||||
</AlertDialogAction>
|
Delete volume
|
||||||
</div>
|
</AlertDialogAction>
|
||||||
</AlertDialogContent>
|
</div>
|
||||||
</AlertDialog>
|
</AlertDialogContent>
|
||||||
</>
|
</AlertDialog>
|
||||||
);
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
import { MutationCache, QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
import {
|
||||||
import { isRouteErrorResponse, Links, Meta, Outlet, Scripts, ScrollRestoration } from "react-router";
|
MutationCache,
|
||||||
|
QueryClient,
|
||||||
|
QueryClientProvider,
|
||||||
|
} from "@tanstack/react-query";
|
||||||
|
import {
|
||||||
|
isRouteErrorResponse,
|
||||||
|
Links,
|
||||||
|
Meta,
|
||||||
|
Outlet,
|
||||||
|
Scripts,
|
||||||
|
ScrollRestoration,
|
||||||
|
} from "react-router";
|
||||||
import { Toaster } from "~/components/ui/sonner";
|
import { Toaster } from "~/components/ui/sonner";
|
||||||
|
|
||||||
import type { Route } from "./+types/root";
|
import type { Route } from "./+types/root";
|
||||||
@@ -8,89 +19,108 @@ import { client } from "./api-client/client.gen";
|
|||||||
import { useServerEvents } from "./hooks/use-server-events";
|
import { useServerEvents } from "./hooks/use-server-events";
|
||||||
|
|
||||||
client.setConfig({
|
client.setConfig({
|
||||||
baseUrl: "/",
|
baseUrl: "/",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const links: Route.LinksFunction = () => [
|
export const links: Route.LinksFunction = () => [
|
||||||
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
|
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
|
||||||
{
|
{
|
||||||
rel: "preconnect",
|
rel: "preconnect",
|
||||||
href: "https://fonts.gstatic.com",
|
href: "https://fonts.gstatic.com",
|
||||||
crossOrigin: "anonymous",
|
crossOrigin: "anonymous",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rel: "stylesheet",
|
rel: "stylesheet",
|
||||||
href: "https://fonts.googleapis.com/css2?family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&display=swap",
|
href: "https://fonts.googleapis.com/css2?family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&display=swap",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const queryClient = new QueryClient({
|
const queryClient = new QueryClient({
|
||||||
mutationCache: new MutationCache({
|
mutationCache: new MutationCache({
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries();
|
queryClient.invalidateQueries();
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
console.error("Mutation error:", error);
|
console.error("Mutation error:", error);
|
||||||
queryClient.invalidateQueries();
|
queryClient.invalidateQueries();
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function Layout({ children }: { children: React.ReactNode }) {
|
export function Layout({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<html lang="en" style={{ colorScheme: "dark" }} className="dark">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charSet="utf-8" />
|
<meta charSet="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
<meta
|
||||||
<link rel="icon" type="image/png" href="/images/favicon/favicon-96x96.png" sizes="96x96" />
|
name="viewport"
|
||||||
<link rel="icon" type="image/svg+xml" href="/images/favicon/favicon.svg" />
|
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
|
||||||
<link rel="shortcut icon" href="/images/favicon/favicon.ico" />
|
/>
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/images/favicon/apple-touch-icon.png" />
|
<link
|
||||||
<meta name="apple-mobile-web-app-title" content="Ironmount" />
|
rel="icon"
|
||||||
<link rel="manifest" href="/images/favicon/site.webmanifest" />
|
type="image/png"
|
||||||
<Meta />
|
href="/images/favicon/favicon-96x96.png"
|
||||||
<Links />
|
sizes="96x96"
|
||||||
</head>
|
/>
|
||||||
<QueryClientProvider client={queryClient}>
|
<link
|
||||||
<body>
|
rel="icon"
|
||||||
{children}
|
type="image/svg+xml"
|
||||||
<Toaster />
|
href="/images/favicon/favicon.svg"
|
||||||
<ScrollRestoration />
|
/>
|
||||||
<Scripts />
|
<link rel="shortcut icon" href="/images/favicon/favicon.ico" />
|
||||||
</body>
|
<link
|
||||||
</QueryClientProvider>
|
rel="apple-touch-icon"
|
||||||
</html>
|
sizes="180x180"
|
||||||
);
|
href="/images/favicon/apple-touch-icon.png"
|
||||||
|
/>
|
||||||
|
<meta name="apple-mobile-web-app-title" content="Ironmount" />
|
||||||
|
<link rel="manifest" href="/images/favicon/site.webmanifest" />
|
||||||
|
<Meta />
|
||||||
|
<Links />
|
||||||
|
</head>
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
|
<body className="dark">
|
||||||
|
{children}
|
||||||
|
<Toaster />
|
||||||
|
<ScrollRestoration />
|
||||||
|
<Scripts />
|
||||||
|
</body>
|
||||||
|
</QueryClientProvider>
|
||||||
|
</html>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
useServerEvents();
|
useServerEvents();
|
||||||
|
|
||||||
return <Outlet />;
|
return <Outlet />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
||||||
let message = "Oops!";
|
let message = "Oops!";
|
||||||
let details = "An unexpected error occurred.";
|
let details = "An unexpected error occurred.";
|
||||||
let stack: string | undefined;
|
let stack: string | undefined;
|
||||||
|
|
||||||
if (isRouteErrorResponse(error)) {
|
if (isRouteErrorResponse(error)) {
|
||||||
message = error.status === 404 ? "404" : "Error";
|
message = error.status === 404 ? "404" : "Error";
|
||||||
details = error.status === 404 ? "The requested page could not be found." : error.statusText || details;
|
details =
|
||||||
} else if (import.meta.env.DEV && error && error instanceof Error) {
|
error.status === 404
|
||||||
details = error.message;
|
? "The requested page could not be found."
|
||||||
stack = error.stack;
|
: error.statusText || details;
|
||||||
}
|
} else if (import.meta.env.DEV && error && error instanceof Error) {
|
||||||
|
details = error.message;
|
||||||
|
stack = error.stack;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="pt-4 p-4 container mx-auto">
|
<main className="pt-4 p-4 container mx-auto">
|
||||||
<h1>{message}</h1>
|
<h1>{message}</h1>
|
||||||
<p>{details}</p>
|
<p>{details}</p>
|
||||||
{stack && (
|
{stack && (
|
||||||
<pre className="w-full p-4 overflow-x-auto">
|
<pre className="w-full p-4 overflow-x-auto">
|
||||||
<code>{stack}</code>
|
<code>{stack}</code>
|
||||||
</pre>
|
</pre>
|
||||||
)}
|
)}
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,27 +7,28 @@ const alias = {};
|
|||||||
|
|
||||||
const { NODE_ENV } = process.env;
|
const { NODE_ENV } = process.env;
|
||||||
if (NODE_ENV === "production") {
|
if (NODE_ENV === "production") {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
alias["react-dom/server"] = "react-dom/server.node";
|
alias["react-dom/server"] = "react-dom/server.node";
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [tailwindcss(), reactRouter(), tsconfigPaths()],
|
plugins: [tailwindcss(), reactRouter(), tsconfigPaths()],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias,
|
alias,
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
outDir: "dist",
|
outDir: "dist",
|
||||||
// sourcemap: true,
|
// sourcemap: true,
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: true,
|
host: true,
|
||||||
port: 4097,
|
port: 4097,
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: "http://localhost:4096",
|
target: "http://localhost:4096",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
allowedHosts: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user