diff options
Diffstat (limited to 'packages/renderer/src/components/ServiceSwitcher.tsx')
-rw-r--r-- | packages/renderer/src/components/ServiceSwitcher.tsx | 15 |
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'; | |||
22 | import Tabs from '@mui/material/Tabs'; | 22 | import Tabs from '@mui/material/Tabs'; |
23 | import { alpha, styled } from '@mui/material/styles'; | 23 | import { alpha, styled } from '@mui/material/styles'; |
24 | import { observer } from 'mobx-react-lite'; | 24 | import { observer } from 'mobx-react-lite'; |
25 | import React, { useState } from 'react'; | 25 | import React from 'react'; |
26 | 26 | ||
27 | import ServiceIcon from './ServiceIcon'; | 27 | import ServiceIcon from './ServiceIcon'; |
28 | import { useStore } from './StoreProvider'; | 28 | import { useStore } from './StoreProvider'; |
@@ -62,18 +62,17 @@ const ServiceSwitcherTab = styled(Tab, { | |||
62 | })); | 62 | })); |
63 | 63 | ||
64 | export default observer(() => { | 64 | export 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 |