aboutsummaryrefslogtreecommitdiffstats
path: root/packages/renderer/src/components/ServiceSwitcher.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/renderer/src/components/ServiceSwitcher.tsx')
-rw-r--r--packages/renderer/src/components/ServiceSwitcher.tsx15
1 files changed, 7 insertions, 8 deletions
diff --git a/packages/renderer/src/components/ServiceSwitcher.tsx b/packages/renderer/src/components/ServiceSwitcher.tsx
index b454451..0786b71 100644
--- a/packages/renderer/src/components/ServiceSwitcher.tsx
+++ b/packages/renderer/src/components/ServiceSwitcher.tsx
@@ -22,7 +22,7 @@ import Tab from '@mui/material/Tab';
22import Tabs from '@mui/material/Tabs'; 22import Tabs from '@mui/material/Tabs';
23import { alpha, styled } from '@mui/material/styles'; 23import { alpha, styled } from '@mui/material/styles';
24import { observer } from 'mobx-react-lite'; 24import { observer } from 'mobx-react-lite';
25import React, { useState } from 'react'; 25import React from 'react';
26 26
27import ServiceIcon from './ServiceIcon'; 27import ServiceIcon from './ServiceIcon';
28import { useStore } from './StoreProvider'; 28import { useStore } from './StoreProvider';
@@ -62,18 +62,17 @@ const ServiceSwitcherTab = styled(Tab, {
62})); 62}));
63 63
64export default observer(() => { 64export default observer(() => {
65 const { services } = useStore(); 65 const store = useStore();
66 // TODO Move this to the `SharedStore`. 66 const { selectedService, services } = store;
67 const [selectedService, setSelectedService] = useState<string | boolean>(
68 false,
69 );
70 67
71 return ( 68 return (
72 <ServiceSwitcherRoot 69 <ServiceSwitcherRoot
73 variant="scrollable" 70 variant="scrollable"
74 orientation="vertical" 71 orientation="vertical"
75 value={selectedService} 72 value={selectedService === undefined ? false : selectedService.id}
76 onChange={(_event, newValue: string) => setSelectedService(newValue)} 73 onChange={(_event, newValue: string) =>
74 store.setSelectedServiceId(newValue)
75 }
77 > 76 >
78 {services.map((service) => ( 77 {services.map((service) => (
79 <ServiceSwitcherTab 78 <ServiceSwitcherTab