diff options
Diffstat (limited to 'packages/renderer/src/components/locationBar/LocationBar.tsx')
-rw-r--r-- | packages/renderer/src/components/locationBar/LocationBar.tsx | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/packages/renderer/src/components/locationBar/LocationBar.tsx b/packages/renderer/src/components/locationBar/LocationBar.tsx index 54ead8e..c290722 100644 --- a/packages/renderer/src/components/locationBar/LocationBar.tsx +++ b/packages/renderer/src/components/locationBar/LocationBar.tsx | |||
@@ -22,13 +22,16 @@ import { styled } from '@mui/material/styles'; | |||
22 | import { observer } from 'mobx-react-lite'; | 22 | import { observer } from 'mobx-react-lite'; |
23 | import React from 'react'; | 23 | import React from 'react'; |
24 | 24 | ||
25 | import type Service from '../../stores/Service'; | ||
25 | import { useStore } from '../StoreProvider'; | 26 | import { useStore } from '../StoreProvider'; |
26 | 27 | ||
27 | import ExtraButtons from './ExtraButtons'; | 28 | import ExtraButtons from './ExtraButtons'; |
28 | import LocationTextField from './LocationTextField'; | 29 | import LocationTextField from './LocationTextField'; |
29 | import NavigationButtons from './NavigationButtons'; | 30 | import NavigationButtons from './NavigationButtons'; |
30 | 31 | ||
31 | export const LOCATION_BAR_ID = 'Sophie-LocationBar'; | 32 | export function getLocaltionBarID(service: Service): string { |
33 | return `Sophie-${service.id}-LocationBar`; | ||
34 | } | ||
32 | 35 | ||
33 | const LocationBarRoot = styled('header', { | 36 | const LocationBarRoot = styled('header', { |
34 | name: 'LocationBar', | 37 | name: 'LocationBar', |
@@ -41,17 +44,22 @@ const LocationBarRoot = styled('header', { | |||
41 | borderBottom: `1px solid ${theme.palette.divider}`, | 44 | borderBottom: `1px solid ${theme.palette.divider}`, |
42 | })); | 45 | })); |
43 | 46 | ||
44 | function LocationBar(): JSX.Element { | 47 | function LocationBar({ service }: { service: Service }): JSX.Element { |
45 | const { | 48 | const { |
46 | shared: { locationBarVisible }, | 49 | settings: { showLocationBar }, |
47 | settings: { selectedService }, | ||
48 | } = useStore(); | 50 | } = useStore(); |
49 | 51 | ||
52 | const { alwaysShowLocationBar } = service; | ||
53 | const locationBarVisible = showLocationBar || alwaysShowLocationBar; | ||
54 | |||
50 | return ( | 55 | return ( |
51 | <LocationBarRoot id={LOCATION_BAR_ID} hidden={!locationBarVisible}> | 56 | <LocationBarRoot |
52 | <NavigationButtons service={selectedService} /> | 57 | id={getLocaltionBarID(service)} |
53 | <LocationTextField service={selectedService} /> | 58 | hidden={!locationBarVisible} |
54 | <ExtraButtons service={selectedService} /> | 59 | > |
60 | <NavigationButtons service={service} /> | ||
61 | <LocationTextField service={service} /> | ||
62 | <ExtraButtons service={service} /> | ||
55 | </LocationBarRoot> | 63 | </LocationBarRoot> |
56 | ); | 64 | ); |
57 | } | 65 | } |