Oberfläche: Kontraste nach WCAG, SVG-Icons statt Emojis

- Hellmodus: Status-/Hinweisfarben (ok/info/warn/err) und Akzent auf >= 4,5:1
  angehoben, aktiver Eintrag der mobilen Navigation nutzt den Akzent statt Türkis
- Eingabefelder und Textbereiche mit Rand >= 3:1 (--border-strong), Textbereiche
  einheitlich gestylt
- Icon-Komponente (Lucide-Pfade) ersetzt Emojis im Darstellungsumschalter,
  Kundenansicht-Banner und bei Ticket-Anhängen; mobile Navigation mit Icons
- Kundenansicht-Banner über Tokens statt fester Farben; Bildanhänge lazy laden

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kundencenter 2026-10-05 13:39:10 +02:00
parent 9d2232308c
commit e0f2141901
5 changed files with 44 additions and 21 deletions

View file

@ -6,6 +6,7 @@ import { api } from '@/lib/api';
import { useSession } from '@/lib/session';
import { ROLE_LABEL } from '@/components/ui';
import { ThemeToggle } from '@/components/ThemeToggle';
import { Icon, type IconName } from '@/components/Icon';
export default function AppLayout({ children }: { children: ReactNode }) {
const { me, loading, can, reload } = useSession(); const r = useRouter(); const path = usePathname(); const [open, setOpen] = useState(false);
@ -45,11 +46,11 @@ export default function AppLayout({ children }: { children: ReactNode }) {
<button className="btn small" onClick={logout}>Abmelden</button>
</nav>
);
const bottomLink = (href: string, label: string) => <Link href={href} aria-current={path === href || path.startsWith(href + '/') ? 'page' : undefined}>{label}</Link>;
const bottomLink = (href: string, label: string, icon: IconName) => <Link href={href} aria-current={path === href || path.startsWith(href + '/') ? 'page' : undefined}><Icon name={icon} className="ic" />{label}</Link>;
return (<>
{me.impersonating && (
<div role="status" style={{ position: 'sticky', top: 0, zIndex: 100, width: '100%', background: 'var(--warn)', color: '#1a1200', padding: '8px 16px', display: 'flex', flexWrap: 'wrap', gap: 8, alignItems: 'center', justifyContent: 'center', textAlign: 'center' }}>
<span>👁 Ansicht als Kunde: <strong>{me.impersonating.orgName}</strong> ({me.impersonating.customerNumber}) · Grund: {me.impersonating.reason}</span>
<div role="status" className="impersonate">
<span><Icon name="eye" /> Ansicht als Kunde: <strong>{me.impersonating.orgName}</strong> ({me.impersonating.customerNumber}) · Grund: {me.impersonating.reason}</span>
<button className="btn small" onClick={() => void stopImpersonation()}>Zurück zur Verwaltung</button>
</div>
)}
@ -57,11 +58,11 @@ export default function AppLayout({ children }: { children: ReactNode }) {
<div className="topbar"><strong>Kundencenter</strong><ThemeToggle compact /></div>
{nav}<main id="main" className="main">{trial && path !== '/einstellungen/lizenz' && <div className="alert warn" role="status" style={{ marginBottom: 16 }}>{trial} <Link href="/einstellungen/lizenz">Lizenz hinterlegen</Link></div>}{children}</main>
{!enrollNeeded && <nav className="bottomnav" aria-label="Hauptnavigation (mobil)">
{bottomLink('/dashboard', 'Übersicht')}
{(me.kind === 'customer' || can('resources.read')) && bottomLink('/ressourcen', 'Ressourcen')}
{(me.kind === 'customer' || can('tickets.read')) && bottomLink('/tickets', 'Tickets')}
{(me.kind === 'customer' || can('invoices.read')) && bottomLink('/rechnungen', 'Rechnungen')}
<button type="button" aria-expanded={open} onClick={() => setOpen(!open)}>Mehr</button>
{bottomLink('/dashboard', 'Übersicht', 'home')}
{(me.kind === 'customer' || can('resources.read')) && bottomLink('/ressourcen', 'Ressourcen', 'server')}
{(me.kind === 'customer' || can('tickets.read')) && bottomLink('/tickets', 'Tickets', 'ticket')}
{(me.kind === 'customer' || can('invoices.read')) && bottomLink('/rechnungen', 'Rechnungen', 'receipt')}
<button type="button" aria-expanded={open} onClick={() => setOpen(!open)}><Icon name="menu" className="ic" />Mehr</button>
</nav>}
</div>
</>);

View file

@ -5,6 +5,7 @@ import Link from 'next/link';
import { api, apiUpload, errMsg } from '@/lib/api';
import { useSession } from '@/lib/session';
import { Alert, Field, TicketStatusBadge, TICKET_PRIORITY, fmt } from '@/components/ui';
import { Icon } from '@/components/Icon';
const MAX_FILES = 5;
const ALLOWED = 'image/png,image/jpeg,image/gif,image/webp,application/pdf';
@ -14,8 +15,8 @@ function AttachmentList({ ticketId, atts }: { ticketId: string; atts: Attachment
return (<div className="row" style={{ marginTop: 8, flexWrap: 'wrap', gap: 8 }}>
{atts.map((a) => { const href = `/api/tickets/${ticketId}/attachments/${a.id}`; const kb = Math.max(1, Math.round(a.sizeBytes / 1024));
return a.contentType.startsWith('image/')
? <a key={a.id} href={href} target="_blank" rel="noreferrer" title={`${a.filename} (${kb} KB)`}><img src={href} alt={a.filename} style={{ maxWidth: 160, maxHeight: 120, borderRadius: 6, border: '1px solid var(--border)', display: 'block' }} /></a>
: <a key={a.id} className="btn small" href={href} target="_blank" rel="noreferrer">📄 {a.filename} <span className="muted small">({kb} KB)</span></a>; })}
? <a key={a.id} href={href} target="_blank" rel="noreferrer" title={`${a.filename} (${kb} KB)`}><img src={href} alt={a.filename} loading="lazy" decoding="async" style={{ maxWidth: 160, maxHeight: 120, borderRadius: 6, border: '1px solid var(--border)', display: 'block' }} /></a>
: <a key={a.id} className="btn small" href={href} target="_blank" rel="noreferrer"><Icon name="file" /> {a.filename} <span className="muted small">({kb} KB)</span></a>; })}
</div>);
}
interface Msg { id: string; authorId: string; authorName: string; authorKind: 'customer' | 'staff'; body: string; internalNote: boolean; createdAt: string; attachments: Attachment[] }

View file

@ -3,8 +3,8 @@
über prefers-color-scheme, zusätzlich manuell über [data-theme] umschaltbar (siehe ThemeToggle). */
:root {
--bg: #f4f6fa; --surface: #ffffff; --surface-2: #eef1f6; --border: #e3e8f0; --text: #172033; --muted: #5b6472;
--accent: #3b6fd8; --accent2: #14b8a6; --accent-contrast: #ffffff; --focus: #3b6fd8;
--ok: #22a06b; --ok-bg: #e4f5ec; --info: #2e6fe0; --info-bg: #e7f1fc; --warn: #e59a17; --warn-bg: #fdf1dc; --err: #dc4c64; --err-bg: #fbe7ea; --lock: #4b5563; --lock-bg: #eceef2;
--accent: #2f62c9; --accent2: #0f766e; --accent-contrast: #ffffff; --focus: #2f62c9; --border-strong: #7a8599;
--ok: #17784c; --ok-bg: #e4f5ec; --info: #2257c4; --info-bg: #e7f1fc; --warn: #8a5300; --warn-bg: #fdf1dc; --err: #b52f47; --err-bg: #fbe7ea; --lock: #4b5563; --lock-bg: #eceef2;
--nav-bg: #173568; --nav-text: #dbe4f7; --nav-muted: #8fa4d4; --nav-border: #24417f; --nav-hover: #1f4084; --nav-active-bg: #2a4d93; --nav-active-text: #ffffff;
--shadow-sm: 0 1px 2px rgba(23, 32, 51, .04), 0 1px 1px rgba(23, 32, 51, .04);
--shadow-md: 0 8px 20px rgba(23, 32, 51, .06), 0 2px 6px rgba(23, 32, 51, .04);
@ -12,13 +12,13 @@
--font: var(--font-inter), system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) {
--bg: #0d1117; --surface: #161b22; --surface-2: #1c2129; --border: #262c36; --text: #e6edf3; --muted: #8b98a5; --accent: #6e8dff; --accent2: #2dd4bf; --accent-contrast: #0d1117; --focus: #6e8dff;
--bg: #0d1117; --surface: #161b22; --surface-2: #1c2129; --border: #262c36; --text: #e6edf3; --muted: #8b98a5; --accent: #6e8dff; --accent2: #2dd4bf; --accent-contrast: #0d1117; --focus: #6e8dff; --border-strong: #5f6b7c;
--ok: #34d399; --ok-bg: #10281d; --info: #8ab4f8; --info-bg: #16283d; --warn: #f5b84d; --warn-bg: #3a2b0c; --err: #f1798d; --err-bg: #3b1620; --lock: #b7c0cc; --lock-bg: #232932;
--nav-bg: #0a1220; --nav-text: #cdd9f0; --nav-muted: #7c8bb0; --nav-border: #1c2740; --nav-hover: #131f36; --nav-active-bg: #1d3358; --nav-active-text: #ffffff;
--shadow-sm: 0 1px 2px rgba(0, 0, 0, .45); --shadow-md: 0 10px 24px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
} }
:root[data-theme='dark'] {
--bg: #0d1117; --surface: #161b22; --surface-2: #1c2129; --border: #262c36; --text: #e6edf3; --muted: #8b98a5; --accent: #6e8dff; --accent2: #2dd4bf; --accent-contrast: #0d1117; --focus: #6e8dff;
--bg: #0d1117; --surface: #161b22; --surface-2: #1c2129; --border: #262c36; --text: #e6edf3; --muted: #8b98a5; --accent: #6e8dff; --accent2: #2dd4bf; --accent-contrast: #0d1117; --focus: #6e8dff; --border-strong: #5f6b7c;
--ok: #34d399; --ok-bg: #10281d; --info: #8ab4f8; --info-bg: #16283d; --warn: #f5b84d; --warn-bg: #3a2b0c; --err: #f1798d; --err-bg: #3b1620; --lock: #b7c0cc; --lock-bg: #232932;
--nav-bg: #0a1220; --nav-text: #cdd9f0; --nav-muted: #7c8bb0; --nav-border: #1c2740; --nav-hover: #131f36; --nav-active-bg: #1d3358; --nav-active-text: #ffffff;
--shadow-sm: 0 1px 2px rgba(0, 0, 0, .45); --shadow-md: 0 10px 24px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
@ -26,7 +26,7 @@
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; font: 16px/1.55 var(--font); background: var(--bg); color: var(--text); }
body, .btn, .badge, .card, input, select, a, .alert { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
body, .btn, .badge, .card, input, select, textarea, a, .alert { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
h1 { font-size: 1.7rem; font-weight: 700; margin: 0 0 var(--s3); letter-spacing: -0.015em; } h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 var(--s3); } h3 { font-size: 1rem; font-weight: 600; margin: 0 0 var(--s2); }
a { color: var(--accent); } p { margin: 0 0 var(--s3); } .muted { color: var(--muted); } .small { font-size: .9rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
@ -56,8 +56,8 @@ a { color: var(--accent); } p { margin: 0 0 var(--s3); } .muted { color: var(--m
.main { padding: var(--s4) var(--s3) calc(var(--s4) + 56px); }
.bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--border); box-shadow: var(--shadow-md); padding-bottom: env(safe-area-inset-bottom, 0); }
.bottomnav a, .bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 10px; font-size: .72rem; color: var(--muted); text-decoration: none; background: none; border: none; font: inherit; min-height: 56px; }
.bottomnav .ic { font-size: 1.15rem; line-height: 1; }
.bottomnav a[aria-current='page'] { color: var(--accent2); font-weight: 600; }
.bottomnav .ic { width: 22px; height: 22px; }
.bottomnav a[aria-current='page'] { color: var(--accent); font-weight: 600; }
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s4); box-shadow: var(--shadow-sm); }
.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
@ -69,8 +69,8 @@ a { color: var(--accent); } p { margin: 0 0 var(--s3); } .muted { color: var(--m
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: var(--err); } .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; } .btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.field { display: grid; gap: 6px; margin-bottom: var(--s3); } .field label { font-weight: 600; font-size: .9rem; }
input, select { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 44px; width: 100%; }
input:focus-visible, select:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); outline: none; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 44px; width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); outline: none; }
.cols { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 12px var(--s3); border-bottom: 1px solid var(--border); vertical-align: top; } th { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
@ -88,5 +88,7 @@ tbody tr:hover { background: var(--surface-2); }
.productcard .id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; color: var(--muted); }
.center { min-height: 100vh; display: grid; place-items: center; padding: var(--s3); } .auth { width: 100%; max-width: 420px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; word-break: break-all; } .codes { columns: 2; background: var(--surface-2); padding: var(--s3); border-radius: var(--radius-sm); }
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }
.impersonate { position: sticky; top: 0; z-index: 100; width: 100%; background: var(--warn-bg); color: var(--warn); border-bottom: 2px solid var(--warn); padding: 8px 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

View file

@ -0,0 +1,18 @@
/** Einheitliche Strich-Icons (Pfade aus Lucide, ISC-Lizenz) statt Emojis. Immer dekorativ: Bedeutung trägt der Text daneben. */
const PATHS = {
home: <><path d="M3 10.5 12 3l9 7.5" /><path d="M5 9.5V21h14V9.5" /><path d="M10 21v-6h4v6" /></>,
server: <><rect x="3" y="3" width="18" height="7" rx="2" /><rect x="3" y="14" width="18" height="7" rx="2" /><path d="M7 6.5h.01M7 17.5h.01" /></>,
ticket: <><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" /></>,
receipt: <><path d="M4 2v20l3-2 3 2 2-2 2 2 3-2 3 2V2l-3 2-3-2-2 2-2-2-3 2z" /><path d="M8 8h8M8 12h8M8 16h5" /></>,
menu: <><path d="M4 6h16M4 12h16M4 18h16" /></>,
sun: <><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" /></>,
moon: <><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" /></>,
monitor: <><rect x="2" y="3" width="20" height="14" rx="2" /><path d="M8 21h8M12 17v4" /></>,
eye: <><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z" /><circle cx="12" cy="12" r="3" /></>,
file: <><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><path d="M14 2v6h6" /></>,
} as const;
export type IconName = keyof typeof PATHS;
export function Icon({ name, className = 'icon' }: { name: IconName; className?: string }) {
return <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" focusable="false">{PATHS[name]}</svg>;
}

View file

@ -1,10 +1,11 @@
'use client';
import { useEffect, useState } from 'react';
import { Icon, type IconName } from '@/components/Icon';
type Theme = 'light' | 'dark' | 'system';
const KEY = 'kc-theme';
const LABEL: Record<Theme, string> = { system: 'System', light: 'Hell', dark: 'Dunkel' };
const ICON: Record<Theme, string> = { system: '🌓', light: '☀️', dark: '🌙' };
const ICON: Record<Theme, IconName> = { system: 'monitor', light: 'sun', dark: 'moon' };
const NEXT: Record<Theme, Theme> = { system: 'light', light: 'dark', dark: 'system' };
function apply(t: Theme) {
@ -24,7 +25,7 @@ export function ThemeToggle({ compact = false }: { compact?: boolean }) {
}
return (
<button type="button" className="btn small" onClick={cycle} title={`Darstellung: ${LABEL[theme]}. Klicken zum Wechseln.`} aria-label={`Darstellung: ${LABEL[theme]}. Klicken zum Wechseln.`}>
<span aria-hidden="true">{ICON[theme]}</span>{!compact && <> {LABEL[theme]}</>}
<Icon name={ICON[theme]} />{!compact && <> {LABEL[theme]}</>}
</button>
);
}