-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathApp.tsx
More file actions
47 lines (38 loc) · 1.27 KB
/
Copy pathApp.tsx
File metadata and controls
47 lines (38 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* MD2PPT-Evolution
* Copyright (c) 2026 EricHuang
* Licensed under the MIT License.
* See LICENSE file in the project root for full license information.
*/
import React, { useState, useEffect } from 'react';
import MarkdownEditor from './components/MarkdownEditor';
import { AudiencePage } from './components/presenter/AudiencePage';
import { PresenterPage } from './components/presenter/PresenterPage';
import { MobileRemote } from './components/presenter/MobileRemote';
const App: React.FC = () => {
const [route, setRoute] = useState(window.location.hash);
useEffect(() => {
const handleHashChange = () => setRoute(window.location.hash);
window.addEventListener('hashchange', handleHashChange);
return () => window.removeEventListener('hashchange', handleHashChange);
}, []);
// Handle Hash Parameters (e.g. #/remote?peer=...)
const currentPath = route.split('?')[0];
if (currentPath === '#/audience') {
return <AudiencePage />;
}
if (currentPath === '#/presenter') {
return <PresenterPage />;
}
if (currentPath === '#/remote') {
return <MobileRemote />;
}
return (
<div className="min-h-screen flex flex-col">
<main className="flex-grow">
<MarkdownEditor />
</main>
</div>
);
};
export default App;