Refine root UI around shadcn primitives
CI / quality (push) Waiting to run

This commit is contained in:
MOH
2026-03-07 22:28:52 +01:00
parent 985fbe1745
commit a18370d003
36 changed files with 1344 additions and 597 deletions
+95 -76
View File
@@ -3,7 +3,7 @@
/* eslint-disable @next/next/no-img-element */
import { MediaKind } from "@prisma/client";
import { ImageIcon, Search, Type } from "lucide-react";
import { FileText, ImageIcon, Search, Type } from "lucide-react";
import { useState } from "react";
import { MediaFieldPicker, type MediaFieldState } from "@/components/root/media-field-picker";
@@ -179,95 +179,114 @@ export function SiteSettingsForm({
</CardHeader>
<CardContent className="grid gap-4 lg:grid-cols-3">
{localeFields.map((locale) => (
<div key={locale.key} className="space-y-4 rounded-surface border border-border bg-surface-1 p-4">
<div key={locale.key} className="space-y-4 rounded-lg border bg-card p-4 shadow-sm">
<div>
<p className="text-sm font-medium text-foreground">{locale.label}</p>
<p className="mt-1 text-xs text-muted-foreground">Globale Standardwerte fuer diese Sprache.</p>
</div>
<div className="space-y-2">
<Label htmlFor={`siteName${locale.suffix}`}>Site Name</Label>
<Input
id={`siteName${locale.suffix}`}
name={`siteName${locale.suffix}`}
value={settings.locales[locale.key].siteName}
onChange={(event) =>
setSettings((current) => ({
...current,
locales: {
...current.locales,
[locale.key]: {
...current.locales[locale.key],
siteName: event.target.value,
<Label htmlFor={`siteName${locale.suffix}`} className="sr-only">Site Name</Label>
<div className="relative">
<Type className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
id={`siteName${locale.suffix}`}
name={`siteName${locale.suffix}`}
value={settings.locales[locale.key].siteName}
onChange={(event) =>
setSettings((current) => ({
...current,
locales: {
...current.locales,
[locale.key]: {
...current.locales[locale.key],
siteName: event.target.value,
},
},
},
}))
}
/>
}))
}
placeholder="Site Name"
className="pl-9"
/>
</div>
</div>
<div className="space-y-2">
<Label htmlFor={`titleTemplate${locale.suffix}`}>Title Template</Label>
<Input
id={`titleTemplate${locale.suffix}`}
name={`titleTemplate${locale.suffix}`}
value={settings.locales[locale.key].titleTemplate}
onChange={(event) =>
setSettings((current) => ({
...current,
locales: {
...current.locales,
[locale.key]: {
...current.locales[locale.key],
titleTemplate: event.target.value,
<Label htmlFor={`titleTemplate${locale.suffix}`} className="sr-only">Title Template</Label>
<div className="relative">
<Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
id={`titleTemplate${locale.suffix}`}
name={`titleTemplate${locale.suffix}`}
value={settings.locales[locale.key].titleTemplate}
onChange={(event) =>
setSettings((current) => ({
...current,
locales: {
...current.locales,
[locale.key]: {
...current.locales[locale.key],
titleTemplate: event.target.value,
},
},
},
}))
}
placeholder="{pageTitle} | {siteName}"
/>
}))
}
placeholder="Title Template"
className="pl-9"
/>
</div>
</div>
<div className="space-y-2">
<Label htmlFor={`siteDescription${locale.suffix}`}>Site Description</Label>
<Input
id={`siteDescription${locale.suffix}`}
name={`siteDescription${locale.suffix}`}
value={settings.locales[locale.key].siteDescription}
onChange={(event) =>
setSettings((current) => ({
...current,
locales: {
...current.locales,
[locale.key]: {
...current.locales[locale.key],
siteDescription: event.target.value,
<Label htmlFor={`siteDescription${locale.suffix}`} className="sr-only">Site Description</Label>
<div className="relative">
<FileText className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
id={`siteDescription${locale.suffix}`}
name={`siteDescription${locale.suffix}`}
value={settings.locales[locale.key].siteDescription}
onChange={(event) =>
setSettings((current) => ({
...current,
locales: {
...current.locales,
[locale.key]: {
...current.locales[locale.key],
siteDescription: event.target.value,
},
},
},
}))
}
/>
}))
}
placeholder="Site Description"
className="pl-9"
/>
</div>
</div>
<div className="space-y-2">
<Label htmlFor={`subhead${locale.suffix}`}>Subhead</Label>
<Input
id={`subhead${locale.suffix}`}
name={`subhead${locale.suffix}`}
value={settings.locales[locale.key].subhead}
onChange={(event) =>
setSettings((current) => ({
...current,
locales: {
...current.locales,
[locale.key]: {
...current.locales[locale.key],
subhead: event.target.value,
<Label htmlFor={`subhead${locale.suffix}`} className="sr-only">Subhead</Label>
<div className="relative">
<Type className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
id={`subhead${locale.suffix}`}
name={`subhead${locale.suffix}`}
value={settings.locales[locale.key].subhead}
onChange={(event) =>
setSettings((current) => ({
...current,
locales: {
...current.locales,
[locale.key]: {
...current.locales[locale.key],
subhead: event.target.value,
},
},
},
}))
}
/>
}))
}
placeholder="Subhead"
className="pl-9"
/>
</div>
</div>
</div>
))}
@@ -344,7 +363,7 @@ export function SiteSettingsForm({
: `${locale.sampleTitle} | ${localeSettings.siteName}`;
return (
<div key={locale.key} className="rounded-nested border border-border bg-background p-3">
<div key={locale.key} className="rounded-md border bg-card p-3">
<p className="font-medium text-foreground">{locale.label}</p>
<p className="mt-2 text-xs text-muted-foreground">
Example page title: {locale.sampleTitle}
@@ -365,12 +384,12 @@ export function SiteSettingsForm({
<Search className="h-4 w-4 text-brand-primary" />
Search Preview
</div>
<div className="rounded-nested border border-border bg-background p-4">
<div className="rounded-md border bg-card p-4">
<div className="flex items-center gap-3">
{faviconPreviewUrl ? (
<img src={faviconPreviewUrl} alt="Favicon" className="h-5 w-5 rounded-sm" />
) : (
<div className="flex h-5 w-5 items-center justify-center rounded-sm border border-border bg-surface-1">
<div className="flex h-5 w-5 items-center justify-center rounded-sm border bg-muted/40">
<Type className="h-3.5 w-3.5 text-muted-foreground" />
</div>
)}
@@ -394,11 +413,11 @@ export function SiteSettingsForm({
<ImageIcon className="h-4 w-4 text-brand-secondary" />
Social Preview
</div>
<div className="overflow-hidden rounded-nested border border-border bg-background">
<div className="overflow-hidden rounded-md border bg-card">
{defaultOgImagePreviewUrl ? (
<img src={defaultOgImagePreviewUrl} alt="Default OG" className="h-32 w-full object-cover" />
) : (
<div className="flex h-32 items-center justify-center bg-surface-1 text-sm text-muted-foreground">
<div className="flex h-32 items-center justify-center bg-muted/40 text-sm text-muted-foreground">
No OG image selected
</div>
)}