35 lines
748 B
TypeScript
Raw Normal View History

2025-02-22 05:56:30 -05:00
import React from 'react';
import Tree from 'components/Tree';
import rawData from '../data.json';
interface TreeNodeData {
name: string;
type: string;
path: string;
subfolders: number;
size: number;
files: number;
children?: TreeNodeData[];
}
const addFilesToData = (data: any): TreeNodeData[] => {
return data.map((node: any) => {
const files = 1; // Assuming each folder has 1 file
return {
...node,
files: files,
children: node.children ? addFilesToData(node.children) : [],
};
});
};
const data = addFilesToData(rawData);
2025-02-22 02:05:17 -05:00
export default function Index() {
return (
2025-02-22 05:56:30 -05:00
<div style={{ width: '100vw', height: '100vh', backgroundColor: "#222" }}>
<Tree data={data} />
</div>
);
2025-02-22 02:05:17 -05:00
}