aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/TopBar.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/TopBar.tsx')
-rw-r--r--subprojects/frontend/src/TopBar.tsx15
1 files changed, 13 insertions, 2 deletions
diff --git a/subprojects/frontend/src/TopBar.tsx b/subprojects/frontend/src/TopBar.tsx
index 4424e6b3..a060ff9e 100644
--- a/subprojects/frontend/src/TopBar.tsx
+++ b/subprojects/frontend/src/TopBar.tsx
@@ -1,10 +1,15 @@
1import AppBar from '@mui/material/AppBar'; 1import AppBar from '@mui/material/AppBar';
2import Toolbar from '@mui/material/Toolbar'; 2import Toolbar from '@mui/material/Toolbar';
3import Typography from '@mui/material/Typography'; 3import Typography from '@mui/material/Typography';
4import { useTheme } from '@mui/material/styles';
5import useMediaQuery from '@mui/material/useMediaQuery';
4import { throttle } from 'lodash-es'; 6import { throttle } from 'lodash-es';
7import { observer } from 'mobx-react-lite';
5import React, { useEffect, useMemo, useState } from 'react'; 8import React, { useEffect, useMemo, useState } from 'react';
6 9
10import { useRootStore } from './RootStore';
7import ToggleDarkModeButton from './ToggleDarkModeButton'; 11import ToggleDarkModeButton from './ToggleDarkModeButton';
12import GenerateButton from './editor/GenerateButton';
8 13
9function useWindowControlsOverlayVisible(): boolean { 14function useWindowControlsOverlayVisible(): boolean {
10 const [windowControlsOverlayVisible, setWindowControlsOverlayVisible] = 15 const [windowControlsOverlayVisible, setWindowControlsOverlayVisible] =
@@ -39,8 +44,11 @@ function useWindowControlsOverlayVisible(): boolean {
39 return windowControlsOverlayVisible; 44 return windowControlsOverlayVisible;
40} 45}
41 46
42export default function TopBar(): JSX.Element { 47export default observer(function TopBar(): JSX.Element {
48 const { editorStore } = useRootStore();
43 const overlayVisible = useWindowControlsOverlayVisible(); 49 const overlayVisible = useWindowControlsOverlayVisible();
50 const { breakpoints } = useTheme();
51 const showGenerateButton = useMediaQuery(breakpoints.down('sm'));
44 52
45 return ( 53 return (
46 <AppBar 54 <AppBar
@@ -74,8 +82,11 @@ export default function TopBar(): JSX.Element {
74 <Typography variant="h6" component="h1" flexGrow={1}> 82 <Typography variant="h6" component="h1" flexGrow={1}>
75 Refinery 83 Refinery
76 </Typography> 84 </Typography>
85 {showGenerateButton && (
86 <GenerateButton editorStore={editorStore} hideWarnings />
87 )}
77 <ToggleDarkModeButton /> 88 <ToggleDarkModeButton />
78 </Toolbar> 89 </Toolbar>
79 </AppBar> 90 </AppBar>
80 ); 91 );
81} 92});