Skip to content
Open
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
123 changes: 70 additions & 53 deletions components/DocTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@ import React from 'react';
import Link from 'next/link';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';

interface Author {
name: string;
photo?: string;
}

interface DocTableProps {
frontmatter: {
Specification: string;
Published: string;
authors: string[];
Metaschema: string;
Specification?: string;
Published?: string;
authors?: (string | Author)[];
Metaschema?: string;
};
}

const DocTable = ({ frontmatter }: DocTableProps) => {
const authors = frontmatter.authors ?? [];
const getAuthorName = (author: string | Author): string =>
typeof author === 'string' ? author : author.name;

return (
<Card className='w-full overflow-hidden py-0 border-2 border-primary shadow-lg gap-0'>
<CardHeader className='bg-primary text-primary-foreground p-2 rounded-none'>
Expand All @@ -22,63 +31,71 @@ const DocTable = ({ frontmatter }: DocTableProps) => {
</CardHeader>
<CardContent className='p-0'>
<div className='bg-[#e2e8f0] dark:bg-[#0f172a]'>
<div className='border-b border-border'>
<div className='flex'>
<div className='w-1/3 p-4 font-semibold text-base text-[#334155] dark:text-slate-300'>
Specification
</div>
<div className='w-2/3 p-4'>
<Link
href={frontmatter.Specification}
className='text-primary hover:underline dark:text-blue-400'
target='_blank'
rel='noopener noreferrer'
>
{frontmatter.Specification}
</Link>
{frontmatter.Specification && (
<div className='border-b border-border'>
<div className='flex'>
<div className='w-1/3 p-4 font-semibold text-base text-[#334155] dark:text-slate-300'>
Specification
</div>
<div className='w-2/3 p-4'>
<Link
href={frontmatter.Specification}
className='text-primary hover:underline dark:text-blue-400'
target='_blank'
rel='noopener noreferrer'
>
{frontmatter.Specification}
</Link>
</div>
</div>
</div>
</div>
<div className='border-b border-border'>
<div className='flex'>
<div className='w-1/3 p-4 font-semibold text-base text-[#334155] dark:text-slate-300'>
Published
)}
{frontmatter.Published && (
<div className='border-b border-border'>
<div className='flex'>
<div className='w-1/3 p-4 font-semibold text-base text-[#334155] dark:text-slate-300'>
Published
</div>
<div className='w-2/3 p-4'>{frontmatter.Published}</div>
</div>
<div className='w-2/3 p-4'>{frontmatter.Published}</div>
</div>
</div>
<div className='border-b border-border'>
<div className='flex'>
<div className='w-1/3 p-4 font-semibold text-base text-[#334155] dark:text-slate-300'>
Authors
</div>
<div className='w-2/3 p-4'>
{frontmatter.authors.map((author: string, index: number) => (
<span key={index}>
{author}
{index < frontmatter.authors.length - 1 ? ', ' : ''}
</span>
))}
)}
{authors.length > 0 && (
<div className='border-b border-border'>
<div className='flex'>
<div className='w-1/3 p-4 font-semibold text-base text-[#334155] dark:text-slate-300'>
Authors
</div>
<div className='w-2/3 p-4'>
{authors.map((author, index: number) => (
<span key={index}>
{getAuthorName(author)}
{index < authors.length - 1 ? ', ' : ''}
</span>
))}
</div>
</div>
</div>
</div>
<div>
<div className='flex'>
<div className='w-1/3 p-4 font-semibold text-base text-[#334155] dark:text-slate-300'>
Metaschema
</div>
<div className='w-2/3 p-4'>
<Link
href={frontmatter.Metaschema}
className='text-primary hover:underline dark:text-blue-400'
target='_blank'
rel='noopener noreferrer'
>
{frontmatter.Metaschema}
</Link>
)}
{frontmatter.Metaschema && (
<div>
<div className='flex'>
<div className='w-1/3 p-4 font-semibold text-base text-[#334155] dark:text-slate-300'>
Metaschema
</div>
<div className='w-2/3 p-4'>
<Link
href={frontmatter.Metaschema}
className='text-primary hover:underline dark:text-blue-400'
target='_blank'
rel='noopener noreferrer'
>
{frontmatter.Metaschema}
</Link>
</div>
</div>
</div>
</div>
)}
</div>
</CardContent>
</Card>
Expand Down
7 changes: 4 additions & 3 deletions pages/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';
import type { Frontmatter } from '~/types/common';

export async function getStaticPaths() {
return getStaticMarkdownPaths('pages');
}
export async function getStaticProps(args: any) {
export async function getStaticProps(args: { params?: { slug: string } }) {
return getStaticMarkdownProps(args, 'pages');
}

export default function StaticMarkdownPage({
frontmatter,
content,
}: {
frontmatter: any;
content: any;
frontmatter: Frontmatter;
content: string;
}) {
const fileRenderType = '_md';
const newTitle = 'JSON Schema - ' + frontmatter.title;
Expand Down
2 changes: 1 addition & 1 deletion pages/ambassadors/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function getStaticProps() {
export default function ambassadorPages({
ambassadorData,
}: {
ambassadorData: any;
ambassadorData: string;
}) {
return (
<SectionContext.Provider value='ambassador'>
Expand Down
16 changes: 14 additions & 2 deletions pages/draft-05/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import DocTable from '~/components/DocTable';
import { Headline1 } from '~/components/Headlines';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';
import { Frontmatter } from '~/types/common';

export async function getStaticProps() {
const index = fs.readFileSync('pages/draft-05/index.md', 'utf-8');
Expand All @@ -27,12 +28,23 @@ export async function getStaticProps() {
};
}

interface DraftFrontmatter extends Frontmatter {
Specification?: string;
Published?: string;
Metaschema?: string;
Comment on lines +32 to +34
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type safety issues with DraftFrontmatter:

  1. The Specification, Published, and Metaschema properties are marked as optional, but the DocTable component (line 53) requires them to be non-null strings and accesses them without null checks.
  2. The authors property is inherited as authors?: Author[] from Frontmatter, but DocTable expects authors: string[].

Consider either:

  • Making Specification, Published, and Metaschema required (non-optional) in the interface
  • Adding authors?: string[]; to override the base type
    Or update the DocTable component to handle optional values properly.
Suggested change
Specification?: string;
Published?: string;
Metaschema?: string;
Specification: string;
Published: string;
Metaschema: string;
authors?: string[];

Copilot uses AI. Check for mistakes.
}

interface BlocksData {
index: string;
body: string;
}

export default function ImplementationsPages({
blocks,
frontmatter,
}: {
blocks: any;
frontmatter: any;
blocks: BlocksData;
frontmatter: DraftFrontmatter;
}) {
const fileRenderType = 'indexmd';
return (
Expand Down
9 changes: 5 additions & 4 deletions pages/draft-06/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import { Frontmatter } from '~/types/common';

export async function getStaticPaths() {
return getStaticMarkdownPaths('pages/draft-06');
}
export async function getStaticProps(args: any) {
export async function getStaticProps(args: { params?: { slug: string } }) {
return getStaticMarkdownProps(args, 'pages/draft-06');
}

export default function StaticMarkdownPage({
frontmatter,
content,
}: {
frontmatter: any;
content: any;
frontmatter: Frontmatter;
content: string;
}) {
const fileRenderType = '_md';
const newTitle = 'JSON Schema - ' + frontmatter.title;

return (
<SectionContext.Provider value={frontmatter.section || null}>
<SectionContext.Provider value={frontmatter.section ?? null}>
<Head>
<title>{newTitle}</title>
</Head>
Expand Down
15 changes: 13 additions & 2 deletions pages/draft-06/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import DocTable from '~/components/DocTable';
import { Headline1 } from '~/components/Headlines';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';
import { Frontmatter } from '~/types/common';

export async function getStaticProps() {
const index = fs.readFileSync('pages/draft-06/index.md', 'utf-8');
Expand All @@ -25,12 +26,22 @@ export async function getStaticProps() {
};
}

interface DraftFrontmatter extends Frontmatter {
Specification?: string;
Published?: string;
Metaschema?: string;
Comment on lines +30 to +32
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type safety issues with DraftFrontmatter:

  1. The Specification, Published, and Metaschema properties are marked as optional, but the DocTable component (line 50) requires them to be non-null strings and accesses them without null checks.
  2. The authors property is inherited as authors?: Author[] from Frontmatter, but DocTable expects authors: string[].

Consider either:

  • Making Specification, Published, and Metaschema required (non-optional) in the interface
  • Adding authors?: string[]; to override the base type
    Or update the DocTable component to handle optional values properly.
Suggested change
Specification?: string;
Published?: string;
Metaschema?: string;
Specification: string;
Published: string;
Metaschema: string;
authors?: string[];

Copilot uses AI. Check for mistakes.
}

interface BlocksData {
index: string;
}

export default function ImplementationsPages({
blocks,
frontmatter,
}: {
blocks: any;
frontmatter: any;
blocks: BlocksData;
frontmatter: DraftFrontmatter;
}) {
const fileRenderType = 'indexmd';
return (
Expand Down
9 changes: 5 additions & 4 deletions pages/draft-07/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import { Frontmatter } from '~/types/common';

export async function getStaticPaths() {
return getStaticMarkdownPaths('pages/draft-07');
}
export async function getStaticProps(args: any) {
export async function getStaticProps(args: { params?: { slug: string } }) {
return getStaticMarkdownProps(args, 'pages/draft-07');
}

export default function StaticMarkdownPage({
frontmatter,
content,
}: {
frontmatter: any;
content: any;
frontmatter: Frontmatter;
content: string;
}) {
const fileRenderType = '_md';
const newTitle = 'JSON Schema - ' + frontmatter.title;

return (
<SectionContext.Provider value={frontmatter.section || null}>
<SectionContext.Provider value={frontmatter.section ?? null}>
<Head>
<title>{newTitle}</title>
</Head>
Expand Down
15 changes: 13 additions & 2 deletions pages/draft-07/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import DocTable from '~/components/DocTable';
import { Headline1 } from '~/components/Headlines';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';
import { Frontmatter } from '~/types/common';

export async function getStaticProps() {
const index = fs.readFileSync('pages/draft-07/index.md', 'utf-8');
Expand All @@ -25,12 +26,22 @@ export async function getStaticProps() {
};
}

interface DraftFrontmatter extends Frontmatter {
Specification?: string;
Published?: string;
Metaschema?: string;
Comment on lines +30 to +32
Copy link

Copilot AI Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type safety issues with DraftFrontmatter:

  1. The Specification, Published, and Metaschema properties are marked as optional, but the DocTable component (line 50) requires them to be non-null strings and accesses them without null checks.
  2. The authors property is inherited as authors?: Author[] from Frontmatter, but DocTable expects authors: string[].

Consider either:

  • Making Specification, Published, and Metaschema required (non-optional) in the interface
  • Adding authors?: string[]; to override the base type
    Or update the DocTable component to handle optional values properly.
Suggested change
Specification?: string;
Published?: string;
Metaschema?: string;
Specification: string;
Published: string;
Metaschema: string;
authors?: string[];

Copilot uses AI. Check for mistakes.
}

interface BlocksData {
index: string;
}

export default function ImplementationsPages({
blocks,
frontmatter,
}: {
blocks: any;
frontmatter: any;
blocks: BlocksData;
frontmatter: DraftFrontmatter;
}) {
const fileRenderType = 'indexmd';
return (
Expand Down
9 changes: 5 additions & 4 deletions pages/draft/2019-09/[slug].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@ import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import { Frontmatter } from '~/types/common';

export async function getStaticPaths() {
return getStaticMarkdownPaths('pages/draft/2019-09');
}
export async function getStaticProps(args: any) {
export async function getStaticProps(args: { params?: { slug: string } }) {
return getStaticMarkdownProps(args, 'pages/draft/2019-09');
}

export default function StaticMarkdownPage({
frontmatter,
content,
}: {
frontmatter: any;
content: any;
frontmatter: Frontmatter;
content: string;
}) {
const fileRenderType = '_md';
const newTitle = 'JSON Schema - ' + frontmatter.title;

return (
<SectionContext.Provider value={frontmatter.section || null}>
<SectionContext.Provider value={frontmatter.section ?? null}>
<Head>
<title>{newTitle}</title>
</Head>
Expand Down
Loading
Loading