Skip to content

Commit bb4d2f6

Browse files
committed
remove json file
1 parent bf11c9f commit bb4d2f6

File tree

2 files changed

+121
-119
lines changed

2 files changed

+121
-119
lines changed

sites/preview/src/routes/+page.svelte

Lines changed: 121 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,139 @@
1111
Tree,
1212
TreeItem,
1313
TreeItemInput,
14-
type FileTreeNode,
1514
type MoveErrorArgs,
1615
type NameConflictArgs,
1716
type NameConflictResolution,
1817
type RenameErrorArgs,
1918
} from "svelte-file-tree";
2019
import { toast } from "svelte-sonner";
2120
import { fade, fly } from "svelte/transition";
22-
import data from "./data.json" with { type: "json" };
2321
import { DialogState } from "./state.svelte.js";
2422
2523
const tree = new FileTree({
26-
children: (tree) =>
27-
data.map(function transform(item): FileTreeNode {
28-
if (item.children === undefined) {
29-
return new FileNode({
24+
children: (tree) => [
25+
new FolderNode({
26+
tree,
27+
id: "0",
28+
name: "Documents",
29+
children: [
30+
new FolderNode({
3031
tree,
31-
id: item.id,
32-
name: item.name,
33-
});
34-
}
35-
36-
return new FolderNode({
37-
tree,
38-
id: item.id,
39-
name: item.name,
40-
children: item.children.map(transform),
41-
});
32+
id: "1",
33+
name: "Work",
34+
children: [
35+
new FolderNode({
36+
tree,
37+
id: "2",
38+
name: "Projects",
39+
children: [
40+
new FileNode({
41+
tree,
42+
id: "3",
43+
name: "project_a.md",
44+
}),
45+
new FileNode({
46+
tree,
47+
id: "4",
48+
name: "project_b.md",
49+
}),
50+
],
51+
}),
52+
new FileNode({
53+
tree,
54+
id: "5",
55+
name: "q4_report.docx",
56+
}),
57+
new FolderNode({
58+
tree,
59+
id: "6",
60+
name: "Meetings",
61+
children: [
62+
new FileNode({
63+
tree,
64+
id: "7",
65+
name: "meeting_minutes.txt",
66+
}),
67+
new FileNode({
68+
tree,
69+
id: "8",
70+
name: "schedule.pdf",
71+
}),
72+
],
73+
}),
74+
],
75+
}),
76+
new FolderNode({
77+
tree,
78+
id: "9",
79+
name: "Personal",
80+
children: [
81+
new FolderNode({
82+
tree,
83+
id: "10",
84+
name: "Recipes",
85+
children: [
86+
new FileNode({
87+
tree,
88+
id: "11",
89+
name: "pasta.txt",
90+
}),
91+
new FileNode({
92+
tree,
93+
id: "12",
94+
name: "cookies.txt",
95+
}),
96+
],
97+
}),
98+
new FileNode({
99+
tree,
100+
id: "13",
101+
name: "taxes_2023.pdf",
102+
}),
103+
],
104+
}),
105+
new FileNode({
106+
tree,
107+
id: "14",
108+
name: "resume.pdf",
109+
}),
110+
],
111+
}),
112+
new FolderNode({
113+
tree,
114+
id: "15",
115+
name: "Pictures",
116+
children: [
117+
new FolderNode({
118+
tree,
119+
id: "16",
120+
name: "Vacation",
121+
children: [
122+
new FileNode({
123+
tree,
124+
id: "17",
125+
name: "beach.jpg",
126+
}),
127+
new FileNode({
128+
tree,
129+
id: "18",
130+
name: "mountain.jpg",
131+
}),
132+
],
133+
}),
134+
new FileNode({
135+
tree,
136+
id: "19",
137+
name: "profile.jpg",
138+
}),
139+
],
140+
}),
141+
new FileNode({
142+
tree,
143+
id: "20",
144+
name: "notes.txt",
42145
}),
146+
],
43147
});
44148
45149
const dialog = new DialogState<

sites/preview/src/routes/data.json

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)