import { isDataset, isDatatype } from '@h5web/shared'; import type { ProvidedEntity } from '@h5web/shared'; import { useDataContext } from '../providers/DataProvider'; import styles from './MetadataViewer.module.css'; import RawInspector from './RawInspector'; import { renderType, renderShape } from './utils'; interface Props { entity: ProvidedEntity; fileIndex:number } function EntityInfo(props: Props) { const { entity,fileIndex } = props; const { name, path } = entity; const { filepath,fileExt } = useDataContext(); const isRoot = path === '/'; return ( <> Path {path} {isRoot ? 'File path' : 'Name'} {isRoot ? filepath.replace('.heps',fileExt) : name} {(isDataset(entity) || isDatatype(entity)) && ( Type {renderType(entity.type)} )} {isDataset(entity) && ( Shape {renderShape(entity.shape)} )} {isDataset(entity) && entity.chunks && ( Chunk shape {renderShape(entity.chunks)} )} {entity.link?.path && ( {entity.link.class} link {entity.link.file && `${entity.link.file}:`} {entity.link.path} )} Raw ); } export default EntityInfo;