diff --git a/src/app.css b/src/app.css index 46bd27e..9badc85 100644 --- a/src/app.css +++ b/src/app.css @@ -46,6 +46,17 @@ transform: rotateY(2.4deg); } } + + --animate-pulse-ring: pulse-ring 1.5s ease-in-out infinite; + @keyframes pulse-ring { + 0%, + 100% { + opacity: 0.5; + } + 50% { + opacity: 1; + } + } } * { diff --git a/src/components/council/CouncilAvatar.svelte b/src/components/council/CouncilAvatar.svelte index 7fd3e26..0f19a3d 100644 --- a/src/components/council/CouncilAvatar.svelte +++ b/src/components/council/CouncilAvatar.svelte @@ -17,7 +17,7 @@
{#if src && !imageError} let { onViewProfile, name, position, image, featured = false, tag = null } = $props(); - import { getInitials } from '$lib/format'; + + function getInitials(n: string | null | undefined): string { + if (n == null || typeof n !== 'string') return ''; + return n + .trim() + .split(/\s+/) + .filter(Boolean) + .slice(0, 3) + .map((w) => w.charAt(0).toUpperCase()) + .join(''); + } let imageError = $state(false); - function handleImageError() { imageError = true; } - -
- e.key === 'Enter' || e.key === ' ' ? (e.preventDefault(), onViewProfile()) : null} -> + +
+ e.key === 'Enter' || e.key === ' ' ? (e.preventDefault(), onViewProfile()) : null} > {#if tag} {tag} {/if} - {#if image && !imageError} - {`Profile - {:else} - - {/if} -
-
-

- {name} -

-

{position}

- + {#if image && !imageError} + {`Profile + {:else} + + {/if} +
+ +
+

+ {name} +

+

{position}

+ +
-
+ + + +
diff --git a/src/components/council/CouncilCardPopUp.svelte b/src/components/council/CouncilCardPopUp.svelte index 93c4e7a..c721e81 100644 --- a/src/components/council/CouncilCardPopUp.svelte +++ b/src/components/council/CouncilCardPopUp.svelte @@ -9,8 +9,13 @@ onClose, id = 'popup-title' } = $props(); - import { getInitials } from '$lib/format'; import { Mail, X } from '@lucide/svelte'; + + function getInitials(name: string | null | undefined): string { + if (name == null || typeof name !== 'string') return ''; + const words = name.trim().split(/\s+/).filter(Boolean); + return words.slice(0, 3).map((w) => w.charAt(0).toUpperCase()).join(''); + } import { scale } from 'svelte/transition'; let imageError = $state(false); diff --git a/src/lib/format.ts b/src/lib/format.ts deleted file mode 100644 index 78139bb..0000000 --- a/src/lib/format.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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(''); -}