--- import { fetchChangelog } from '@utils/fetch-changelog'; import { fetchData, slugify } from '@utils/fetch-data'; import ServiceIcon from './ServiceIcon.astro'; import type { Category, Service } from '../../types/Service'; interface Props { limit?: number; categories?: Category[]; } const { limit = 12, categories: categoriesProp } = Astro.props; const categories = categoriesProp ?? ((await fetchData())?.categories || []); const { entries } = await fetchChangelog(); const findService = ( categoryName: string, sectionName: string, serviceName: string, ): Service | undefined => { const c = categories.find((cat) => cat.name === categoryName); const s = c?.sections.find((sec) => sec.name === sectionName); return s?.services?.find((sv) => sv.name === serviceName); }; const additions = entries .slice() .sort((a, b) => (a.date < b.date ? 1 : -1)) .flatMap((e) => (e.changes?.services?.added || []).map((s) => ({ ...s, date: e.date, author: e.pr?.author, authorUrl: e.pr?.author ? `https://github.com/${e.pr.author}` : null, service: findService(s.category, s.section, s.name), })), ) .slice(0, limit); const formatDate = (iso: string) => new Date(iso).toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric', }); ---
Newest privacy-respecting software and services added to the directory.
No recent updates to show.
) }