MCPcopy Create free account
hub / github.com/enowdev/enowX-Coder / App

Function App

src/App.tsx:8–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import { generateId } from '@/lib/utils';
7
8function App() {
9 const addSession = useSessionStore((s) => s.addSession);
10 const setActiveSessionId = useSessionStore((s) => s.setActiveSessionId);
11 const activeProjectId = useProjectStore((s) => s.activeProjectId);
12 const theme = useUIStore((s) => s.theme);
13
14 // Apply theme class to document root
15 useEffect(() => {
16 const root = document.documentElement;
17 if (theme === 'light') {
18 root.classList.add('light');
19 } else {
20 root.classList.remove('light');
21 }
22 }, [theme]);
23
24 useEffect(() => {
25 const handleKeyDown = (e: KeyboardEvent) => {
26 if ((e.metaKey || e.ctrlKey) && e.key === 'n') {
27 e.preventDefault();
28 const session = {
29 id: generateId(),
30 projectId: activeProjectId ?? 'default',
31 title: 'New Chat',
32 createdAt: new Date().toISOString(),
33 updatedAt: new Date().toISOString(),
34 };
35 addSession(session);
36 setActiveSessionId(session.id);
37 }
38 };
39
40 window.addEventListener('keydown', handleKeyDown);
41 return () => window.removeEventListener('keydown', handleKeyDown);
42 }, [activeProjectId, addSession, setActiveSessionId]);
43
44 return <AppShell />;
45}
46
47export default App;

Callers

nothing calls this directly

Calls 1

removeMethod · 0.80

Tested by

no test coverage detected