-
Notifications
You must be signed in to change notification settings - Fork 967
Expand file tree
/
Copy pathApp.tsx
More file actions
103 lines (85 loc) · 2.65 KB
/
App.tsx
File metadata and controls
103 lines (85 loc) · 2.65 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import React, { useEffect } from "react"
import { ipcRenderer } from "electron"
import { HashRouter as Router, Route, Routes } from "react-router-dom"
import styled from "styled-components"
import SideBar from "./components/SideBar"
import Footer from "./components/Footer"
import RootContextProvider from "./contexts"
import RootModals from "./RootModals"
import Home from "./pages/home"
import Timeline from "./pages/timeline"
import Subscriptions from "./pages/state/Subscriptions"
import Snapshots from "./pages/state/Snapshots"
import Overlay from "./pages/reactNative/Overlay"
import Storybook from "./pages/reactNative/Storybook"
import CustomCommands from "./pages/customCommands"
import Help from "./pages/help"
import Preferences from "./pages/preferences"
const AppContainer = styled.div`
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
background-color: ${(props) => props.theme.background};
`
const TopSection = styled.div`
overflow: hidden;
display: flex;
flex-grow: 1;
flex-direction: row;
`
const MainContainer = styled.div`
display: flex;
flex-direction: row;
flex: 1;
`
function useOpenPreferences() {
useEffect(() => {
ipcRenderer.on("open-preferences", () => {
window.location.hash = "#/preferences"
})
return () => {
ipcRenderer.removeAllListeners("open-preferences")
}
}, [])
}
function App() {
useOpenPreferences()
return (
<Router>
<RootContextProvider>
<AppContainer>
<TopSection>
<SideBar />
<MainContainer>
<Routes>
{/* Home */}
<Route path="/home" element={<Home />} />
{/* Timeline */}
<Route path="/" element={<Timeline />} />
{/* State */}
<Route path="/state/subscriptions" element={<Subscriptions />} />
<Route path="/state/snapshots" element={<Snapshots />} />
{/* React Native */}
<Route path="/native/overlay" element={<Overlay />} />
<Route path="/native/storybook" element={<Storybook />} />
{/* Custom Commands */}
<Route path="/customCommands" element={<CustomCommands />} />
{/* Preferences */}
<Route path="/preferences" element={<Preferences />} />
{/* Help */}
<Route path="/help" element={<Help />} />
</Routes>
</MainContainer>
</TopSection>
<Footer />
</AppContainer>
<RootModals />
</RootContextProvider>
</Router>
)
}
export default App