my website at ewancroft.uk
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(footer): enhance copyright display and fetch site info alongside profile

+15 -4
+15 -4
src/lib/components/layout/Footer.svelte
··· 1 1 <script lang="ts"> 2 2 import { onMount } from 'svelte'; 3 - import { fetchProfile, type ProfileData } from '$lib/services/atproto'; 3 + import { fetchProfile, type ProfileData, fetchSiteInfo, type SiteInfoData } from '$lib/services/atproto'; 4 4 5 5 let profile: ProfileData | null = null; 6 + let siteInfo: SiteInfoData | null = null; 6 7 let loading = true; 7 8 let error: string | null = null; 8 9 9 10 const currentYear = new Date().getFullYear(); 10 - const copyrightText = `${currentYear}`; 11 + const getBirthYear = () => { 12 + const birthYear = siteInfo?.additionalInfo?.websiteBirthYear; 13 + // Ensure birth year is valid and not in the future 14 + return birthYear && birthYear <= currentYear ? birthYear : currentYear; 15 + }; 16 + const copyrightText = getBirthYear() === currentYear 17 + ? `${currentYear}` 18 + : `${getBirthYear()} - ${currentYear}`; 11 19 12 20 onMount(async () => { 13 21 try { 14 - profile = await fetchProfile(); 22 + [profile, siteInfo] = await Promise.all([ 23 + fetchProfile(), 24 + fetchSiteInfo() 25 + ]); 15 26 } catch (err) { 16 - error = err instanceof Error ? err.message : 'Failed to load profile'; 27 + error = err instanceof Error ? err.message : 'Failed to load data'; 17 28 } finally { 18 29 loading = false; 19 30 }