[add] MainPage

This commit is contained in:
kim98828 2024-07-12 12:39:19 +09:00
parent f10f2fb722
commit bd566285c0
6 changed files with 103 additions and 8 deletions

View File

@ -25,6 +25,7 @@
"framer-motion": "^11.0.14",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.24.1",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
@ -4977,6 +4978,14 @@
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@remix-run/router": {
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.17.1.tgz",
"integrity": "sha512-mCOMec4BKd6BRGBZeSnGiIgwsbLGp3yhVqAD8H+PxiRNEHgDpZb8J1TnrSDlg97t0ySKMQJTHCWBCmBpSmkF6Q==",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@rollup/plugin-babel": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz",
@ -16789,6 +16798,36 @@
}
}
},
"node_modules/react-router": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.24.1.tgz",
"integrity": "sha512-PTXFXGK2pyXpHzVo3rR9H7ip4lSPZZc0bHG5CARmj65fTT6qG7sTngmb6lcYu1gf3y/8KxORoy9yn59pGpCnpg==",
"dependencies": {
"@remix-run/router": "1.17.1"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"react": ">=16.8"
}
},
"node_modules/react-router-dom": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.24.1.tgz",
"integrity": "sha512-U19KtXqooqw967Vw0Qcn5cOvrX5Ejo9ORmOtJMzYWtCT4/WOfFLIZGGsVLxcd9UkBO0mSTZtXqhZBsWlHr7+Sg==",
"dependencies": {
"@remix-run/router": "1.17.1",
"react-router": "6.24.1"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"react": ">=16.8",
"react-dom": ">=16.8"
}
},
"node_modules/react-scripts": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz",

View File

@ -20,6 +20,7 @@
"framer-motion": "^11.0.14",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.24.1",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"

View File

@ -24,10 +24,9 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>소울엑스AI</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.

View File

@ -1,7 +1,10 @@
import React from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import './App.css';
import Dashboard from './dashboard/dashboard';
import { ComfyProvider } from './comfy/ComfyProvider';
import MainPage from './Pages/MainPage';
import ToggleColorMode from './dashboard/ToggleColorMode';
interface AppProps {
colorMode: 'light' | 'dark';
@ -11,7 +14,14 @@ interface AppProps {
const App: React.FC<AppProps> = ({ colorMode, setColorMode }) => {
return (
<ComfyProvider>
<Dashboard colorMode={colorMode} setColorMode={setColorMode} />
<Router>
<ToggleColorMode colorMode={colorMode} setColorMode={setColorMode} />
<Routes>
<Route path="/root" element={<MainPage />} /> {/* 새로운 페이지 */}
<Route path="/dashboard" element={<Dashboard/>} />
</Routes>
</Router>
</ComfyProvider>
);
};

View File

@ -0,0 +1,48 @@
import React from 'react';
import { Box, Button, Typography, Container, Grid, Paper, useTheme } from '@mui/material';
import { Link } from 'react-router-dom';
const MainPage: React.FC = () => {
const theme = useTheme();
return (
<Container maxWidth="md" style={{ textAlign: 'center', marginTop: '5vh' }}>
<Typography variant="h2" gutterBottom color="textPrimary">
Welcome to Soulx's Homepage
</Typography>
<Typography variant="h5" paragraph color="textPrimary">
This is the main entry point of the application. Explore the features below!
</Typography>
<Button
variant="contained"
color="primary"
component={Link}
to="/dashboard"
style={{ margin: '20px' }}
>
Go to Dashboard
</Button>
<Grid container spacing={4}>
<Grid item xs={12} sm={6}>
<Paper elevation={3} style={{ padding: '20px', backgroundColor: theme.palette.background.paper }}>
<Typography variant="h5" color="textPrimary">Feature 1</Typography>
<Typography variant="body1" color="textPrimary">
Description of Feature 1 goes here. This feature is designed to enhance your experience.
</Typography>
</Paper>
</Grid>
<Grid item xs={12} sm={6}>
<Paper elevation={3} style={{ padding: '20px', backgroundColor: theme.palette.background.paper }}>
<Typography variant="h5" color="textPrimary">Feature 2</Typography>
<Typography variant="body1" color="textPrimary">
Description of Feature 2 goes here. This feature is user-friendly and efficient.
</Typography>
</Paper>
</Grid>
</Grid>
</Container>
);
};
export default MainPage;

View File

@ -17,15 +17,13 @@ import {
} from '@mui/material';
import { Subscribe, UnSubscribe, WS_MESSAGE_TYPE_EXECUTED, WS_MESSAGE_TYPE_PROGRESS } from '../comfy/api';
import { base } from './image';
import ToggleColorMode from './ToggleColorMode';
import { Image } from '@mui/icons-material';
interface DashboardProps {
colorMode: 'light' | 'dark';
setColorMode: React.Dispatch<React.SetStateAction<'light' | 'dark'>>;
}
const Dashboard: React.FC<DashboardProps> = ({ colorMode, setColorMode }) => {
const Dashboard: React.FC<DashboardProps> = () => {
const theme = useTheme();
const { queuePrompt, fetchCheckpoints } = useComfy();
@ -102,7 +100,7 @@ const Dashboard: React.FC<DashboardProps> = ({ colorMode, setColorMode }) => {
<Box flex="1" style={{ padding: '20px' }}>
<Stack direction="column" spacing={6} style={{ marginTop: '5vh' }}>
<ToggleColorMode colorMode={colorMode} setColorMode={setColorMode} />
<img src='./SoulxLogo.png'/>
<FormControl fullWidth>
<Select value={selectedCheckpoint} onChange={(e) => setSelectedCheckpoint(e.target.value)} displayEmpty>