Redesign the Council cards and popups

This commit is contained in:
2026-02-03 11:26:11 -05:00
parent 7ad2bfba10
commit ae398b3d37
7 changed files with 239 additions and 134 deletions

13
src/lib/format.ts Normal file
View File

@@ -0,0 +1,13 @@
/**
* Get initials from a name (e.g. "Jane Doe" → "JD", "Mary Jane Watson" → "MJW").
* Uses first letter of up to 3 words. Safe for null/undefined/empty.
*/
export function getInitials(name: string | null | undefined): string {
if (name == null || typeof name !== 'string') return '';
const words = name.trim().split(/\s+/).filter(Boolean);
if (words.length === 0) return '';
return words
.slice(0, 3)
.map((w) => w.charAt(0).toUpperCase())
.join('');
}