Finanzen: Helfer fuer Vorzeichen-Rot und Meldungsklassen

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-10-06 14:38:00 +00:00
1 parent a2a6d83b15
commit e1932a2a48
2 files changed
+41

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
// Kleine Darstellungs-Helfer fuer die Finanzen-Seiten (kein React, keine Abhaengigkeit, unter Node testbar).
const MINUS = '−' // U+2212, das Minus aus financeFormat.js
/** Wahr, wenn der angezeigte Text mit dem Minuszeichen (U+2212) beginnt. Nur dann wird ein Betrag rot (`fin-neg`). */
export function isNegText(text) {
return typeof text === 'string' && text.startsWith(MINUS)
}
/** Ton ('ok' | 'warn' | sonst) -> Klasse und Rolle einer Meldung; `extra` wird mit Leerzeichen an die Klasse gehaengt. */
export function noticeProps(tone, extra = '') {
const base = tone === 'ok' ? 'msg ok' : tone === 'warn' ? 'msg warn' : 'msg muted'
return {
className: extra ? `${base} ${extra}` : base,
role: tone === 'warn' ? 'alert' : 'status',
}
}