feat: last updated time

This commit is contained in:
TrèsAbhi committed 2024-10-25 10:49:11 -05:00
1 parent 8c1fc6f9df
commit 4a1f3ea12d
3 files changed
+16 -3

No files matched your search

@@ -27,7 +27,7 @@ export function GalleryList({ avatars }: GalleryListProps) {
return avatars;
} else {
return fuzzysort
.go(search, avatars, { key: 'name' })
.go(search, avatars, { keys: ['name', 'id'] })
.map((result) => result.obj);
}
}, [search]);
@@ -1,3 +1,5 @@
import { InfoCircledIcon } from '@radix-ui/react-icons';
import { Callout, Flex } from '@radix-ui/themes';
import { GalleryList, type Avatar } from '../../../components/Gallery/List';
import { GallerySearch } from '../../../components/Gallery/Search';
import { PageWrapper } from '../../../components/PageWrapper';
@@ -5,11 +7,21 @@ import { GalleryEphemeral } from '../../../stores/galleryEphemeral';
interface PageProps {
avatars: Avatar[];
lastUpdated: string;
}
export function Page({ avatars }: PageProps) {
export function Page({ avatars, lastUpdated }: PageProps) {
return (
<PageWrapper color="gold">
<Flex justify="center">
<Callout.Root size="1">
<Callout.Icon>
<InfoCircledIcon />
</Callout.Icon>
<Callout.Text>Last updated on {lastUpdated}</Callout.Text>
</Callout.Root>
</Flex>
<GalleryEphemeral.Provider>
<GallerySearch />
<GalleryList avatars={avatars} />
@@ -18,8 +18,9 @@ const avatars = Object.entries(glossary)
({ id: key.replace('avatar_', ''), name: value.title }) satisfies Avatar,
)
.sort((a, b) => a.name.localeCompare(b.name));
const lastUpdated = new Date().toLocaleDateString();
---
<ToolLayout tool={galleryTool}>
<Page {avatars} client:load />
<Page {avatars} {lastUpdated} client:load />
</ToolLayout>