From fb3a2ebf7380e118146518721ef59bc80e070948 Mon Sep 17 00:00:00 2001 From: Kundencenter Date: Mon, 5 Oct 2026 10:44:08 +0200 Subject: [PATCH 01/47] Allow staff to change a user's login email and name PATCH /admin/users/:id now accepts email and name. Changing the email invalidates open invite/reset links (they went to the old address) and ends existing sessions; duplicates are rejected, staff login emails can only be changed by a superadmin, and the old values go to the audit log. The customer page gets an edit form per user, optionally updating the billing email along with it. Co-Authored-By: Claude Opus 5.5 --- apps/api/src/modules/identity/index.ts | 15 +++++++++++-- apps/api/test/orders.test.ts | 19 +++++++++++++++++ .../src/app/(app)/admin/kunden/[id]/page.tsx | 21 +++++++++++++++++-- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/apps/api/src/modules/identity/index.ts b/apps/api/src/modules/identity/index.ts index ffbd351..cad2f02 100644 --- a/apps/api/src/modules/identity/index.ts +++ b/apps/api/src/modules/identity/index.ts @@ -277,17 +277,28 @@ export const identityModule: KcModule = { app.patch('/admin/users/:id', async (req) => { const a = requirePermission(req, 'users.write'); const { id } = z.object({ id: z.string().uuid() }).parse(req.params); - const b = z.object({ status: z.enum(['active', 'disabled']).optional(), staffRole: z.enum(['support', 'accounting', 'admin', 'superadmin']).optional() }).parse(req.body); + const b = z.object({ status: z.enum(['active', 'disabled']).optional(), staffRole: z.enum(['support', 'accounting', 'admin', 'superadmin']).optional(), email: email.optional(), name: z.string().trim().min(1).max(150).optional() }).parse(req.body); const u = await one('SELECT * FROM users WHERE id = ?', [id]); if (!u) throw notFound(); if (id === a.user.id) throw forbidden('Eigenes Konto kann hier nicht geändert werden', 'SELF_CHANGE'); const privileged = (r: unknown) => r === 'admin' || r === 'superadmin'; if ((privileged(u.staff_role) || privileged(b.staffRole)) && !can(a.principal, 'users.write_privileged')) throw forbidden('Nur Superadministratoren', 'PRIVILEGED_ONLY'); + const emailChanged = b.email !== undefined && b.email !== u.email; + if (emailChanged) { + // Login-Adresse eines Mitarbeiters zu ändern ist eine Kontoübernahme-Möglichkeit: nur Superadmin + if (u.kind === 'staff' && !can(a.principal, 'users.write_privileged')) throw forbidden('Nur Superadministratoren dürfen die Anmelde-E-Mail von Mitarbeitern ändern', 'PRIVILEGED_ONLY'); + if (await one('SELECT 1 AS x FROM users WHERE email = ? AND id <> ?', [b.email, id])) throw conflict('E-Mail bereits vergeben', 'EMAIL_EXISTS'); + await run('UPDATE users SET email = ? WHERE id = ?', [b.email, id]); + // Offene Einladungs-/Reset-Links gingen an die alte Adresse und dürfen nicht mehr gelten; bestehende Sitzungen enden + await run('UPDATE user_tokens SET used_at = UTC_TIMESTAMP(3) WHERE user_id = ? AND used_at IS NULL', [id]); + await run('UPDATE sessions SET revoked_at = UTC_TIMESTAMP(3) WHERE user_id = ? AND revoked_at IS NULL', [id]); + } + if (b.name !== undefined) await run('UPDATE users SET name = ? WHERE id = ?', [b.name, id]); if (b.staffRole && u.kind !== 'staff') throw badRequest('Nur für Mitarbeiter'); if (b.status === 'active' && u.status === 'invited') throw badRequest('Eingeladene Benutzer aktivieren sich selbst'); await run('UPDATE users SET status = COALESCE(?, status), staff_role = COALESCE(?, staff_role) WHERE id = ?', [b.status ?? null, b.staffRole ?? null, id]); if (b.status === 'disabled') await run('UPDATE sessions SET revoked_at = UTC_TIMESTAMP(3) WHERE user_id = ? AND revoked_at IS NULL', [id]); - await audit({ actorType: 'user', actorId: a.user.id, action: 'user.update', resourceType: 'user', resourceId: id, correlationId: req.correlationId, ip: clientIp(req), before: { status: u.status, staffRole: u.staff_role }, after: b }); + await audit({ actorType: 'user', actorId: a.user.id, action: 'user.update', resourceType: 'user', resourceId: id, correlationId: req.correlationId, ip: clientIp(req), before: { status: u.status, staffRole: u.staff_role, ...(emailChanged ? { email: u.email } : {}), ...(b.name !== undefined ? { name: u.name } : {}) }, after: b }); return { status: 'ok' }; }); }, diff --git a/apps/api/test/orders.test.ts b/apps/api/test/orders.test.ts index 8249a31..6ca1bae 100644 --- a/apps/api/test/orders.test.ts +++ b/apps/api/test/orders.test.ts @@ -326,3 +326,22 @@ describe('Staffelpreise nach Laufzeit', () => { expect(items[0].snapshot.terms).toEqual({ termMonths: 12, renewal: 'auto', renewalTermMonths: 12, noticeDays: 30 }); }); }); + +describe('Benutzer: Anmelde-E-Mail ändern', () => { + it('Personal ändert E-Mail/Name eines Kunden; alte Einladung ungültig, Duplikate und Mitarbeiter-E-Mails geschützt', async () => { + const admin = await staff('mail-adm@shop.test', 'admin'); const sa = await staff('mail-sa@shop.test', 'superadmin'); const sup = await staff('mail-sup@shop.test', 'support'); + const c = (await call(app, admin, 'POST', '/admin/customers', { type: 'private', name: 'Alt Name', owner: { email: 'alt@shop.test', name: 'Alt Name' } })).json(); + const oldToken = new URL(c.inviteLink).searchParams.get('token'); + const uid = (await call(app, admin, 'GET', `/admin/customers/${c.id}`)).json().members[0].id; + expect((await call(app, sup, 'PATCH', `/admin/users/${uid}`, { email: 'neu@shop.test' })).statusCode).toBe(403); + expect((await call(app, admin, 'PATCH', `/admin/users/${uid}`, { email: 'mail-sa@shop.test' })).statusCode).toBe(409); + expect((await call(app, admin, 'PATCH', `/admin/users/${uid}`, { email: 'Neu@Shop.test', name: 'Neu Name' })).statusCode).toBe(200); + const m = (await call(app, admin, 'GET', `/admin/customers/${c.id}`)).json().members[0]; + expect(m).toMatchObject({ email: 'neu@shop.test', name: 'Neu Name' }); + expect((await app.inject({ method: 'POST', url: '/v1/auth/invite/accept', payload: { token: oldToken, password: 'passwort-kunde-123', repeat: 'passwort-kunde-123' } })).statusCode).toBe(400); + const saId = (await call(app, sa, 'GET', '/auth/me')).json().user.id; + expect((await call(app, admin, 'PATCH', `/admin/users/${saId}`, { email: 'x@shop.test' })).statusCode).toBe(403); + const log = await one("SELECT before_json FROM audit_events WHERE action = 'user.update' AND resource_id = ?", [uid]); + expect(JSON.stringify(log?.before_json)).toContain('alt@shop.test'); + }); +}); diff --git a/apps/web/src/app/(app)/admin/kunden/[id]/page.tsx b/apps/web/src/app/(app)/admin/kunden/[id]/page.tsx index c34bb58..d4bc626 100644 --- a/apps/web/src/app/(app)/admin/kunden/[id]/page.tsx +++ b/apps/web/src/app/(app)/admin/kunden/[id]/page.tsx @@ -16,7 +16,7 @@ interface RRow { id: string; name: string; state: string; validUntil: string | n export default function Kunde() { const { id } = useParams<{ id: string }>(); const { can, reload } = useSession(); const r = useRouter(); const [contracts, setContracts] = useState(null); const [orders, setOrders] = useState(null); const [ress, setRess] = useState(null); - const [o, setO] = useState(null); const [msg, setMsg] = useState<{ k: 'ok' | 'err' | 'warn'; t: string } | null>(null); const [confirm, setConfirm] = useState(null); const [switchTo, setSwitchTo] = useState<'private' | 'business' | null>(null); + const [o, setO] = useState(null); const [msg, setMsg] = useState<{ k: 'ok' | 'err' | 'warn'; t: string } | null>(null); const [confirm, setConfirm] = useState(null); const [switchTo, setSwitchTo] = useState<'private' | 'business' | null>(null); const [editUser, setEditUser] = useState(null); const [impersonateOpen, setImpersonateOpen] = useState(false); const [impersonateBusy, setImpersonateBusy] = useState(false); const [welcomeBusy, setWelcomeBusy] = useState(false); const load = useCallback(() => api('GET', `/admin/customers/${id}`).then(setO).catch((e) => setMsg({ k: 'err', t: errMsg(e) })), [id]); @@ -33,6 +33,16 @@ export default function Kunde() { // Beim Wechsel zum Privatkunden werden Firma und USt-IdNr. entfernt (Bestätigung vorher). try { setO(await api('PATCH', `/admin/customers/${id}`, { customerType: t, ...(t === 'private' ? { billing: { company: '', vatId: '' } } : { billing: { company: o!.name } }) })); setSwitchTo(null); setMsg({ k: 'ok', t: 'Kundenart geändert.' }); } catch (x) { setMsg({ k: 'err', t: errMsg(x) }); } } + async function saveUser(e: FormEvent, m: { id: string; email: string; name: string; status: string }) { + e.preventDefault(); const f = new FormData(e.currentTarget); const email = String(f.get('uemail') ?? '').trim(); const name = String(f.get('uname') ?? '').trim(); + try { + await api('PATCH', `/admin/users/${m.id}`, { name, email }); + if (f.get('ubilling') === 'on') await api('PATCH', `/admin/customers/${id}`, { billing: { billingEmail: email } }); + setEditUser(null); await load(); + const changed = email.toLowerCase() !== m.email; + setMsg({ k: 'ok', t: changed ? `Gespeichert. Anmeldung ab sofort mit ${email}${m.status === 'invited' ? ' – die alte Einladung ist ungültig, bitte „Einladung senden“ erneut ausführen.' : '; bestehende Sitzungen wurden beendet.'}` : 'Gespeichert.' }); + } catch (x) { setMsg({ k: 'err', t: errMsg(x) }); } + } async function reinvite(uid: string, email: string) { try { const r = await api<{ mail: string; inviteLink?: string }>('POST', `/admin/users/${uid}/reinvite`); setMsg(r.mail === 'sent' ? { k: 'ok', t: `Die Einladung wurde an ${email} gesendet.` } : { k: 'warn', t: `E-Mail-Versand ist nicht eingerichtet. Einladungslink (wird nur jetzt angezeigt): ${r.inviteLink}` }); } catch (x) { setMsg({ k: 'err', t: errMsg(x) }); } } @@ -89,7 +99,14 @@ export default function Kunde() {

Benutzer

{w && }

Enthält den Zugangslink, die aktuellen Produkte mit Preisen und eine kurze Anleitung inkl. Discord-Verknüpfung. Geht an den ersten Ansprechpartner.

- {o.members.map((m) => )}
NameE-MailRolleStatusAktionen
{m.name}{m.email}{ROLE_LABEL[m.role]}{w && m.status === 'invited' && }
+ {o.members.map((m) => editUser === m.id ? +
void saveUser(e, m)}> +
+
+ {o.billing.billingEmail === m.email && } +
+
+ : {m.name}{m.email}{ROLE_LABEL[m.role]}
{can('users.write') && }{w && m.status === 'invited' && }
)} {w &&

Kundenart

{switchTo ? (

Zu {switchTo === 'private' ? 'Privatkunde' : 'Geschäftskunde'} wechseln? {switchTo === 'private' ? 'Firma und USt-IdNr. werden entfernt.' : 'Als Firma wird der bisherige Name übernommen.'} Das kann Auswirkungen auf Rechnungen und Steuer haben. Die Änderung wird protokolliert.

) From 9ad687b90bbf6779f5d49269c81d54bd70a7a8b9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 4 Oct 2026 11:56:07 +0200 Subject: [PATCH 02/47] Wiederherstellungstest: DEFINER aus Dump entfernen, EPIPE abfangen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trigger aus Migration 033 tragen den DEFINER des Import-Nutzers (phpMyAdmin von KeyHelp); ohne SET USER schlägt der Import in die Test-DB fehl. Zusätzlich stürzte run() bei frühem Abbruch von mysql mit unbehandeltem EPIPE ab und verschluckte die eigentliche Fehlermeldung. Co-Authored-By: Claude Opus 5.5 --- apps/api/src/ops/backup.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/api/src/ops/backup.ts b/apps/api/src/ops/backup.ts index be408c1..13fd959 100644 --- a/apps/api/src/ops/backup.ts +++ b/apps/api/src/ops/backup.ts @@ -33,7 +33,8 @@ function run(cmd: string, args: string[], o: { env?: Record; std let out = ''; let err = ''; if (o.stdout) p.stdout!.pipe(createWriteStream(o.stdout, { mode: 0o600 })); else p.stdout!.on('data', (d) => (out += d)); p.stderr!.on('data', (d) => { err += d; if (err.length > 4000) err = err.slice(-4000); }); - if (o.stdin) createReadStream(o.stdin).pipe(p.stdin!); else if (o.stdinText !== undefined) { p.stdin!.on('error', () => undefined); p.stdin!.end(o.stdinText); } + // EPIPE abfangen, wenn das Programm (z.B. mysql) früh abbricht – der eigentliche Fehler kommt über Exit-Code und stderr + if (o.stdin) { p.stdin!.on('error', () => undefined); createReadStream(o.stdin).pipe(p.stdin!); } else if (o.stdinText !== undefined) { p.stdin!.on('error', () => undefined); p.stdin!.end(o.stdinText); } p.on('error', (e) => reject(new Error(`${basename(cmd)} konnte nicht gestartet werden: ${e.message}`))); p.on('close', (code) => (code === 0 ? resolve(out) : reject(new Error(`${basename(cmd)} Fehler (Exit ${code}): ${err.trim().split('\n').slice(-3).join(' | ')}`)))); }); @@ -205,7 +206,11 @@ export async function runRestoreTest(c: BackupConfig, file?: string): Promise (await conn.query(sql))[0] as any[]; From 9d2232308cc3efc55fd89bb3b476cb79113d773d Mon Sep 17 00:00:00 2001 From: Kundencenter Date: Mon, 5 Oct 2026 10:53:46 +0200 Subject: [PATCH 03/47] =?UTF-8?q?Benutzer=20=C3=A4ndern:=20Pr=C3=BCfungen?= =?UTF-8?q?=20vor=20dem=20Schreiben=20der=20E-Mail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bisher wurde die neue Anmelde-E-Mail (samt Entwertung der Tokens und Sitzungen) geschrieben, bevor staffRole/Status geprüft wurden. Schlug eine dieser Prüfungen fehl, blieb die E-Mail ohne Audit-Eintrag geändert. Co-Authored-By: Claude Opus 5.5 --- apps/api/src/modules/identity/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/modules/identity/index.ts b/apps/api/src/modules/identity/index.ts index cad2f02..bb3ab25 100644 --- a/apps/api/src/modules/identity/index.ts +++ b/apps/api/src/modules/identity/index.ts @@ -283,6 +283,8 @@ export const identityModule: KcModule = { if (id === a.user.id) throw forbidden('Eigenes Konto kann hier nicht geändert werden', 'SELF_CHANGE'); const privileged = (r: unknown) => r === 'admin' || r === 'superadmin'; if ((privileged(u.staff_role) || privileged(b.staffRole)) && !can(a.principal, 'users.write_privileged')) throw forbidden('Nur Superadministratoren', 'PRIVILEGED_ONLY'); + if (b.staffRole && u.kind !== 'staff') throw badRequest('Nur für Mitarbeiter'); + if (b.status === 'active' && u.status === 'invited') throw badRequest('Eingeladene Benutzer aktivieren sich selbst'); const emailChanged = b.email !== undefined && b.email !== u.email; if (emailChanged) { // Login-Adresse eines Mitarbeiters zu ändern ist eine Kontoübernahme-Möglichkeit: nur Superadmin @@ -294,8 +296,6 @@ export const identityModule: KcModule = { await run('UPDATE sessions SET revoked_at = UTC_TIMESTAMP(3) WHERE user_id = ? AND revoked_at IS NULL', [id]); } if (b.name !== undefined) await run('UPDATE users SET name = ? WHERE id = ?', [b.name, id]); - if (b.staffRole && u.kind !== 'staff') throw badRequest('Nur für Mitarbeiter'); - if (b.status === 'active' && u.status === 'invited') throw badRequest('Eingeladene Benutzer aktivieren sich selbst'); await run('UPDATE users SET status = COALESCE(?, status), staff_role = COALESCE(?, staff_role) WHERE id = ?', [b.status ?? null, b.staffRole ?? null, id]); if (b.status === 'disabled') await run('UPDATE sessions SET revoked_at = UTC_TIMESTAMP(3) WHERE user_id = ? AND revoked_at IS NULL', [id]); await audit({ actorType: 'user', actorId: a.user.id, action: 'user.update', resourceType: 'user', resourceId: id, correlationId: req.correlationId, ip: clientIp(req), before: { status: u.status, staffRole: u.staff_role, ...(emailChanged ? { email: u.email } : {}), ...(b.name !== undefined ? { name: u.name } : {}) }, after: b }); From e0f21419018c06bf52f084771b2ea8ea57cdce84 Mon Sep 17 00:00:00 2001 From: Kundencenter Date: Mon, 5 Oct 2026 13:39:10 +0200 Subject: [PATCH 04/47] =?UTF-8?q?Oberfl=C3=A4che:=20Kontraste=20nach=20WCA?= =?UTF-8?q?G,=20SVG-Icons=20statt=20Emojis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- apps/web/src/app/(app)/layout.tsx | 17 +++++++++-------- apps/web/src/app/(app)/tickets/[id]/page.tsx | 5 +++-- apps/web/src/app/globals.css | 20 +++++++++++--------- apps/web/src/components/Icon.tsx | 18 ++++++++++++++++++ apps/web/src/components/ThemeToggle.tsx | 5 +++-- 5 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 apps/web/src/components/Icon.tsx diff --git a/apps/web/src/app/(app)/layout.tsx b/apps/web/src/app/(app)/layout.tsx index 8e3d445..eeab985 100644 --- a/apps/web/src/app/(app)/layout.tsx +++ b/apps/web/src/app/(app)/layout.tsx @@ -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 }) { ); - const bottomLink = (href: string, label: string) => {label}; + const bottomLink = (href: string, label: string, icon: IconName) => {label}; return (<> {me.impersonating && ( -
- 👁 Ansicht als Kunde: {me.impersonating.orgName} ({me.impersonating.customerNumber}) · Grund: {me.impersonating.reason} +
+ Ansicht als Kunde: {me.impersonating.orgName} ({me.impersonating.customerNumber}) · Grund: {me.impersonating.reason}
)} @@ -57,11 +58,11 @@ export default function AppLayout({ children }: { children: ReactNode }) {
Kundencenter
{nav}
{trial && path !== '/einstellungen/lizenz' &&
{trial} Lizenz hinterlegen
}{children}
{!enrollNeeded && }
); diff --git a/apps/web/src/app/(app)/tickets/[id]/page.tsx b/apps/web/src/app/(app)/tickets/[id]/page.tsx index 7bae736..2a4310d 100644 --- a/apps/web/src/app/(app)/tickets/[id]/page.tsx +++ b/apps/web/src/app/(app)/tickets/[id]/page.tsx @@ -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 (
{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.filename} - : 📄 {a.filename} ({kb} KB); })} + ? {a.filename} + : {a.filename} ({kb} KB); })}
); } interface Msg { id: string; authorId: string; authorName: string; authorKind: 'customer' | 'staff'; body: string; internalNote: boolean; createdAt: string; attachments: Attachment[] } diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.css index 6b5e02a..f2112d1 100644 --- a/apps/web/src/app/globals.css +++ b/apps/web/src/app/globals.css @@ -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; } } diff --git a/apps/web/src/components/Icon.tsx b/apps/web/src/components/Icon.tsx new file mode 100644 index 0000000..1371588 --- /dev/null +++ b/apps/web/src/components/Icon.tsx @@ -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: <>, + server: <>, + ticket: <>, + receipt: <>, + menu: <>, + sun: <>, + moon: <>, + monitor: <>, + eye: <>, + file: <>, +} as const; +export type IconName = keyof typeof PATHS; + +export function Icon({ name, className = 'icon' }: { name: IconName; className?: string }) { + return ; +} diff --git a/apps/web/src/components/ThemeToggle.tsx b/apps/web/src/components/ThemeToggle.tsx index b252577..62153e3 100644 --- a/apps/web/src/components/ThemeToggle.tsx +++ b/apps/web/src/components/ThemeToggle.tsx @@ -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 = { system: 'System', light: 'Hell', dark: 'Dunkel' }; -const ICON: Record = { system: '🌓', light: '☀️', dark: '🌙' }; +const ICON: Record = { system: 'monitor', light: 'sun', dark: 'moon' }; const NEXT: Record = { system: 'light', light: 'dark', dark: 'system' }; function apply(t: Theme) { @@ -24,7 +25,7 @@ export function ThemeToggle({ compact = false }: { compact?: boolean }) { } return ( ); } From f3e89554f4095cd5f58befc1445eb9d76b429538 Mon Sep 17 00:00:00 2001 From: Kundencenter Date: Mon, 5 Oct 2026 13:51:13 +0200 Subject: [PATCH 05/47] =?UTF-8?q?Oberfl=C3=A4che=20modernisiert,=20Herstel?= =?UTF-8?q?lerhinweis=20FlessingLabs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Navigation mit Icons, Akzentleiste am aktiven Eintrag, Chevron statt Zeichen, Benutzerblock mit Initialen, dezente Buttons in der Seitenleiste - Markenzeichen „KC“ (Seitenleiste, mobile Kopfzeile, Anmeldeseiten) - Fußzeile „KC@FlessingLabs · © FlessingLabs · flessinglabs.com“ in der App und auf allen Seiten außerhalb der Anmeldung - Behoben: Seite lief auf dem Handy bei breiten Tabellen seitlich über (Rasterspalte minmax(0, 1fr)); Kennungen in Tabellen und Badges brechen nicht mehr um; doppelter Abstand zwischen Übersichtskarten - Links dezenter unterstrichen, in Tabellen erst beim Überfahren Co-Authored-By: Claude Opus 5.5 --- apps/web/src/app/(app)/layout.tsx | 29 +++++++----- apps/web/src/app/globals.css | 74 +++++++++++++++++++++---------- apps/web/src/app/layout.tsx | 3 +- apps/web/src/components/Brand.tsx | 12 +++++ apps/web/src/components/Icon.tsx | 16 +++++++ 5 files changed, 100 insertions(+), 34 deletions(-) create mode 100644 apps/web/src/components/Brand.tsx diff --git a/apps/web/src/app/(app)/layout.tsx b/apps/web/src/app/(app)/layout.tsx index eeab985..395267c 100644 --- a/apps/web/src/app/(app)/layout.tsx +++ b/apps/web/src/app/(app)/layout.tsx @@ -7,6 +7,13 @@ import { useSession } from '@/lib/session'; import { ROLE_LABEL } from '@/components/ui'; import { ThemeToggle } from '@/components/ThemeToggle'; import { Icon, type IconName } from '@/components/Icon'; +import { Brand, SiteFooter } from '@/components/Brand'; + +const ICONS: Record = { + '/dashboard': 'home', '/lizenzen': 'key', '/ressourcen': 'server', '/vertraege': 'fileText', '/bestellungen': 'cart', '/rechnungen': 'receipt', '/tickets': 'ticket', '/admin/posteingang': 'inbox', + '/organisation': 'building', '/domains': 'globe', '/admin/kunden': 'users', '/admin/produkte': 'package', '/admin/domains': 'list', '/admin/benutzer': 'userCog', '/admin/auftraege': 'activity', + '/admin/audit': 'shield', '/einstellungen': 'settings', '/konto': 'user', +}; export default function AppLayout({ children }: { children: ReactNode }) { const { me, loading, can, reload } = useSession(); const r = useRouter(); const path = usePathname(); const [open, setOpen] = useState(false); @@ -17,10 +24,10 @@ export default function AppLayout({ children }: { children: ReactNode }) { useEffect(() => { if (enrollNeeded && path !== '/konto') r.replace('/konto'); }, [enrollNeeded, path, r]); useEffect(() => setOpen(false), [path]); if (loading || !me || me.pendingMfa) return

Wird geladen …

; - const link = (href: string, label: string) => {label}; + const link = (href: string, label: string) => {ICONS[href] && }{label}; const inGroup = (hrefs: string[]) => hrefs.some((h) => path === h || path.startsWith(h + '/')); const group = (title: string, hrefs: string[], items: ReactNode) => ( -
{title}
{items}
+
{title}
{items}
); async function logout() { await api('POST', '/auth/logout'); await reload(); r.replace('/login'); } async function stopImpersonation() { const orgId = me!.impersonating!.orgId; await api('POST', '/auth/impersonate/stop'); await reload(); r.replace(`/admin/kunden/${orgId}`); } @@ -28,7 +35,7 @@ export default function AppLayout({ children }: { children: ReactNode }) { const verwaltung = [can('customers.read') && ['/admin/kunden', 'Kunden'], can('products.read') && ['/admin/produkte', 'Produkte'], can('domains.read') && ['/admin/domains', 'Domain-Aufstellung'], can('users.read') && ['/admin/benutzer', 'Benutzer'], can('jobs.read') && ['/admin/auftraege', 'Aufträge'], can('audit.read') && ['/admin/audit', 'Audit-Protokoll'], (can('connectors.read') || can('backup.read')) && ['/einstellungen', 'Einstellungen']].filter(Boolean) as [string, string][]; const nav = ( ); const bottomLink = (href: string, label: string, icon: IconName) => {label}; @@ -55,8 +64,8 @@ export default function AppLayout({ children }: { children: ReactNode }) {
)}
-
Kundencenter
- {nav}
{trial && path !== '/einstellungen/lizenz' &&
{trial} Lizenz hinterlegen
}{children}
+
+ {nav}
{trial && path !== '/einstellungen/lizenz' &&
{trial} Lizenz hinterlegen
}{children}
{!enrollNeeded &&