diff options
Diffstat (limited to 'packages/renderer/src/components/locationBar/NavigationButtons.tsx')
-rw-r--r-- | packages/renderer/src/components/locationBar/NavigationButtons.tsx | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/packages/renderer/src/components/locationBar/NavigationButtons.tsx b/packages/renderer/src/components/locationBar/NavigationButtons.tsx index 9c4ebdb..96e40e7 100644 --- a/packages/renderer/src/components/locationBar/NavigationButtons.tsx +++ b/packages/renderer/src/components/locationBar/NavigationButtons.tsx | |||
@@ -32,11 +32,7 @@ import { useTranslation } from 'react-i18next'; | |||
32 | 32 | ||
33 | import type Service from '../../stores/Service'; | 33 | import type Service from '../../stores/Service'; |
34 | 34 | ||
35 | function NavigationButtons({ | 35 | function NavigationButtons({ service }: { service: Service }): JSX.Element { |
36 | service, | ||
37 | }: { | ||
38 | service: Service | undefined; | ||
39 | }): JSX.Element { | ||
40 | const { t } = useTranslation(undefined, { | 36 | const { t } = useTranslation(undefined, { |
41 | keyPrefix: 'toolbar', | 37 | keyPrefix: 'toolbar', |
42 | }); | 38 | }); |
@@ -46,36 +42,31 @@ function NavigationButtons({ | |||
46 | <Box display="flex"> | 42 | <Box display="flex"> |
47 | <IconButton | 43 | <IconButton |
48 | aria-label={t('back')} | 44 | aria-label={t('back')} |
49 | disabled={service === undefined || !service.canGoBack} | 45 | disabled={!service.canGoBack} |
50 | onClick={() => service?.goBack()} | 46 | onClick={() => service.goBack()} |
51 | > | 47 | > |
52 | {direction === 'ltr' ? <IconArrowBack /> : <IconArrowForward />} | 48 | {direction === 'ltr' ? <IconArrowBack /> : <IconArrowForward />} |
53 | </IconButton> | 49 | </IconButton> |
54 | <IconButton | 50 | <IconButton |
55 | aria-label={t('forward')} | 51 | aria-label={t('forward')} |
56 | disabled={service === undefined || !service.canGoForward} | 52 | disabled={!service.canGoForward} |
57 | onClick={() => service?.goForward()} | 53 | onClick={() => service.goForward()} |
58 | > | 54 | > |
59 | {direction === 'ltr' ? <IconArrowForward /> : <IconArrowBack />} | 55 | {direction === 'ltr' ? <IconArrowForward /> : <IconArrowBack />} |
60 | </IconButton> | 56 | </IconButton> |
61 | {service?.loading ?? false ? ( | 57 | {service.loading ? ( |
62 | <IconButton aria-label={t('stop')} onClick={() => service?.stop()}> | 58 | <IconButton aria-label={t('stop')} onClick={() => service.stop()}> |
63 | <IconStop /> | 59 | <IconStop /> |
64 | </IconButton> | 60 | </IconButton> |
65 | ) : ( | 61 | ) : ( |
66 | <IconButton | 62 | <IconButton |
67 | aria-label={t('reload')} | 63 | aria-label={t('reload')} |
68 | disabled={service === undefined} | 64 | onClick={(event) => service.reload(event.shiftKey)} |
69 | onClick={(event) => service?.reload(event.shiftKey)} | ||
70 | > | 65 | > |
71 | <IconRefresh /> | 66 | <IconRefresh /> |
72 | </IconButton> | 67 | </IconButton> |
73 | )} | 68 | )} |
74 | <IconButton | 69 | <IconButton aria-label={t('home')} onClick={() => service.goHome()}> |
75 | aria-label={t('home')} | ||
76 | disabled={service === undefined} | ||
77 | onClick={() => service?.goHome()} | ||
78 | > | ||
79 | <IconHome /> | 70 | <IconHome /> |
80 | </IconButton> | 71 | </IconButton> |
81 | </Box> | 72 | </Box> |