add back topics since fetch is done once at build time anyways

main
Kay 2 months ago
parent ba3f508daa
commit f30a011a25

@ -70,19 +70,6 @@ const Project = ({
{/* /> */}
<Box p="6">
{/* <Box alignItems="baseline"> */}
{/* {project.topics.map((topic: string) => ( */}
{/* <Badge */}
{/* key={`${project.id}-${topic}`} */}
{/* borderRadius="full" */}
{/* px="2" */}
{/* mr={1} */}
{/* color={badgeColor} */}
{/* > */}
{/* {topic} */}
{/* </Badge> */}
{/* ))} */}
{/* </Box> */}
<Box
mt="1"
fontWeight="semibold"
@ -92,6 +79,19 @@ const Project = ({
>
{project.name}
</Box>
<Box alignItems="baseline">
{project.topics.map((topic: string) => (
<Badge
key={`${project.id}-${topic}`}
borderRadius="full"
px="2"
mr={1}
color={badgeColor}
>
{topic}
</Badge>
))}
</Box>
<Divider mt="1" mb="1" />
<Box>{projectDescription}</Box>
</Box>

@ -8,13 +8,32 @@ interface IHomeProps {
export async function getStaticProps() {
const latestURL = new URL('https://code.juke.fr/api/v1/users/kay/repos');
latestURL.search = new URLSearchParams().toString();
const projects = await (await fetch(latestURL.toString()))
const projects = await (
await fetch(latestURL.toString())
)
.json()
.then((res) =>
res.sort((a: any, b: any) => {
return Date.parse(b.updated_at) - Date.parse(a.updated_at);
}),
);
)
// gitea is weird and doesnt seem to have a way to return tags without requesting the things
// one by one so ehhhh
.then(async (r) => {
return Promise.all(
r.map(async (project: any) => {
const { topics } = await (
await fetch(
`https://code.juke.fr/api/v1/repos/kay/${project.name}/topics`,
)
).json();
return {
...project,
topics,
};
}),
);
});
return {
props: {

Loading…
Cancel
Save