mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
Redesign the admin UI
Replaces the single-page dashboard with a structured app shell: sidebar on desktop, bottom tab bar on mobile (PWA), and separate screens for overview, short links, link pages, API tokens and administration. - detail view with tabs: content, appearance, analytics, QR code, settings - small component kit (buttons, form controls, cards, dialogs, toasts, tabs) built on semantic color tokens with light and dark mode following the system - native <dialog> modals for creating pages, editing blocks and confirmations instead of window.confirm - theme presets and a live preview of unsaved appearance changes - removed the v1 screenshots for now Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { AlertTriangle, Info } from "lucide-react";
|
||||
import { cx } from "../../lib/cx.js";
|
||||
|
||||
export function Card({ children, className }: { children: ReactNode; className?: string }) {
|
||||
return <section className={cx("rounded-xl border border-border bg-surface shadow-xs", className)}>{children}</section>;
|
||||
}
|
||||
|
||||
export function CardHeader({ title, description, actions }: { title: ReactNode; description?: ReactNode; actions?: ReactNode }) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-start justify-between gap-3 border-border px-5 py-4 not-last:border-b">
|
||||
<div className="min-w-0">
|
||||
<h2 className="text-base font-semibold text-fg">{title}</h2>
|
||||
{description && <p className="mt-0.5 text-sm text-muted">{description}</p>}
|
||||
</div>
|
||||
{actions && <div className="flex items-center gap-2">{actions}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CardBody({ children, className }: { children: ReactNode; className?: string }) {
|
||||
return <div className={cx("p-5", className)}>{children}</div>;
|
||||
}
|
||||
|
||||
export function CardFooter({ children, className }: { children: ReactNode; className?: string }) {
|
||||
return (
|
||||
<div className={cx("flex items-center justify-end gap-2 rounded-b-xl border-t border-border bg-surface-2/50 px-5 py-3", className)}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
type Tone = "neutral" | "accent" | "warning" | "danger" | "success";
|
||||
|
||||
const badgeTones: Record<Tone, string> = {
|
||||
neutral: "bg-surface-2 text-muted",
|
||||
accent: "bg-accent-soft text-accent-soft-fg",
|
||||
warning: "bg-warning-soft text-warning-soft-fg",
|
||||
danger: "bg-danger-soft text-danger-soft-fg",
|
||||
success: "bg-success/10 text-success",
|
||||
};
|
||||
|
||||
export function Badge({ tone = "neutral", children, icon }: { tone?: Tone; children: ReactNode; icon?: ReactNode }) {
|
||||
return (
|
||||
<span
|
||||
className={cx(
|
||||
"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap [&_svg]:size-3",
|
||||
badgeTones[tone],
|
||||
)}
|
||||
>
|
||||
{icon}
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export function Alert({ tone = "warning", title, children }: { tone?: "warning" | "info"; title: string; children?: ReactNode }) {
|
||||
const Icon = tone === "warning" ? AlertTriangle : Info;
|
||||
return (
|
||||
<div
|
||||
className={cx(
|
||||
"flex gap-3 rounded-xl border px-4 py-3 text-sm",
|
||||
tone === "warning" ? "border-warning-soft-fg/20 bg-warning-soft text-warning-soft-fg" : "border-accent/20 bg-accent-soft text-accent-soft-fg",
|
||||
)}
|
||||
>
|
||||
<Icon className="mt-0.5 size-4 shrink-0" />
|
||||
<div>
|
||||
<p className="font-medium">{title}</p>
|
||||
{children && <div className="mt-1 opacity-90">{children}</div>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function EmptyState({ icon, title, description, action }: { icon: ReactNode; title: string; description?: string; action?: ReactNode }) {
|
||||
return (
|
||||
<div className="flex flex-col items-center px-6 py-14 text-center">
|
||||
<div className="mb-4 flex size-12 items-center justify-center rounded-xl bg-accent-soft text-accent-soft-fg [&_svg]:size-6">{icon}</div>
|
||||
<h3 className="font-semibold text-fg">{title}</h3>
|
||||
{description && <p className="mt-1 max-w-sm text-sm text-muted">{description}</p>}
|
||||
{action && <div className="mt-5">{action}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Skeleton({ className }: { className?: string }) {
|
||||
return <div className={cx("animate-pulse rounded-md bg-surface-2", className)} />;
|
||||
}
|
||||
|
||||
export function PageHeader({
|
||||
title,
|
||||
description,
|
||||
actions,
|
||||
breadcrumb,
|
||||
}: {
|
||||
title: ReactNode;
|
||||
description?: ReactNode;
|
||||
actions?: ReactNode;
|
||||
breadcrumb?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<header className="mb-6 flex flex-wrap items-end justify-between gap-4 lg:mb-8">
|
||||
<div className="min-w-0">
|
||||
{breadcrumb && <div className="mb-2 text-sm text-muted">{breadcrumb}</div>}
|
||||
<h1 className="text-2xl font-semibold tracking-tight text-fg">{title}</h1>
|
||||
{description && <p className="mt-1 text-sm text-muted">{description}</p>}
|
||||
</div>
|
||||
{actions && <div className="flex flex-wrap items-center gap-2">{actions}</div>}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user