aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/TopBar.tsx
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-08-30 19:07:05 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-08-30 19:07:05 +0200
commite41e0391ba843b85a5b2890db95121fa39426a05 (patch)
tree4927c919cf3077ba9abb2cf31155de4d227b3119 /subprojects/frontend/src/TopBar.tsx
parentrefactor(frontend): filter dialog formatting (diff)
downloadrefinery-e41e0391ba843b85a5b2890db95121fa39426a05.tar.gz
refinery-e41e0391ba843b85a5b2890db95121fa39426a05.tar.zst
refinery-e41e0391ba843b85a5b2890db95121fa39426a05.zip
feat(frontend): window pane switcher
Diffstat (limited to 'subprojects/frontend/src/TopBar.tsx')
-rw-r--r--subprojects/frontend/src/TopBar.tsx91
1 files changed, 38 insertions, 53 deletions
diff --git a/subprojects/frontend/src/TopBar.tsx b/subprojects/frontend/src/TopBar.tsx
index c722c203..e6350080 100644
--- a/subprojects/frontend/src/TopBar.tsx
+++ b/subprojects/frontend/src/TopBar.tsx
@@ -6,7 +6,6 @@
6 6
7import GitHubIcon from '@mui/icons-material/GitHub'; 7import GitHubIcon from '@mui/icons-material/GitHub';
8import AppBar from '@mui/material/AppBar'; 8import AppBar from '@mui/material/AppBar';
9import Button from '@mui/material/Button';
10import IconButton from '@mui/material/IconButton'; 9import IconButton from '@mui/material/IconButton';
11import Stack from '@mui/material/Stack'; 10import Stack from '@mui/material/Stack';
12import Toolbar from '@mui/material/Toolbar'; 11import Toolbar from '@mui/material/Toolbar';
@@ -17,8 +16,10 @@ import { throttle } from 'lodash-es';
17import { observer } from 'mobx-react-lite'; 16import { observer } from 'mobx-react-lite';
18import { useEffect, useMemo, useState } from 'react'; 17import { useEffect, useMemo, useState } from 'react';
19 18
19import PaneButtons from './PaneButtons';
20import { useRootStore } from './RootStoreProvider'; 20import { useRootStore } from './RootStoreProvider';
21import ToggleDarkModeButton from './ToggleDarkModeButton'; 21import ToggleDarkModeButton from './ToggleDarkModeButton';
22import ConnectButton from './editor/ConnectButton';
22import GenerateButton from './editor/GenerateButton'; 23import GenerateButton from './editor/GenerateButton';
23 24
24function useWindowControlsOverlayVisible(): boolean { 25function useWindowControlsOverlayVisible(): boolean {
@@ -65,11 +66,12 @@ const DevModeBadge = styled('div')(({ theme }) => ({
65})); 66}));
66 67
67export default observer(function TopBar(): JSX.Element { 68export default observer(function TopBar(): JSX.Element {
68 const { editorStore } = useRootStore(); 69 const { editorStore, themeStore } = useRootStore();
69 const overlayVisible = useWindowControlsOverlayVisible(); 70 const overlayVisible = useWindowControlsOverlayVisible();
70 const { breakpoints } = useTheme(); 71 const { breakpoints } = useTheme();
71 const small = useMediaQuery(breakpoints.down('sm')); 72 const medium = useMediaQuery(breakpoints.up('sm'));
72 const large = useMediaQuery(breakpoints.up('md')); 73 const large = useMediaQuery(breakpoints.up('md'));
74 const veryLarge = useMediaQuery(breakpoints.up('lg'));
73 75
74 return ( 76 return (
75 <AppBar 77 <AppBar
@@ -100,59 +102,42 @@ export default observer(function TopBar(): JSX.Element {
100 py: 0.5, 102 py: 0.5,
101 }} 103 }}
102 > 104 >
103 <Typography variant="h6" component="h1" flexGrow={1}> 105 <Typography variant="h6" component="h1">
104 Refinery {import.meta.env.DEV && <DevModeBadge>Dev</DevModeBadge>} 106 Refinery {import.meta.env.DEV && <DevModeBadge>Dev</DevModeBadge>}
105 </Typography> 107 </Typography>
106 <Stack direction="row" marginRight={1}> 108 <Stack direction="row" flexGrow={1} marginLeft={1} gap={1}>
107 <GenerateButton editorStore={editorStore} hideWarnings={small} /> 109 <ConnectButton editorStore={editorStore} />
110 {medium && !large && (
111 <PaneButtons themeStore={themeStore} hideLabel />
112 )}
113 </Stack>
114 {large && (
115 <Stack
116 direction="row"
117 alignItems="center"
118 sx={{
119 py: 0.5,
120 position: 'absolute',
121 top: 0,
122 bottom: 0,
123 left: '50%',
124 transform: 'translateX(-50%)',
125 }}
126 >
127 <PaneButtons themeStore={themeStore} />
128 </Stack>
129 )}
130 <Stack direction="row" marginLeft={1} marginRight={1} gap={1}>
131 <GenerateButton editorStore={editorStore} hideWarnings={!veryLarge} />
108 {large && ( 132 {large && (
109 <> 133 <IconButton
110 <Button 134 aria-label="GitHub"
111 arial-label="Budapest University of Technology and Economics, Critical Systems Research Group" 135 href="https://github.com/graphs4value/refinery"
112 className="rounded" 136 target="_blank"
113 color="inherit" 137 color="inherit"
114 href="https://ftsrg.mit.bme.hu" 138 >
115 target="_blank" 139 <GitHubIcon />
116 sx={{ marginLeft: 1 }} 140 </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 M<span style={{ textTransform: 'none' }}>c</span>Gill ECE
128 </Button>
129 <Button
130 aria-label="Linkönping University, Department of Computer and Information Science"
131 className="rounded"
132 color="inherit"
133 href="https://liu.se/en/employee/danva91"
134 target="_blank"
135 >
136 L<span style={{ textTransform: 'none' }}>i</span>U IDA
137 </Button>
138 <Button
139 aria-label="2022 Amazon Research Awards recipent"
140 className="rounded"
141 color="inherit"
142 href="https://www.amazon.science/research-awards/recipients/daniel-varro-fall-2021"
143 target="_blank"
144 >
145 Amazon Science
146 </Button>
147 <IconButton
148 aria-label="GitHub"
149 href="https://github.com/graphs4value/refinery"
150 target="_blank"
151 color="inherit"
152 >
153 <GitHubIcon />
154 </IconButton>
155 </>
156 )} 141 )}
157 </Stack> 142 </Stack>
158 <ToggleDarkModeButton /> 143 <ToggleDarkModeButton />