Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions site/src/app/packs/PacksClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function sortPacks(packs: PackMeta[], key: SortKey) {

// ── Component ────────────────────────────────────────────────────────────────

export function PacksClient({ packs: allPacks }: { packs: PackMeta[] }) {
export function PacksClient({ packs: allPacks, lastUpdated }: { packs: PackMeta[]; lastUpdated: string }) {
const router = useRouter();
const searchParams = useSearchParams();

Expand Down Expand Up @@ -481,14 +481,16 @@ export function PacksClient({ packs: allPacks }: { packs: PackMeta[] }) {
{Math.min(safePage * PACKS_PER_PAGE, filtered.length)} of{" "}
{filtered.length} packs
</p>
<p>
Updated{" "}
{new Date().toLocaleDateString("en-US", {
month: "short",
day: "numeric",
year: "numeric",
})}
</p>
{lastUpdated && (
<p>
Updated{" "}
{new Date(lastUpdated).toLocaleDateString("en-US", {
month: "short",
day: "numeric",
year: "numeric",
})}
</p>
)}
</div>

<ErrorBoundary>
Expand Down
7 changes: 6 additions & 1 deletion site/src/app/packs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ export const metadata: Metadata = {
export default async function PacksPage() {
const packs = await fetchAllPacks();

const lastUpdated = packs.reduce((latest, p) => {
const d = p.dateUpdated || p.dateAdded;
return d && d > latest ? d : latest;
}, "");

return (
<Suspense>
<PacksClient packs={packs} />
<PacksClient packs={packs} lastUpdated={lastUpdated} />
</Suspense>
);
}
Loading