go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/frontend/ui/App.tsx (about) 1 // Copyright 2022 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 import './styles/style.css'; 16 17 import * as React from 'react'; 18 import { 19 QueryClient, 20 QueryClientProvider, 21 } from 'react-query'; 22 import { 23 Route, 24 Routes, 25 } from 'react-router-dom'; 26 27 import FeedbackSnackbar from './src/components/error_snackbar/feedback_snackbar'; 28 import { SnackbarContextWrapper } from './src/context/snackbar_context'; 29 import BaseLayout from './src/layouts/base'; 30 import ClusterPage from './src/views/clusters/cluster/cluster_page'; 31 import ClustersPage from './src/views/clusters/clusters_page'; 32 import NotFoundPage from './src/views/errors/not_found_page'; 33 import HelpPage from './src/views/help/help_page'; 34 import HomePage from './src/views/home/home_page'; 35 import NewRulePage from './src/views/new_rule/new_rule'; 36 import Rule from './src/views/rule/rule'; 37 import RulesPage from './src/views/rules/rules_page'; 38 import BugPage from './src/views/bug/bug_page/bug_page'; 39 40 const queryClient = new QueryClient( 41 { 42 defaultOptions: { 43 queries: { 44 refetchOnWindowFocus: false, 45 }, 46 }, 47 }, 48 ); 49 50 const App = () => { 51 return ( 52 <SnackbarContextWrapper> 53 <QueryClientProvider client={queryClient}> 54 <Routes> 55 <Route path='/' element={<BaseLayout />}> 56 <Route index element={<HomePage />} /> 57 <Route path='help' element={<HelpPage />} /> 58 <Route path='b/:bugTracker/:id' element={<BugPage />} /> 59 <Route path='b/:id' element={<BugPage />} /> 60 <Route path='p/:project'> 61 <Route path='rules'> 62 <Route index element={<RulesPage />} /> 63 <Route path='new' element={<NewRulePage />} /> 64 <Route path=':id' element={<Rule />} /> 65 </Route> 66 <Route path='clusters'> 67 <Route index element={<ClustersPage />} /> 68 <Route path=':algorithm/:id' element={<ClusterPage />} /> 69 </Route> 70 </Route> 71 <Route path='*' element={<NotFoundPage />} /> 72 </Route> 73 </Routes> 74 </QueryClientProvider> 75 <FeedbackSnackbar /> 76 </SnackbarContextWrapper> 77 ); 78 }; 79 80 export default App;