fix: correct RSC error patterns and extract skills grouping to utility
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { notFound } from 'next/navigation';
|
||||||
import type { PageContentRecord } from '$shared/api';
|
import type { PageContentRecord } from '$shared/api';
|
||||||
import { getFirstRecord } from '$shared/api';
|
import { getFirstRecord } from '$shared/api';
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ export default async function BioSection() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return <p>Loading bio content...</p>;
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { notFound } from 'next/navigation';
|
||||||
import type { PageContentRecord } from '$shared/api';
|
import type { PageContentRecord } from '$shared/api';
|
||||||
import { getFirstRecord } from '$shared/api';
|
import { getFirstRecord } from '$shared/api';
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ export default async function IntroSection() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return <p>Loading intro content...</p>;
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
import { notFound } from 'next/navigation';
|
||||||
import type { SkillRecord } from '$shared/api';
|
import type { SkillRecord } from '$shared/api';
|
||||||
import { getCollection } from '$shared/api';
|
import { getCollection } from '$shared/api';
|
||||||
|
import { groupByKey } from '$shared/lib';
|
||||||
import { Badge } from '$shared/ui';
|
import { Badge } from '$shared/ui';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,16 +13,11 @@ export default async function SkillsSection() {
|
|||||||
sort: 'category,order',
|
sort: 'category,order',
|
||||||
});
|
});
|
||||||
|
|
||||||
const categories = data.items.reduce(
|
if (!data.items.length) {
|
||||||
(acc, skill) => {
|
notFound();
|
||||||
if (!acc[skill.category]) {
|
|
||||||
acc[skill.category] = [];
|
|
||||||
}
|
}
|
||||||
acc[skill.category].push(skill);
|
|
||||||
return acc;
|
const categories = groupByKey(data.items, 'category');
|
||||||
},
|
|
||||||
{} as Record<string, SkillRecord[]>,
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-12">
|
<div className="space-y-12">
|
||||||
|
|||||||
Reference in New Issue
Block a user