Files
blitzkit/packages/preforged/tools/gallery/index.astro
T

29 lines
934 B
Plaintext
Raw Normal View History

2024-10-24 17:05:46 -05:00
---
2024-12-27 12:38:38 -06:00
import type { Avatar } from '../../../../components/Gallery/List';
import { galleryTool } from '../../../../constants/tools';
import { fetchGlossary } from '../../../../core/blitz/fetchGlossary';
2024-12-27 12:59:56 -06:00
import ToolLayout from '../../../../layouts/ToolLayout.astro';
2024-10-24 17:32:46 -05:00
import { Page } from './_index';
2024-10-24 17:05:46 -05:00
2024-12-27 13:16:51 -06:00
export { getStaticPaths } from '../../index.astro';
2025-01-07 13:00:43 -06:00
const { locale } = Astro.params;
const glossary = await fetchGlossary(locale);
2024-10-24 17:32:46 -05:00
const avatars = Object.entries(glossary)
2024-10-24 17:05:46 -05:00
.filter(
([key, value]) =>
key.startsWith('avatar') &&
!key.endsWith('_part') &&
value.image_url !== null,
)
2024-10-24 17:32:46 -05:00
.map(
([key, value]) =>
({ id: key.replace('avatar_', ''), name: value.title }) satisfies Avatar,
)
.sort((a, b) => a.name.localeCompare(b.name));
2025-01-07 13:00:43 -06:00
const lastUpdated = new Date().toLocaleDateString(locale);
2024-10-24 17:05:46 -05:00
---
<ToolLayout tool={galleryTool}>
2025-01-07 13:00:43 -06:00
<Page {locale} {avatars} {lastUpdated} client:load />
2024-10-24 17:05:46 -05:00
</ToolLayout>