diff options
Diffstat (limited to 'subprojects/frontend/src/TopBar.tsx')
-rw-r--r-- | subprojects/frontend/src/TopBar.tsx | 85 |
1 files changed, 41 insertions, 44 deletions
diff --git a/subprojects/frontend/src/TopBar.tsx b/subprojects/frontend/src/TopBar.tsx index f2542b14..867a24a0 100644 --- a/subprojects/frontend/src/TopBar.tsx +++ b/subprojects/frontend/src/TopBar.tsx | |||
@@ -6,7 +6,6 @@ | |||
6 | 6 | ||
7 | import GitHubIcon from '@mui/icons-material/GitHub'; | 7 | import GitHubIcon from '@mui/icons-material/GitHub'; |
8 | import AppBar from '@mui/material/AppBar'; | 8 | import AppBar from '@mui/material/AppBar'; |
9 | import Button from '@mui/material/Button'; | ||
10 | import IconButton from '@mui/material/IconButton'; | 9 | import IconButton from '@mui/material/IconButton'; |
11 | import Stack from '@mui/material/Stack'; | 10 | import Stack from '@mui/material/Stack'; |
12 | import Toolbar from '@mui/material/Toolbar'; | 11 | import Toolbar from '@mui/material/Toolbar'; |
@@ -17,6 +16,7 @@ import { throttle } from 'lodash-es'; | |||
17 | import { observer } from 'mobx-react-lite'; | 16 | import { observer } from 'mobx-react-lite'; |
18 | import { useEffect, useMemo, useState } from 'react'; | 17 | import { useEffect, useMemo, useState } from 'react'; |
19 | 18 | ||
19 | import PaneButtons from './PaneButtons'; | ||
20 | import { useRootStore } from './RootStoreProvider'; | 20 | import { useRootStore } from './RootStoreProvider'; |
21 | import ToggleDarkModeButton from './ToggleDarkModeButton'; | 21 | import ToggleDarkModeButton from './ToggleDarkModeButton'; |
22 | import GenerateButton from './editor/GenerateButton'; | 22 | import GenerateButton from './editor/GenerateButton'; |
@@ -65,11 +65,12 @@ const DevModeBadge = styled('div')(({ theme }) => ({ | |||
65 | })); | 65 | })); |
66 | 66 | ||
67 | export default observer(function TopBar(): JSX.Element { | 67 | export default observer(function TopBar(): JSX.Element { |
68 | const { editorStore } = useRootStore(); | 68 | const { editorStore, themeStore } = useRootStore(); |
69 | const overlayVisible = useWindowControlsOverlayVisible(); | 69 | const overlayVisible = useWindowControlsOverlayVisible(); |
70 | const { breakpoints } = useTheme(); | 70 | const { breakpoints } = useTheme(); |
71 | const small = useMediaQuery(breakpoints.down('sm')); | 71 | const medium = useMediaQuery(breakpoints.up('sm')); |
72 | const large = useMediaQuery(breakpoints.up('md')); | 72 | const large = useMediaQuery(breakpoints.up('md')); |
73 | const veryLarge = useMediaQuery(breakpoints.up('lg')); | ||
73 | 74 | ||
74 | return ( | 75 | return ( |
75 | <AppBar | 76 | <AppBar |
@@ -100,50 +101,46 @@ export default observer(function TopBar(): JSX.Element { | |||
100 | py: 0.5, | 101 | py: 0.5, |
101 | }} | 102 | }} |
102 | > | 103 | > |
103 | <Typography variant="h6" component="h1" flexGrow={1}> | 104 | <Typography variant="h6" component="h1"> |
104 | Refinery {import.meta.env.DEV && <DevModeBadge>Dev</DevModeBadge>} | 105 | Refinery {import.meta.env.DEV && <DevModeBadge>Dev</DevModeBadge>} |
105 | </Typography> | 106 | </Typography> |
106 | <Stack direction="row" marginRight={1}> | 107 | <Stack direction="row" alignItems="center" flexGrow={1} marginLeft={1}> |
107 | <GenerateButton editorStore={editorStore} hideWarnings={small} /> | 108 | {medium && !large && ( |
109 | <PaneButtons themeStore={themeStore} hideLabel /> | ||
110 | )} | ||
111 | </Stack> | ||
112 | {large && ( | ||
113 | <Stack | ||
114 | direction="row" | ||
115 | alignItems="center" | ||
116 | sx={{ | ||
117 | position: 'absolute', | ||
118 | top: 0, | ||
119 | bottom: 0, | ||
120 | left: '50%', | ||
121 | transform: 'translateX(-50%)', | ||
122 | }} | ||
123 | > | ||
124 | <PaneButtons themeStore={themeStore} /> | ||
125 | </Stack> | ||
126 | )} | ||
127 | <Stack | ||
128 | direction="row" | ||
129 | marginLeft={1} | ||
130 | marginRight={1} | ||
131 | gap={1} | ||
132 | alignItems="center" | ||
133 | > | ||
134 | <GenerateButton editorStore={editorStore} hideWarnings={!veryLarge} /> | ||
108 | {large && ( | 135 | {large && ( |
109 | <> | 136 | <IconButton |
110 | <Button | 137 | aria-label="GitHub" |
111 | arial-label="Budapest University of Technology and Economics, Critical Systems Research Group" | 138 | href="https://github.com/graphs4value/refinery" |
112 | className="rounded" | 139 | target="_blank" |
113 | color="inherit" | 140 | color="inherit" |
114 | href="https://ftsrg.mit.bme.hu" | 141 | > |
115 | target="_blank" | 142 | <GitHubIcon /> |
116 | sx={{ marginLeft: 1 }} | 143 | </IconButton> |
117 | > | ||
118 | BME FTSRG | ||
119 | </Button> | ||
120 | <Button | ||
121 | aria-label="McGill University, Department of Electrical and Computer Engineering" | ||
122 | className="rounded" | ||
123 | color="inherit" | ||
124 | href="https://www.mcgill.ca/ece/daniel-varro" | ||
125 | target="_blank" | ||
126 | > | ||
127 | McGill ECE | ||
128 | </Button> | ||
129 | <Button | ||
130 | aria-label="2022 Amazon Research Awards recipent" | ||
131 | className="rounded" | ||
132 | color="inherit" | ||
133 | href="https://www.amazon.science/research-awards/recipients/daniel-varro-fall-2021" | ||
134 | target="_blank" | ||
135 | > | ||
136 | Amazon Science | ||
137 | </Button> | ||
138 | <IconButton | ||
139 | aria-label="GitHub" | ||
140 | href="https://github.com/graphs4value/refinery" | ||
141 | target="_blank" | ||
142 | color="inherit" | ||
143 | > | ||
144 | <GitHubIcon /> | ||
145 | </IconButton> | ||
146 | </> | ||
147 | )} | 144 | )} |
148 | </Stack> | 145 | </Stack> |
149 | <ToggleDarkModeButton /> | 146 | <ToggleDarkModeButton /> |