fix: align PocketBase type definitions with actual schema
Remove slug field from PageContentRecord (intro/bio collections have none). Remove number field from SectionRecord (not stored in PocketBase); derive zero-padded display number from the order field at render time.
This commit is contained in:
@@ -12,10 +12,6 @@ export type SectionRecord = BaseRecord & {
|
||||
* Display name of the section
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Visual numbering prefix (e.g., "01")
|
||||
*/
|
||||
number: string;
|
||||
/**
|
||||
* Sorting weight for section order
|
||||
*/
|
||||
|
||||
@@ -26,12 +26,9 @@ export type BaseRecord = {
|
||||
|
||||
/**
|
||||
* PocketBase collection for simple text blocks (Intro, Bio).
|
||||
* Each collection is named after its section — no slug field.
|
||||
*/
|
||||
export type PageContentRecord = BaseRecord & {
|
||||
/**
|
||||
* Slug corresponding to the parent section
|
||||
*/
|
||||
slug: string;
|
||||
/**
|
||||
* HTML or Markdown content string
|
||||
*/
|
||||
|
||||
@@ -5,9 +5,9 @@ import { SectionsAccordion } from './SectionsAccordion';
|
||||
const baseRecord = { collectionId: 'c1', collectionName: 'sections', created: '', updated: '' };
|
||||
|
||||
const sections: SectionRecord[] = [
|
||||
{ ...baseRecord, id: '1', slug: 'intro', title: 'Intro', number: '01', order: 1 },
|
||||
{ ...baseRecord, id: '2', slug: 'bio', title: 'Bio', number: '02', order: 2 },
|
||||
{ ...baseRecord, id: '3', slug: 'skills', title: 'Skills', number: '03', order: 3 },
|
||||
{ ...baseRecord, id: '1', slug: 'intro', title: 'Intro', order: 1 },
|
||||
{ ...baseRecord, id: '2', slug: 'bio', title: 'Bio', order: 2 },
|
||||
{ ...baseRecord, id: '3', slug: 'skills', title: 'Skills', order: 3 },
|
||||
];
|
||||
|
||||
describe('SectionsAccordion', () => {
|
||||
|
||||
@@ -33,7 +33,7 @@ export function SectionsAccordion({ sections, activeSlug, children }: Props) {
|
||||
<SectionAccordion
|
||||
key={section.slug}
|
||||
id={section.slug}
|
||||
number={section.number}
|
||||
number={String(section.order).padStart(2, '0')}
|
||||
title={section.title}
|
||||
isActive={activeSlug === section.slug}
|
||||
href={`/${section.slug}`}
|
||||
|
||||
Reference in New Issue
Block a user