aboutsummaryrefslogtreecommitdiffstats
path: root/packages/renderer/src/components/sidebar
diff options
context:
space:
mode:
Diffstat (limited to 'packages/renderer/src/components/sidebar')
-rw-r--r--packages/renderer/src/components/sidebar/ServiceSwitcher.tsx5
-rw-r--r--packages/renderer/src/components/sidebar/Sidebar.tsx19
-rw-r--r--packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx31
3 files changed, 39 insertions, 16 deletions
diff --git a/packages/renderer/src/components/sidebar/ServiceSwitcher.tsx b/packages/renderer/src/components/sidebar/ServiceSwitcher.tsx
index 3b47990..2241476 100644
--- a/packages/renderer/src/components/sidebar/ServiceSwitcher.tsx
+++ b/packages/renderer/src/components/sidebar/ServiceSwitcher.tsx
@@ -32,6 +32,7 @@ const ServiceSwitcherRoot = styled(Tabs, {
32 name: 'ServiceSwitcher', 32 name: 'ServiceSwitcher',
33 slot: 'Root', 33 slot: 'Root',
34})(({ theme }) => ({ 34})(({ theme }) => ({
35 // Move the indicator to the outer side of the window.
35 '.MuiTabs-indicator': { 36 '.MuiTabs-indicator': {
36 ...(theme.direction === 'ltr' 37 ...(theme.direction === 'ltr'
37 ? { 38 ? {
@@ -50,13 +51,15 @@ const ServiceSwitcherTab = styled(Tab, {
50 slot: 'Tab', 51 slot: 'Tab',
51})(({ theme }) => ({ 52})(({ theme }) => ({
52 minWidth: 0, 53 minWidth: 0,
54 paddingInlineStart: theme.spacing(2),
55 paddingInlineEnd: `calc(${theme.spacing(2)} - 1px)`,
53 transition: theme.transitions.create('background-color', { 56 transition: theme.transitions.create('background-color', {
54 duration: theme.transitions.duration.shortest, 57 duration: theme.transitions.duration.shortest,
55 }), 58 }),
56 '&.Mui-selected': { 59 '&.Mui-selected': {
57 backgroundColor: 60 backgroundColor:
58 theme.palette.mode === 'dark' 61 theme.palette.mode === 'dark'
59 ? alpha(theme.palette.text.primary, 0.12) 62 ? alpha(theme.palette.text.primary, 0.13)
60 : alpha(theme.palette.primary.light, 0.24), 63 : alpha(theme.palette.primary.light, 0.24),
61 }, 64 },
62})); 65}));
diff --git a/packages/renderer/src/components/sidebar/Sidebar.tsx b/packages/renderer/src/components/sidebar/Sidebar.tsx
index 80826ca..4f27d68 100644
--- a/packages/renderer/src/components/sidebar/Sidebar.tsx
+++ b/packages/renderer/src/components/sidebar/Sidebar.tsx
@@ -19,7 +19,6 @@
19 */ 19 */
20 20
21import Box from '@mui/material/Box'; 21import Box from '@mui/material/Box';
22import { alpha } from '@mui/material/styles';
23import React from 'react'; 22import React from 'react';
24 23
25import ServiceSwitcher from './ServiceSwitcher'; 24import ServiceSwitcher from './ServiceSwitcher';
@@ -36,21 +35,29 @@ export default function Sidebar(): JSX.Element {
36 flexDirection: 'column', 35 flexDirection: 'column',
37 alignItems: 'center', 36 alignItems: 'center',
38 paddingY: 1, 37 paddingY: 1,
38 paddingInlineStart: '1px',
39 gap: 1, 39 gap: 1,
40 background: alpha(theme.palette.text.primary, 0.09), 40 backgroundColor:
41 theme.palette.mode === 'dark'
42 ? 'rgba(255, 255, 255, 0.09)'
43 : 'rgba(0, 0, 0, 0.06)',
41 backgroundClip: 'padding-box', 44 backgroundClip: 'padding-box',
42 borderInlineEnd: `1px solid ${theme.palette.divider}`, 45 borderInlineEnd: `1px solid ${theme.palette.divider}`,
43 minWidth: 69, 46 minWidth: `calc(${theme.spacing(4)} + 36px)`,
44 })} 47 })}
45 > 48 >
46 <ToggleLocationBarButton /> 49 <ToggleLocationBarButton />
47 <ServiceSwitcher />
48 <Box 50 <Box
49 sx={{ 51 sx={{
50 flex: 1, 52 flex: 1,
51 WebkitAppRegion: 'drag', 53 display: 'flex',
54 flexDirection: 'column',
55 justifyContent: 'flex-start',
56 marginInlineStart: '-1px',
52 }} 57 }}
53 /> 58 >
59 <ServiceSwitcher />
60 </Box>
54 <ToggleDarkModeButton /> 61 <ToggleDarkModeButton />
55 </Box> 62 </Box>
56 ); 63 );
diff --git a/packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx b/packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx
index 7e20598..60033b0 100644
--- a/packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx
+++ b/packages/renderer/src/components/sidebar/ToggleLocationBarButton.tsx
@@ -20,12 +20,29 @@
20 20
21import IconChevronLeft from '@mui/icons-material/KeyboardDoubleArrowLeft'; 21import IconChevronLeft from '@mui/icons-material/KeyboardDoubleArrowLeft';
22import IconChevronRight from '@mui/icons-material/KeyboardDoubleArrowRight'; 22import IconChevronRight from '@mui/icons-material/KeyboardDoubleArrowRight';
23import { useTheme } from '@mui/material';
23import CircularProgress from '@mui/material/CircularProgress'; 24import CircularProgress from '@mui/material/CircularProgress';
24import IconButton from '@mui/material/IconButton'; 25import IconButton from '@mui/material/IconButton';
25import { observer } from 'mobx-react-lite'; 26import { observer } from 'mobx-react-lite';
26import React from 'react'; 27import React from 'react';
27 28
28import { useStore } from '../StoreProvider'; 29import { useStore } from '../StoreProvider';
30import { LOCATION_BAR_ID } from '../locationBar/LocationBar';
31
32function ToggleLocationBarIcon({
33 loading,
34 show,
35}: {
36 loading: boolean;
37 show: boolean;
38}): JSX.Element {
39 const { direction } = useTheme();
40 if (loading) {
41 return <CircularProgress color="inherit" size="1.5rem" />;
42 }
43 const left = direction === 'ltr' ? show : !show;
44 return left ? <IconChevronLeft /> : <IconChevronRight />;
45}
29 46
30function ToggleLocationBarButton(): JSX.Element { 47function ToggleLocationBarButton(): JSX.Element {
31 const store = useStore(); 48 const store = useStore();
@@ -33,21 +50,17 @@ function ToggleLocationBarButton(): JSX.Element {
33 settings: { selectedService, showLocationBar }, 50 settings: { selectedService, showLocationBar },
34 } = store; 51 } = store;
35 52
36 let icon: JSX.Element;
37 if (selectedService?.state === 'loading') {
38 icon = <CircularProgress color="inherit" size="1.5rem" />;
39 } else {
40 icon = showLocationBar ? <IconChevronLeft /> : <IconChevronRight />;
41 }
42
43 return ( 53 return (
44 <IconButton 54 <IconButton
45 aria-pressed={showLocationBar} 55 aria-pressed={showLocationBar}
46 aria-controls="locationBar" 56 aria-controls={LOCATION_BAR_ID}
47 aria-label="Show location bar" 57 aria-label="Show location bar"
48 onClick={() => store.toggleLocationBar()} 58 onClick={() => store.toggleLocationBar()}
49 > 59 >
50 {icon} 60 <ToggleLocationBarIcon
61 loading={selectedService?.state === 'loading'}
62 show={showLocationBar}
63 />
51 </IconButton> 64 </IconButton>
52 ); 65 );
53} 66}