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; return avatars;
} else { } else {
return fuzzysort return fuzzysort
.go(search, avatars, { key: 'name' }) .go(search, avatars, { keys: ['name', 'id'] })
.map((result) => result.obj); .map((result) => result.obj);
} }
}, [search]); }, [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 { GalleryList, type Avatar } from '../../../components/Gallery/List';
import { GallerySearch } from '../../../components/Gallery/Search'; import { GallerySearch } from '../../../components/Gallery/Search';
import { PageWrapper } from '../../../components/PageWrapper'; import { PageWrapper } from '../../../components/PageWrapper';
@@ -5,11 +7,21 @@ import { GalleryEphemeral } from '../../../stores/galleryEphemeral';
interface PageProps { interface PageProps {
avatars: Avatar[]; avatars: Avatar[];
lastUpdated: string;
} }
export function Page({ avatars }: PageProps) { export function Page({ avatars, lastUpdated }: PageProps) {
return ( return (
<PageWrapper color="gold"> <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> <GalleryEphemeral.Provider>
<GallerySearch /> <GallerySearch />
<GalleryList avatars={avatars} /> <GalleryList avatars={avatars} />
@@ -18,8 +18,9 @@ const avatars = Object.entries(glossary)
({ id: key.replace('avatar_', ''), name: value.title }) satisfies Avatar, ({ id: key.replace('avatar_', ''), name: value.title }) satisfies Avatar,
) )
.sort((a, b) => a.name.localeCompare(b.name)); .sort((a, b) => a.name.localeCompare(b.name));
const lastUpdated = new Date().toLocaleDateString();
--- ---
<ToolLayout tool={galleryTool}> <ToolLayout tool={galleryTool}>
<Page {avatars} client:load /> <Page {avatars} {lastUpdated} client:load />
</ToolLayout> </ToolLayout>