diff --git a/docs/next-js/components/loading/MetaNetCDFButtons.tsx b/docs/next-js/components/loading/MetaNetCDFButtons.tsx index 7443ee5..21d03ba 100644 --- a/docs/next-js/components/loading/MetaNetCDFButtons.tsx +++ b/docs/next-js/components/loading/MetaNetCDFButtons.tsx @@ -1,5 +1,6 @@ 'use client'; +import React from 'react'; import { Button } from '@/components/ui/button'; import { ButtonGroup } from '@/components/ui/button-group'; import { @@ -18,35 +19,69 @@ type Props = { metadata: Record[]; }; -function ObjectViewer({ data }: { data: Record }) { +function ObjectViewer({ + data, + defaultAttributes = [] +}: { + data: Record; + defaultAttributes?: string[]; +}) { + const keys = Object.keys(data); + if (keys.length === 0) return null; + + // Order default attributes first (if provided) + const orderedKeys = [ + ...defaultAttributes.filter((key) => key in data), + ...keys.filter((key) => !defaultAttributes.includes(key)), + ]; + return ( -
- {Object.entries(data).map(([key, value]) => ( -
- {key} - - {typeof value === 'object' - ? JSON.stringify(value, (_key, val) => - typeof val === 'bigint' ? parseInt(val.toString()) : val) - : String(value) - } - -
- ))} +
+ {orderedKeys.map((key) => { + const value = data[key]; + const isDefault = defaultAttributes.includes(key); + + return ( + +
+ {key}: +
+
+ {typeof value === 'object' + ? JSON.stringify(value, (_key, val) => + typeof val === 'bigint' ? parseInt(val.toString()) : val + ) + : String(value)} +
+
+ ); + })}
); } -function ArrayViewer({ data }: { data: Record[] }) { +function ArrayViewer({ + data, + defaultAttributes = [] +}: { + data: Record[]; + defaultAttributes?: string[]; +}) { return (
{data.map((item, index) => (
- Item {index + 1} - +
))}