-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzdump.txt
43 lines (36 loc) · 979 Bytes
/
zdump.txt
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
import Content from "./layout/Content";
import Sidebar from "./layout/Sidebar";
import { NotesProvider } from "./context";
import { useState } from "react";
function App(): JSX.Element {
const [isNewWindow, setIsNewWindow] = useState(false);
window.electron.ipcRenderer.on("allWindows", (_, allWindows) => {
if (allWindows !== 1) {
setIsNewWindow(true);
}
});
if (isNewWindow) {
return <Content isNewWindow />;
}
return (
<NotesProvider>
<div className="h-full flex border-opacity-30">
<Sidebar className="w-1/4 " />
<Content isNewWindow={false} />
</div>
</NotesProvider>
);
}
export default App;
let selectedNote: Note | null = null;
if (props.isNewWindow && state.newWindowNote) {
selectedNote = state.newWindowNote;
setState((prev) => ({
...prev,
newWindowNote: null
}));
} else {
selectedNote =
state.notes.find((note) => note.id === state.selectedNoteId) ||
({} as Note);
}