Skip to content

Commit 50c3eed

Browse files
feat: move status details to dedicated route
1 parent 36c27e3 commit 50c3eed

File tree

4 files changed

+21
-38
lines changed

4 files changed

+21
-38
lines changed

src/pages/sidepanel/SidePanel.tsx

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,22 @@
11
import '@pages/sidepanel/SidePanel.css';
22

3-
import {
4-
useEffect,
5-
useState,
6-
} from 'react';
3+
import { useEffect, useState } from 'react';
74

8-
import {
9-
Route,
10-
Routes,
11-
useLocation,
12-
useNavigate,
13-
} from 'react-router-dom';
5+
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
146

15-
import {
16-
Box,
17-
CircularProgress,
18-
} from '@mui/material';
7+
import { Box, CircularProgress } from '@mui/material';
198
import BottomNavigation from '@root/src/pages/sidepanel/components/BottomNavigation';
209
import Configuration from '@root/src/pages/sidepanel/sections/Configuration';
2110
import Debugger from '@root/src/pages/sidepanel/sections/Debugger';
2211
import Personalization from '@root/src/pages/sidepanel/sections/Personalization';
2312
import Profile from '@root/src/pages/sidepanel/sections/Profile';
24-
import {
25-
TagConfigModel,
26-
TagConfigPathforaCandidates,
27-
} from '@root/src/shared/models/tagConfigModel';
13+
import { TagConfigModel, TagConfigPathforaCandidates } from '@root/src/shared/models/tagConfigModel';
2814
import { EmitLog } from '@src/shared/components/EmitLog';
2915
import entityStorage from '@src/shared/storages/entityStorage';
3016
import tagConfigStore from '@src/shared/storages/tagConfigStorage';
3117

18+
import TagStatus from './sections/TagStatus';
19+
3220
interface SidePanelProps {
3321
key: any;
3422
isEnabled: boolean;
@@ -215,12 +203,7 @@ const SidePanel: React.FC<SidePanelProps> = ({ key, isEnabled }) => {
215203
</Box>
216204
) : (
217205
<>
218-
<Box
219-
minHeight={`calc(100vh - 56px)`}
220-
justifyContent={'center'}
221-
alignItems={'flex-start'}
222-
display="flex"
223-
flexDirection="column">
206+
<Box justifyContent={'center'} alignItems={'flex-start'} display="flex" flexDirection="column">
224207
<Routes>
225208
<Route path="/settings" element={<Configuration />} />
226209
<Route
@@ -241,7 +224,7 @@ const SidePanel: React.FC<SidePanelProps> = ({ key, isEnabled }) => {
241224
}
242225
/>
243226
<Route
244-
path="*"
227+
path="/debug"
245228
element={
246229
<Debugger
247230
tagIsInstalled={tagIsInstalled}
@@ -251,12 +234,10 @@ const SidePanel: React.FC<SidePanelProps> = ({ key, isEnabled }) => {
251234
/>
252235
}
253236
/>
237+
<Route path="*" element={<TagStatus tagIsInstalled={tagIsInstalled} tagConfig={tagConfig} />} />
254238
</Routes>
255239
</Box>
256-
<BottomNavigation
257-
value={activePath}
258-
onChange={newValue => handleNavigation(newValue)}
259-
/>
240+
<BottomNavigation value={activePath} onChange={newValue => handleNavigation(newValue)} />
260241
</>
261242
)}
262243
</>

src/pages/sidepanel/components/BottomNavigation.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe('BottomNav', () => {
2828
it('renders all navigation sections', () => {
2929
renderWithTheme(<BottomNav {...defaultProps} />);
3030

31+
expect(screen.getByLabelText('Status')).toBeInTheDocument();
3132
expect(screen.getByLabelText('Debug')).toBeInTheDocument();
3233
expect(screen.getByLabelText('Profile')).toBeInTheDocument();
3334
expect(screen.getByLabelText('Personalization')).toBeInTheDocument();

src/pages/sidepanel/components/BottomNavigation.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { AutoFixHighOutlined, Person, PestControlOutlined } from '@mui/icons-material';
3+
import { AutoFixHighOutlined, MonitorHeart, Person, PestControlOutlined } from '@mui/icons-material';
44
import { BottomNavigation, BottomNavigationAction } from '@mui/material';
55
import { styled } from '@mui/material/styles';
66
import { appColors } from '@root/src/theme/palette';
@@ -49,6 +49,11 @@ const StyledBottomNavigationAction = styled(BottomNavigationAction)<{
4949
const navigationSections: NavigationSection[] = [
5050
{
5151
route: '/',
52+
icon: <MonitorHeart />,
53+
ariaLabel: 'Status',
54+
},
55+
{
56+
route: '/debug',
5257
icon: <PestControlOutlined />,
5358
ariaLabel: 'Debug',
5459
},

src/pages/sidepanel/sections/Debugger.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { Dispatch, SetStateAction } from 'react';
2+
23
import { Box, Stack, Tab, Tabs } from '@mui/material';
3-
import TagStatus from '@root/src/pages/sidepanel/sections/TagStatus';
4-
import TagConfig from '@root/src/pages/sidepanel/sections/TagConfig';
4+
import CustomTabPanel from '@root/src/pages/sidepanel/components/CustomTabPanel';
55
import TagActivity from '@root/src/pages/sidepanel/sections/TagActivity';
6+
import TagConfig from '@root/src/pages/sidepanel/sections/TagConfig';
67
import { TagConfigModel } from '@root/src/shared/models/tagConfigModel';
7-
import CustomTabPanel from '@root/src/pages/sidepanel/components/CustomTabPanel';
88

99
interface DebuggerProps {
1010
tagIsInstalled: boolean;
@@ -22,19 +22,15 @@ const Debugger: React.FC<DebuggerProps> = ({ tagIsInstalled, tagConfig, getter,
2222
<Stack alignItems={'flex-start'} justifyContent={'center'} height={'100%'} width={'100%'}>
2323
<Box borderBottom={1} borderColor={'divider'} width={'100%'}>
2424
<Tabs value={getter} onChange={handleSetTab} textColor="secondary" indicatorColor="secondary">
25-
<Tab id="status" label="Status" />
2625
<Tab id="configuration" disabled={!tagIsInstalled} label="Configuration" />
2726
<Tab id="activity" disabled={!tagIsInstalled} label="Activity" />
2827
</Tabs>
2928
</Box>
3029
<Box flexGrow={1} width={'100%'} overflow={'auto'}>
3130
<CustomTabPanel value={getter} index={0}>
32-
<TagStatus tagIsInstalled={tagIsInstalled} tagConfig={tagConfig} />
33-
</CustomTabPanel>
34-
<CustomTabPanel value={getter} index={1}>
3531
<TagConfig tagConfig={tagConfig} />
3632
</CustomTabPanel>
37-
<CustomTabPanel value={getter} index={2}>
33+
<CustomTabPanel value={getter} index={1}>
3834
<TagActivity />
3935
</CustomTabPanel>
4036
</Box>

0 commit comments

Comments
 (0)