2022-09-16 17:18:15 +00:00
|
|
|
import { Grid, GridItem } from '@chakra-ui/react';
|
2022-09-18 07:33:09 +00:00
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
import CurrentImageDisplay from '../features/gallery/CurrentImageDisplay';
|
|
|
|
import ImageGallery from '../features/gallery/ImageGallery';
|
2022-09-20 13:17:31 +00:00
|
|
|
import ProgressBar from '../features/system/ProgressBar';
|
|
|
|
import SiteHeader from '../features/system/SiteHeader';
|
|
|
|
import OptionsAccordion from '../features/options/OptionsAccordion';
|
|
|
|
import ProcessButtons from '../features/options/ProcessButtons';
|
|
|
|
import PromptInput from '../features/options/PromptInput';
|
2022-09-18 07:33:09 +00:00
|
|
|
import LogViewer from '../features/system/LogViewer';
|
|
|
|
import Loading from '../Loading';
|
|
|
|
import { useAppDispatch } from './store';
|
2022-09-20 13:17:31 +00:00
|
|
|
import { requestAllImages, requestSystemConfig } from './socketio/actions';
|
2022-09-16 17:18:15 +00:00
|
|
|
|
|
|
|
const App = () => {
|
2022-09-17 06:32:59 +00:00
|
|
|
const dispatch = useAppDispatch();
|
2022-09-18 07:33:09 +00:00
|
|
|
const [isReady, setIsReady] = useState<boolean>(false);
|
2022-09-17 06:32:59 +00:00
|
|
|
|
|
|
|
// Load images from the gallery once
|
|
|
|
useEffect(() => {
|
|
|
|
dispatch(requestAllImages());
|
2022-09-20 13:17:31 +00:00
|
|
|
dispatch(requestSystemConfig());
|
2022-09-18 07:33:09 +00:00
|
|
|
setIsReady(true);
|
2022-09-17 06:32:59 +00:00
|
|
|
}, [dispatch]);
|
|
|
|
|
2022-09-18 07:33:09 +00:00
|
|
|
return isReady ? (
|
2022-09-17 06:32:59 +00:00
|
|
|
<>
|
|
|
|
<Grid
|
|
|
|
width="100vw"
|
|
|
|
height="100vh"
|
|
|
|
templateAreas={`
|
2022-09-16 17:18:15 +00:00
|
|
|
"header header header header"
|
|
|
|
"progressBar progressBar progressBar progressBar"
|
|
|
|
"menu prompt processButtons imageRoll"
|
|
|
|
"menu currentImage currentImage imageRoll"`}
|
2022-09-17 06:32:59 +00:00
|
|
|
gridTemplateRows={'36px 10px 100px auto'}
|
|
|
|
gridTemplateColumns={'350px auto 100px 388px'}
|
|
|
|
gap={2}
|
|
|
|
>
|
|
|
|
<GridItem area={'header'} pt={1}>
|
|
|
|
<SiteHeader />
|
|
|
|
</GridItem>
|
|
|
|
<GridItem area={'progressBar'}>
|
|
|
|
<ProgressBar />
|
|
|
|
</GridItem>
|
|
|
|
<GridItem pl="2" area={'menu'} overflowY="scroll">
|
|
|
|
<OptionsAccordion />
|
|
|
|
</GridItem>
|
|
|
|
<GridItem area={'prompt'}>
|
|
|
|
<PromptInput />
|
|
|
|
</GridItem>
|
|
|
|
<GridItem area={'processButtons'}>
|
|
|
|
<ProcessButtons />
|
|
|
|
</GridItem>
|
|
|
|
<GridItem area={'currentImage'}>
|
|
|
|
<CurrentImageDisplay />
|
|
|
|
</GridItem>
|
|
|
|
<GridItem pr="2" area={'imageRoll'} overflowY="scroll">
|
|
|
|
<ImageGallery />
|
|
|
|
</GridItem>
|
|
|
|
</Grid>
|
|
|
|
<LogViewer />
|
|
|
|
</>
|
2022-09-18 07:33:09 +00:00
|
|
|
) : (
|
|
|
|
<Loading />
|
2022-09-17 06:32:59 +00:00
|
|
|
);
|
2022-09-16 17:18:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|