[dyad] Fixing schema display build error - wrote 1 file(s)
This commit is contained in:
@@ -15,7 +15,8 @@ interface SchemaDisplayProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function SchemaDisplay({ schemas }: SchemaDisplayProps) {
|
export function SchemaDisplay({ schemas }: SchemaDisplayProps) {
|
||||||
const groupedSchemas = schemas.reduce((acc, schema) => {
|
const groupedSchemas = schemas.reduce(
|
||||||
|
(acc: Record<string, any[]>, schema: any) => {
|
||||||
const type = Array.isArray(schema["@type"])
|
const type = Array.isArray(schema["@type"])
|
||||||
? schema["@type"].join(", ")
|
? schema["@type"].join(", ")
|
||||||
: schema["@type"] || "Untyped";
|
: schema["@type"] || "Untyped";
|
||||||
@@ -24,7 +25,9 @@ export function SchemaDisplay({ schemas }: SchemaDisplayProps) {
|
|||||||
}
|
}
|
||||||
acc[type].push(schema);
|
acc[type].push(schema);
|
||||||
return acc;
|
return acc;
|
||||||
}, {} as Record<string, any[]>);
|
},
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
const SchemaContent = ({ schema }: { schema: any }) => {
|
const SchemaContent = ({ schema }: { schema: any }) => {
|
||||||
const schemaJson = JSON.stringify(schema, null, 2);
|
const schemaJson = JSON.stringify(schema, null, 2);
|
||||||
@@ -55,7 +58,7 @@ export function SchemaDisplay({ schemas }: SchemaDisplayProps) {
|
|||||||
</div>
|
</div>
|
||||||
<Accordion type="multiple" className="w-full space-y-4">
|
<Accordion type="multiple" className="w-full space-y-4">
|
||||||
{Object.entries(groupedSchemas).map(
|
{Object.entries(groupedSchemas).map(
|
||||||
([type, schemaGroup], groupIndex) => (
|
([type, schemaGroup]: [string, any[]], groupIndex: number) => (
|
||||||
<AccordionItem
|
<AccordionItem
|
||||||
value={`group-${type}-${groupIndex}`}
|
value={`group-${type}-${groupIndex}`}
|
||||||
key={groupIndex}
|
key={groupIndex}
|
||||||
@@ -74,7 +77,7 @@ export function SchemaDisplay({ schemas }: SchemaDisplayProps) {
|
|||||||
type="multiple"
|
type="multiple"
|
||||||
className="w-full space-y-2"
|
className="w-full space-y-2"
|
||||||
>
|
>
|
||||||
{schemaGroup.map((schema, schemaIndex) => (
|
{schemaGroup.map((schema: any, schemaIndex: number) => (
|
||||||
<AccordionItem
|
<AccordionItem
|
||||||
value={`schema-${groupIndex}-${schemaIndex}`}
|
value={`schema-${groupIndex}-${schemaIndex}`}
|
||||||
key={schemaIndex}
|
key={schemaIndex}
|
||||||
|
|||||||
Reference in New Issue
Block a user