Skip to content

Commit 09bdb32

Browse files
committed
Fix: remove duplicate welcome file and update content
1 parent 581923f commit 09bdb32

File tree

1 file changed

+9
-38
lines changed

1 file changed

+9
-38
lines changed

src/hooks/use-file-system.ts

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,51 +27,22 @@ export interface FileSystemContextType {
2727
downloadFile: (id: string) => void;
2828
}
2929

30-
const STORAGE_KEY = 'mathstudio-fs-v1';
31-
32-
const INITIAL_FILES: Record<string, FileNode> = {
33-
'root-welcome': {
34-
id: 'root-welcome',
35-
name: 'Welcome.md',
36-
type: 'file',
37-
parentId: null,
38-
content: `# MathStudio
39-
40-
## Features Demo
41-
42-
### 1. LaTeX Support
43-
Inline: $E = mc^2$
44-
45-
Block:
46-
$$
47-
\\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi}
48-
$$
49-
50-
### 2. Code Highlighting
51-
\`\`\`python
52-
def hello():
53-
print("Hello, World!")
54-
\`\`\`
55-
56-
### 3. Smart Layout
57-
- **Split View**: Edit and preview side-by-side.
58-
- **Mobile Friendly**: Works great on your phone.
59-
60-
### 4. Privacy
61-
- Files you create here are saved in your **browser's local storage**.
62-
- Visitors cannot see your private files, and you cannot see theirs.
63-
`,
64-
createdAt: Date.now(),
65-
},
66-
};
30+
const STORAGE_KEY = 'mathstudio-fs-v2';
31+
32+
const INITIAL_FILES: Record<string, FileNode> = {};
6733

6834
export function useFileSystem(initialPosts?: Record<string, FileNode>) {
6935
// Merge INITIAL_FILES with initialPosts
7036
const [files, setFiles] = useState<Record<string, FileNode>>(() => ({
7137
...INITIAL_FILES,
7238
...initialPosts,
7339
}));
74-
const [activeFileId, setActiveFileId] = useState<string | null>('root-welcome');
40+
const [activeFileId, setActiveFileId] = useState<string | null>(() => {
41+
if (initialPosts && Object.keys(initialPosts).length > 0) {
42+
return Object.keys(initialPosts)[0];
43+
}
44+
return null;
45+
});
7546
const [mounted, setMounted] = useState(false);
7647

7748
// Load from localStorage

0 commit comments

Comments
 (0)