-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpage.tsx
More file actions
31 lines (29 loc) · 1 KB
/
Copy pathpage.tsx
File metadata and controls
31 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React from 'react';
import EntryTile from '@/components/EntryTile';
import Search from '@/components/Search';
import { pullAllEntryIDs, pullAllVersionsFromEntryID } from '@/libs/pullData';
import { getLatestVersionFromVersions } from '@/libs/processData';
const AllPage = async () => {
const allEntries = await pullAllEntryIDs();
const entriesPromisesArr: any[] = allEntries.map(async (id) => {
const allVersions = await pullAllVersionsFromEntryID(id);
const latestVersion = getLatestVersionFromVersions(allVersions);
return ({
id: id,
latestVersion: `v${latestVersion}.json`
})
})
const entriesArr = await Promise.all(entriesPromisesArr)
return (
<section className="container max-w-5xl mx-auto ">
<div className="my-10">
{entriesArr.map((item, index) => (
<ul className="my-3 divide-y-2 text-sm md:text-base" key={`list-${item}`}>
<EntryTile key={index} entryID={item.id} version={item.latestVersion} />
</ul>
))}
</div>
</section>
);
};
export default AllPage;