-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(frontend): first part of migration to typescript (#307)
- Loading branch information
Showing
29 changed files
with
1,313 additions
and
1,093 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React from 'react'; | ||
import { BrowserRouter, Route, Routes } from 'react-router-dom'; | ||
import { Box, CircularProgress, createTheme, lighten, ThemeOptions, ThemeProvider } from '@mui/material'; | ||
|
||
import RecentTasks from './Components/RecentTasks'; | ||
import HistoryTasks from './Components/HistoryTasks'; | ||
import Layout from './Layout'; | ||
import Page404 from './Page404'; | ||
import { ErrorProvider } from './ErrorContext'; | ||
import TaskView from './Components/TaskView'; | ||
import { AuthContext, useAuth } from './Services/Auth'; | ||
import { DeployLockProvider } from './Services/DeployLockHandler'; | ||
|
||
const theme = createTheme({ | ||
palette: { | ||
primary: { | ||
main: '#2E3B55', | ||
}, | ||
neutral: { | ||
main: 'gray', | ||
}, | ||
reason_color: { | ||
main: lighten('#ff9800', 0.5), | ||
}, | ||
}, | ||
components: { | ||
MuiTableCell: { | ||
styleOverrides: { | ||
root: { | ||
padding: '12px', | ||
}, | ||
}, | ||
}, | ||
}, | ||
} as ThemeOptions); | ||
|
||
const App: React.FC = () => { | ||
const auth = useAuth(); | ||
|
||
if (auth.authenticated === null) { | ||
return ( | ||
<Box display="flex" justifyContent="center" alignItems="center" height="100vh"> | ||
<CircularProgress /> | ||
</Box> | ||
); | ||
} | ||
|
||
if (auth.authenticated) { | ||
return ( | ||
<AuthContext.Provider value={auth}> | ||
<ThemeProvider theme={theme}> | ||
<ErrorProvider> | ||
<DeployLockProvider> | ||
<BrowserRouter> | ||
<Routes> | ||
<Route path="/" element={<Layout />}> | ||
<Route index element={<RecentTasks />} /> | ||
<Route path="/history" element={<HistoryTasks />} /> | ||
<Route path="/task/:id" element={<TaskView />} /> | ||
</Route> | ||
<Route path="*" element={<Page404 />} /> | ||
</Routes> | ||
</BrowserRouter> | ||
</DeployLockProvider> | ||
</ErrorProvider> | ||
</ThemeProvider> | ||
</AuthContext.Provider> | ||
); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.