Spaces:
Sleeping
Sleeping
Yann
commited on
Commit
·
15975c4
1
Parent(s):
86694c3
add front
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- front/.gitignore +2 -0
- front/README.md +8 -0
- front/dist/assets/index-GjkfYCwO.js +0 -0
- front/index.html +11 -0
- front/package.json +39 -0
- front/public/vite.svg +1 -0
- front/src/App.tsx +14 -0
- front/src/components/AppBar/MainAppBar.tsx +241 -0
- front/src/components/Container/MainContainer.tsx +35 -0
- front/src/components/Drawer/MainDrawer.tsx +120 -0
- front/src/favicon.svg +15 -0
- front/src/main.tsx +12 -0
- front/src/pages/About/About.tsx +15 -0
- front/src/pages/ColorSystem/ColorSystem.tsx +239 -0
- front/src/pages/Express/Express.tsx +53 -0
- front/src/pages/Home/Home.tsx +87 -0
- front/src/pages/Inferrence/CustomizeVST/CustomizeVST.tsx +187 -0
- front/src/pages/Inferrence/Inferrence.tsx +203 -0
- front/src/pages/Inferrence/Results/Results.tsx +97 -0
- front/src/pages/Layout/MainLayout.tsx +67 -0
- front/src/pages/pagesData.tsx +42 -0
- front/src/pages/router.tsx +21 -0
- front/src/requests/download.tsx +49 -0
- front/src/requests/upload.tsx +255 -0
- front/src/theme/M3/M3.tsx +25 -0
- front/src/theme/M3/components/Accordion.ts +41 -0
- front/src/theme/M3/components/Alert.ts +71 -0
- front/src/theme/M3/components/AppBar.ts +35 -0
- front/src/theme/M3/components/Badge.ts +39 -0
- front/src/theme/M3/components/Button.ts +171 -0
- front/src/theme/M3/components/Card.ts +127 -0
- front/src/theme/M3/components/CssBaseline.ts +25 -0
- front/src/theme/M3/components/Drawer.ts +24 -0
- front/src/theme/M3/components/Fab.ts +126 -0
- front/src/theme/M3/components/ListItem.ts +27 -0
- front/src/theme/M3/components/ListItemButton.ts +55 -0
- front/src/theme/M3/components/ListItemIcon.ts +26 -0
- front/src/theme/M3/components/Menu.ts +31 -0
- front/src/theme/M3/components/Switch.ts +83 -0
- front/src/theme/M3/components/ToggleButton.ts +68 -0
- front/src/theme/M3/components/ToggleButtonGroup.ts +39 -0
- front/src/theme/M3/components/Tooltip.ts +23 -0
- front/src/theme/M3/components/index.ts +17 -0
- front/src/theme/M3/hooks/useThemeMode.ts +24 -0
- front/src/theme/M3/hooks/useTonalPalette.ts +43 -0
- front/src/theme/M3/providers/ThemeModeProvider.tsx +30 -0
- front/src/theme/M3/providers/ThemeSchemeProvider.tsx +47 -0
- front/src/theme/M3/types/ThemeMode.ts +1 -0
- front/src/theme/M3/types/ThemeScheme.ts +14 -0
- front/src/theme/M3/types/ThemeTokens.ts +218 -0
front/.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
node_modules/*
|
2 |
+
package-lock.json
|
front/README.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# React + Vite
|
2 |
+
|
3 |
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
4 |
+
|
5 |
+
Currently, two official plugins are available:
|
6 |
+
|
7 |
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
8 |
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
front/dist/assets/index-GjkfYCwO.js
ADDED
The diff for this file is too large to render.
See raw diff
|
|
front/index.html
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!doctype html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8" />
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6 |
+
</head>
|
7 |
+
<body>
|
8 |
+
<div id="root"></div>
|
9 |
+
<script type="module" src="/src/main.tsx"></script>
|
10 |
+
</body>
|
11 |
+
</html>
|
front/package.json
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "vst-infer",
|
3 |
+
"private": true,
|
4 |
+
"version": "0.0.0",
|
5 |
+
"type": "module",
|
6 |
+
"scripts": {
|
7 |
+
"dev": "vite",
|
8 |
+
"build": "vite build",
|
9 |
+
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
10 |
+
"preview": "vite preview"
|
11 |
+
},
|
12 |
+
"dependencies": {
|
13 |
+
"@emotion/react": "^11.11.3",
|
14 |
+
"@emotion/styled": "^11.11.0",
|
15 |
+
"@material/material-color-utilities": "^0.2.7",
|
16 |
+
"@mui/icons-material": "^5.14.5",
|
17 |
+
"@mui/material": "^5.15.5",
|
18 |
+
"axios": "^1.6.5",
|
19 |
+
"react": "^18.2.0",
|
20 |
+
"react-audio-player": "^0.17.0",
|
21 |
+
"react-dom": "^18.2.0",
|
22 |
+
"react-router-dom": "^6.21.2",
|
23 |
+
"uuid": "^9.0.1",
|
24 |
+
"vite-plugin-progress": "^0.0.7"
|
25 |
+
},
|
26 |
+
"devDependencies": {
|
27 |
+
"@types/react": "^18.2.43",
|
28 |
+
"@types/react-dom": "^18.2.17",
|
29 |
+
"@vitejs/plugin-react": "^4.2.1",
|
30 |
+
"eslint": "^8.55.0",
|
31 |
+
"eslint-plugin-react": "^7.33.2",
|
32 |
+
"eslint-plugin-react-hooks": "^4.6.0",
|
33 |
+
"eslint-plugin-react-refresh": "^0.4.5",
|
34 |
+
"vite": "^5.0.11"
|
35 |
+
},
|
36 |
+
"optionalDependencies": {
|
37 |
+
"@rollup/rollup-linux-x64-gnu": "4.9.5"
|
38 |
+
}
|
39 |
+
}
|
front/public/vite.svg
ADDED
front/src/App.tsx
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import { BrowserRouter } from "react-router-dom";
|
3 |
+
import Router from "./pages/router";
|
4 |
+
|
5 |
+
const App = () => {
|
6 |
+
|
7 |
+
return (
|
8 |
+
<BrowserRouter>
|
9 |
+
<Router />
|
10 |
+
</BrowserRouter>
|
11 |
+
);
|
12 |
+
};
|
13 |
+
|
14 |
+
export default App;
|
front/src/components/AppBar/MainAppBar.tsx
ADDED
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import {
|
2 |
+
AppBar,
|
3 |
+
Box,
|
4 |
+
Button,
|
5 |
+
Grid,
|
6 |
+
IconButton,
|
7 |
+
Modal,
|
8 |
+
Toolbar,
|
9 |
+
Tooltip,
|
10 |
+
Typography,
|
11 |
+
useScrollTrigger,
|
12 |
+
useTheme
|
13 |
+
} from "@mui/material";
|
14 |
+
import { FC, useContext, useState } from "react";
|
15 |
+
import { useLocation, useNavigate } from "react-router-dom";
|
16 |
+
import { ThemeModeContext, ThemeSchemeContext } from "../../theme";
|
17 |
+
|
18 |
+
import DarkIcon from "@mui/icons-material/DarkModeOutlined";
|
19 |
+
import LightIcon from "@mui/icons-material/LightModeOutlined";
|
20 |
+
import MenuIcon from "@mui/icons-material/MenuTwoTone";
|
21 |
+
|
22 |
+
interface HeaderProps {
|
23 |
+
onDrawerToggle?: () => void;
|
24 |
+
window?: () => Window;
|
25 |
+
}
|
26 |
+
|
27 |
+
const MainAppBar: FC<HeaderProps> = ({ onDrawerToggle, window }) => {
|
28 |
+
const { toggleTheme, themeMode, setThemeMode } = useContext(ThemeModeContext);
|
29 |
+
const { generateScheme, themeScheme } = useContext(ThemeSchemeContext);
|
30 |
+
|
31 |
+
const muiTheme = useTheme();
|
32 |
+
const location = useLocation();
|
33 |
+
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
34 |
+
const open = Boolean(anchorEl);
|
35 |
+
|
36 |
+
const openMenu = (event: React.MouseEvent<HTMLButtonElement>) => {
|
37 |
+
setAnchorEl(event.currentTarget);
|
38 |
+
};
|
39 |
+
const closeMenu = () => {
|
40 |
+
setAnchorEl(null);
|
41 |
+
};
|
42 |
+
|
43 |
+
const [openModal, setOpenModal] = useState(false)
|
44 |
+
const handleOpen = () => setOpenModal(true)
|
45 |
+
const handleClose = () => setOpenModal(false)
|
46 |
+
|
47 |
+
const trigger = useScrollTrigger({
|
48 |
+
disableHysteresis: true,
|
49 |
+
threshold: 0,
|
50 |
+
target: window ? window() : undefined,
|
51 |
+
});
|
52 |
+
|
53 |
+
const DIGITS: string = "0123456789ABCDEF";
|
54 |
+
|
55 |
+
const randomColor = (): string => {
|
56 |
+
let result = "";
|
57 |
+
for (let i = 0; i < 6; ++i) {
|
58 |
+
const index = Math.floor(16 * Math.random());
|
59 |
+
result += DIGITS[index];
|
60 |
+
}
|
61 |
+
return "#" + result;
|
62 |
+
};
|
63 |
+
|
64 |
+
const onGenerate = () => generateScheme(randomColor());
|
65 |
+
|
66 |
+
const onReset = () => {
|
67 |
+
generateScheme("#6750a4"); //#6750a4 #005fb0
|
68 |
+
setThemeMode("light");
|
69 |
+
};
|
70 |
+
|
71 |
+
const downloadTheme = () => {
|
72 |
+
closeMenu();
|
73 |
+
|
74 |
+
const themeString = JSON.stringify(themeScheme, null, 2);
|
75 |
+
// make it downloadable
|
76 |
+
const element = document.createElement("a");
|
77 |
+
const file = new Blob([themeString], { type: "application/json" });
|
78 |
+
element.href = URL.createObjectURL(file);
|
79 |
+
element.download = "ThemeScheme.json";
|
80 |
+
document.body.appendChild(element);
|
81 |
+
element.click();
|
82 |
+
};
|
83 |
+
|
84 |
+
const downloadMUITheme = () => {
|
85 |
+
closeMenu();
|
86 |
+
|
87 |
+
const themeString = JSON.stringify(muiTheme, null, 2);
|
88 |
+
// make it downloadable
|
89 |
+
const element = document.createElement("a");
|
90 |
+
const file = new Blob([themeString], { type: "application/json" });
|
91 |
+
element.href = URL.createObjectURL(file);
|
92 |
+
element.download = "ThemeMUI.json";
|
93 |
+
document.body.appendChild(element);
|
94 |
+
element.click();
|
95 |
+
};
|
96 |
+
|
97 |
+
const navigate = useNavigate();
|
98 |
+
return (
|
99 |
+
<>
|
100 |
+
<AppBar position="sticky" elevation={trigger ? 2 : 0}>
|
101 |
+
<Toolbar>
|
102 |
+
<Grid container spacing={1} alignItems="center">
|
103 |
+
<Grid item sx={{ display: { md: "none", sm: "block" } }}>
|
104 |
+
<IconButton color="inherit" edge="start" onClick={onDrawerToggle}>
|
105 |
+
<MenuIcon />
|
106 |
+
</IconButton>
|
107 |
+
</Grid>
|
108 |
+
<Grid item sx={{ display: "flex", alignItems: "baseline" }}>
|
109 |
+
<Typography
|
110 |
+
color="inherit"
|
111 |
+
sx={{ fontWeight: 500, letterSpacing: 0.5, fontSize: 20 }}
|
112 |
+
>
|
113 |
+
{location.pathname.replace("/", "")}
|
114 |
+
</Typography>
|
115 |
+
</Grid>
|
116 |
+
<Grid item xs></Grid>
|
117 |
+
<Grid item>
|
118 |
+
<Tooltip title="Switch Theme">
|
119 |
+
<IconButton size="large" color="inherit" onClick={toggleTheme}>
|
120 |
+
{themeMode == "light" ? <DarkIcon /> : <LightIcon />}
|
121 |
+
</IconButton>
|
122 |
+
</Tooltip>
|
123 |
+
</Grid>
|
124 |
+
</Grid>
|
125 |
+
<Button variant="tonal" color="tertiary" onClick={handleOpen}>
|
126 |
+
Credits
|
127 |
+
</Button>
|
128 |
+
<div>
|
129 |
+
<Modal
|
130 |
+
open={openModal}
|
131 |
+
onClose={handleClose}
|
132 |
+
aria-labelledby="modal-modal-title"
|
133 |
+
aria-describedby="modal-modal-description"
|
134 |
+
>
|
135 |
+
<Box sx={style_modal}>
|
136 |
+
<Typography
|
137 |
+
id="modal-modal-title"
|
138 |
+
variant="h6"
|
139 |
+
sx={{
|
140 |
+
paddingTop: "10px",
|
141 |
+
fontFamily: "monospace",
|
142 |
+
fontStyle: "italic",
|
143 |
+
}}
|
144 |
+
>
|
145 |
+
Inferrence
|
146 |
+
</Typography>
|
147 |
+
|
148 |
+
<Typography
|
149 |
+
id="modal-modal-title"
|
150 |
+
variant="h6"
|
151 |
+
sx={{ paddingTop: "10px", fontFamily: "monospace" }}
|
152 |
+
component="h2"
|
153 |
+
>
|
154 |
+
Project contributors
|
155 |
+
</Typography>
|
156 |
+
<Typography
|
157 |
+
id="modal-modal-title"
|
158 |
+
variant="h6"
|
159 |
+
sx={{ paddingTop: "10px", fontFamily: "monospace" }}
|
160 |
+
component="h2"
|
161 |
+
>
|
162 |
+
Application & Model:
|
163 |
+
</Typography>
|
164 |
+
<Box sx={{ gap: "1px", marginLeft: "10px" }}>
|
165 |
+
<Typography
|
166 |
+
id="modal-modal-description"
|
167 |
+
paragraph
|
168 |
+
sx={{
|
169 |
+
mt: 0,
|
170 |
+
mb: 0,
|
171 |
+
fontSize: "18px",
|
172 |
+
fontFamily: "monospace",
|
173 |
+
}}
|
174 |
+
>
|
175 |
+
- Yann Derré
|
176 |
+
</Typography>
|
177 |
+
<Typography
|
178 |
+
id="modal-modal-description"
|
179 |
+
paragraph
|
180 |
+
sx={{
|
181 |
+
mt: 0,
|
182 |
+
mb: 0,
|
183 |
+
fontSize: "18px",
|
184 |
+
fontFamily: "monospace",
|
185 |
+
}}
|
186 |
+
>
|
187 |
+
- Anselme Canivet
|
188 |
+
</Typography>
|
189 |
+
</Box>
|
190 |
+
|
191 |
+
<Typography
|
192 |
+
id="modal-modal-title"
|
193 |
+
variant="h6"
|
194 |
+
sx={{ paddingTop: "10px", fontFamily: "monospace" }}
|
195 |
+
component="h2"
|
196 |
+
>
|
197 |
+
Extra Support model:
|
198 |
+
</Typography>
|
199 |
+
<Box sx={{ gap: "1px", marginLeft: "10px" }}>
|
200 |
+
<Typography
|
201 |
+
id="modal-modal-description"
|
202 |
+
paragraph
|
203 |
+
sx={{
|
204 |
+
mt: 0,
|
205 |
+
mb: 0,
|
206 |
+
fontSize: "18px",
|
207 |
+
fontFamily: "monospace",
|
208 |
+
}}
|
209 |
+
>
|
210 |
+
Inverynsth implementation Carlos
|
211 |
+
</Typography>
|
212 |
+
</Box>
|
213 |
+
|
214 |
+
<Typography
|
215 |
+
id="modal-modal-description"
|
216 |
+
sx={{ mt: 2, fontFamily: "monospace" }}
|
217 |
+
>
|
218 |
+
Link to the POC paper:
|
219 |
+
</Typography>
|
220 |
+
</Box>
|
221 |
+
</Modal>
|
222 |
+
</div>
|
223 |
+
</Toolbar>
|
224 |
+
</AppBar>
|
225 |
+
</>
|
226 |
+
);
|
227 |
+
};
|
228 |
+
|
229 |
+
const style_modal = {
|
230 |
+
position: "absolute" as "absolute",
|
231 |
+
top: "50%",
|
232 |
+
left: "50%",
|
233 |
+
transform: "translate(-50%, -50%)",
|
234 |
+
width: 500,
|
235 |
+
color: "inherit",
|
236 |
+
bgcolor: "background.paper",
|
237 |
+
p: 4,
|
238 |
+
borderRadius: "10px",
|
239 |
+
}
|
240 |
+
|
241 |
+
export default MainAppBar;
|
front/src/components/Container/MainContainer.tsx
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { useMediaQuery, useTheme, SxProps, Paper } from '@mui/material';
|
2 |
+
import { FC } from 'react';
|
3 |
+
|
4 |
+
const MainContainer: FC<{ children?: React.ReactNode }> = ({ children }) => {
|
5 |
+
|
6 |
+
const theme = useTheme();
|
7 |
+
const isSmUp = useMediaQuery(theme.breakpoints.up('md'));
|
8 |
+
const isSxUp = useMediaQuery(theme.breakpoints.up('sm'));
|
9 |
+
const radiusTop = 30;
|
10 |
+
const radiusBottom = isSxUp ? 25 : 0;
|
11 |
+
|
12 |
+
const paperStyle: SxProps = {
|
13 |
+
p: isSxUp ? 4 : 2,
|
14 |
+
borderTopLeftRadius: radiusTop,
|
15 |
+
borderTopRightRadius: radiusTop,
|
16 |
+
borderBottomLeftRadius: radiusBottom,
|
17 |
+
borderBottomRightRadius: radiusBottom,
|
18 |
+
/*height: isSxUp ? 'auto' : 1,
|
19 |
+
m: isSxUp ? 2 : 0,*/
|
20 |
+
height: isSxUp ? '99%' : 1,
|
21 |
+
mt: 0,
|
22 |
+
mb: isSxUp ? 2 : 0,
|
23 |
+
mr: isSxUp ? 2 : 0,
|
24 |
+
ml: isSxUp ? (isSmUp ? 0 : 2) : 0
|
25 |
+
};
|
26 |
+
|
27 |
+
|
28 |
+
return (
|
29 |
+
<Paper sx={paperStyle} elevation={0} >
|
30 |
+
{children}
|
31 |
+
</Paper>
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
export default MainContainer;
|
front/src/components/Drawer/MainDrawer.tsx
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Box, Drawer, DrawerProps, Fab, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Toolbar, Typography } from "@mui/material";
|
2 |
+
import { FC, useState, useEffect } from 'react';
|
3 |
+
|
4 |
+
import { Link, useLocation } from "react-router-dom";
|
5 |
+
|
6 |
+
import HomeIcon from '@mui/icons-material/Home';
|
7 |
+
import HomeIconOutlined from '@mui/icons-material/HomeOutlined';
|
8 |
+
import InfoIcon from '@mui/icons-material/Info';
|
9 |
+
import InfoIconOutlined from '@mui/icons-material/InfoOutlined';
|
10 |
+
|
11 |
+
import PeopleIcon from '@mui/icons-material/PeopleOutline';
|
12 |
+
import PermMediaOutlinedIcon from '@mui/icons-material/PhotoSizeSelectActualOutlined';
|
13 |
+
import PublicIcon from '@mui/icons-material/PublicOutlined';
|
14 |
+
import SettingsEthernetIcon from '@mui/icons-material/SettingsEthernetOutlined';
|
15 |
+
import SettingsInputComponentIcon from '@mui/icons-material/SettingsInputComponentOutlined';
|
16 |
+
import PaletteOutlinedIcon from '@mui/icons-material/PaletteOutlined';
|
17 |
+
import PaletteTwoToneIcon from '@mui/icons-material/Palette';
|
18 |
+
import Add from "@mui/icons-material/Add";
|
19 |
+
import { AddOutlined, FlashOn, FlashOnOutlined } from "@mui/icons-material";
|
20 |
+
|
21 |
+
const MainDrawer: FC<DrawerProps> = (props) => {
|
22 |
+
const { onClose, ...others } = props;
|
23 |
+
|
24 |
+
// const categories = [
|
25 |
+
// {
|
26 |
+
// id: 'Build',
|
27 |
+
// children: [
|
28 |
+
// {
|
29 |
+
// id: 'Authentication',
|
30 |
+
// icon: <PeopleIcon />,
|
31 |
+
// },
|
32 |
+
// { id: 'Database', icon: <PeopleIcon /> },
|
33 |
+
// { id: 'Storage', icon: <PermMediaOutlinedIcon /> },
|
34 |
+
// { id: 'Hosting', icon: <PublicIcon /> },
|
35 |
+
// { id: 'Functions', icon: <SettingsEthernetIcon /> },
|
36 |
+
// {
|
37 |
+
// id: 'Machine learning',
|
38 |
+
// icon: <SettingsInputComponentIcon />,
|
39 |
+
// },
|
40 |
+
// ],
|
41 |
+
// },
|
42 |
+
// ];
|
43 |
+
|
44 |
+
const location = useLocation();
|
45 |
+
const [selectedIndex, setSelectedIndex] = useState(location.pathname.replace('/', ''));
|
46 |
+
|
47 |
+
useEffect(() => {
|
48 |
+
setSelectedIndex(location.pathname.replace('/', ''));
|
49 |
+
}, [location.pathname])
|
50 |
+
|
51 |
+
|
52 |
+
const handleListItemClick = (index: string) => {
|
53 |
+
setSelectedIndex(index);
|
54 |
+
onClose?.({}, 'backdropClick');
|
55 |
+
};
|
56 |
+
return (
|
57 |
+
<Drawer {...others} onClose={onClose}>
|
58 |
+
<Toolbar >
|
59 |
+
<Typography color="inherit" sx={{ fontWeight: "bold", letterSpacing: 0.5, fontSize: 25, py:2, pt:5, textAlign: "center"}}>
|
60 |
+
Placeholder logo
|
61 |
+
</Typography>
|
62 |
+
</Toolbar>
|
63 |
+
<Box sx={{py:1}}/>
|
64 |
+
<Fab color='tertiary' sx={{mx: 2, px: 1, py:1, height: "50px"}} variant='extended' component={Link} to='/Inferrence' onClick={() => handleListItemClick('Inferrence')}>
|
65 |
+
{selectedIndex == 'Inferrence' ? <Add sx={{ mr: 1 }} /> : <AddOutlined sx={{ mr: 1 }} />}
|
66 |
+
<Typography color="inherit" sx={{ mr: 1, fontSize: 16, fontWeight: 500, mt:0.3}}>New inferrence</Typography>
|
67 |
+
</Fab>
|
68 |
+
<Box sx={{py:1}}/>
|
69 |
+
<List>
|
70 |
+
<Box>
|
71 |
+
<ListItem >
|
72 |
+
<ListItemButton component={Link} to='/Home' selected={selectedIndex == 'Home'} onClick={() => handleListItemClick('Home')}>
|
73 |
+
<ListItemIcon>
|
74 |
+
{selectedIndex == 'Home' ? <HomeIcon /> : <HomeIconOutlined />}
|
75 |
+
</ListItemIcon>
|
76 |
+
<ListItemText>Home</ListItemText>
|
77 |
+
</ListItemButton>
|
78 |
+
</ListItem>
|
79 |
+
<ListItem >
|
80 |
+
<ListItemButton component={Link} to='/Inferrence' selected={selectedIndex == 'Inferrence'} onClick={() => handleListItemClick('Inferrence')}>
|
81 |
+
<ListItemIcon>
|
82 |
+
{selectedIndex == 'Inferrence' ? <PaletteTwoToneIcon /> : <PaletteOutlinedIcon />}
|
83 |
+
</ListItemIcon>
|
84 |
+
<ListItemText>Inferrence</ListItemText>
|
85 |
+
</ListItemButton>
|
86 |
+
</ListItem>
|
87 |
+
<ListItem >
|
88 |
+
<ListItemButton component={Link} to='/About' selected={selectedIndex == 'About'} onClick={() => handleListItemClick('About')}>
|
89 |
+
<ListItemIcon>
|
90 |
+
{selectedIndex == 'About' ? <InfoIcon /> : <InfoIconOutlined />}
|
91 |
+
</ListItemIcon>
|
92 |
+
<ListItemText>About</ListItemText>
|
93 |
+
</ListItemButton>
|
94 |
+
</ListItem>
|
95 |
+
</Box>
|
96 |
+
{/* {categories.map(({ id, children }) => (
|
97 |
+
<Box key={id}>
|
98 |
+
<ListItem sx={{ py: 2, px: 3 }}>
|
99 |
+
<ListItemText sx={{ fontWeight: 'bold' }}>
|
100 |
+
<Typography color="inherit" sx={{ ml: 1, fontSize: 15, fontWeight: 500 }} >
|
101 |
+
{id}
|
102 |
+
</Typography>
|
103 |
+
</ListItemText>
|
104 |
+
</ListItem>
|
105 |
+
{children.map(({ id: childId, icon }) => (
|
106 |
+
<ListItem key={childId}>
|
107 |
+
<ListItemButton selected={selectedIndex == childId} onClick={() => handleListItemClick(childId)}>
|
108 |
+
<ListItemIcon>{icon}</ListItemIcon>
|
109 |
+
<ListItemText>{childId}</ListItemText>
|
110 |
+
</ListItemButton>
|
111 |
+
</ListItem>
|
112 |
+
))}
|
113 |
+
</Box>
|
114 |
+
))} */}
|
115 |
+
</List>
|
116 |
+
</Drawer>
|
117 |
+
);
|
118 |
+
};
|
119 |
+
|
120 |
+
export default MainDrawer;
|
front/src/favicon.svg
ADDED
front/src/main.tsx
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { createRoot } from 'react-dom/client';
|
2 |
+
import App from './App';
|
3 |
+
import M3 from './theme/M3/M3';
|
4 |
+
|
5 |
+
const container = document.getElementById('root') as Element;
|
6 |
+
const root = createRoot(container);
|
7 |
+
|
8 |
+
root.render(
|
9 |
+
<M3>
|
10 |
+
<App />
|
11 |
+
</M3>
|
12 |
+
);
|
front/src/pages/About/About.tsx
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Typography } from '@mui/material'
|
2 |
+
import MainContainer from '../../components/Container/MainContainer';
|
3 |
+
|
4 |
+
|
5 |
+
const About = () => {
|
6 |
+
return (
|
7 |
+
<>
|
8 |
+
<MainContainer>
|
9 |
+
<Typography variant='body1'>Credits</Typography>
|
10 |
+
</MainContainer>
|
11 |
+
</>
|
12 |
+
);
|
13 |
+
};
|
14 |
+
|
15 |
+
export default About;
|
front/src/pages/ColorSystem/ColorSystem.tsx
ADDED
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Box, Stack, Typography, Paper, SxProps, useTheme, useMediaQuery, Grid } from '@mui/material';
|
2 |
+
import { useContext } from 'react';
|
3 |
+
import { ThemeSchemeContext } from '../../theme';
|
4 |
+
import { ThemeModeContext } from '../../theme/M3/providers/ThemeModeProvider';
|
5 |
+
|
6 |
+
const PaletteSwatch = ({ title, onTitle, titleColor, onTitleColor }: any) => {
|
7 |
+
return (
|
8 |
+
|
9 |
+
<Stack sx={{ height: '80px', borderRadius: '12px' }}>
|
10 |
+
<Box sx={{
|
11 |
+
flex: 1,
|
12 |
+
p: 1,
|
13 |
+
borderTopLeftRadius: '10px',
|
14 |
+
borderTopRightRadius: '10px',
|
15 |
+
bgcolor: titleColor,
|
16 |
+
color: onTitleColor,
|
17 |
+
}}>
|
18 |
+
<Typography fontSize={12} fontWeight={'bold'} >{title} - {titleColor.toUpperCase()}</Typography>
|
19 |
+
</Box>
|
20 |
+
<Box sx={{
|
21 |
+
flex: 1,
|
22 |
+
p: 1,
|
23 |
+
borderBottomLeftRadius: '10px',
|
24 |
+
borderBottomRightRadius: '10px',
|
25 |
+
bgcolor: onTitleColor,
|
26 |
+
color: titleColor,
|
27 |
+
}}>
|
28 |
+
<Typography fontSize={12} fontWeight={'bold'}>{onTitle} - {onTitleColor.toUpperCase()}</Typography>
|
29 |
+
</Box>
|
30 |
+
</Stack>
|
31 |
+
);
|
32 |
+
};
|
33 |
+
|
34 |
+
const PaletteSwatchSurface = ({ title, titleColor, onTitleColor }: any) => {
|
35 |
+
return (
|
36 |
+
<Stack sx={{ height: 'auto', }}>
|
37 |
+
<Box sx={{
|
38 |
+
p: 1.5,
|
39 |
+
bgcolor: titleColor,
|
40 |
+
color: onTitleColor,
|
41 |
+
borderRadius: '10px'
|
42 |
+
}}>
|
43 |
+
<Typography fontSize={12} fontWeight={'bold'}>{title} - {titleColor.toUpperCase()}</Typography>
|
44 |
+
</Box>
|
45 |
+
</Stack>
|
46 |
+
);
|
47 |
+
}
|
48 |
+
|
49 |
+
const ColorSystem = () => {
|
50 |
+
|
51 |
+
const { themeScheme } = useContext(ThemeSchemeContext);
|
52 |
+
const { themeMode } = useContext(ThemeModeContext);
|
53 |
+
const light = themeScheme[themeMode];
|
54 |
+
|
55 |
+
const theme = useTheme();
|
56 |
+
const isSmUp = useMediaQuery(theme.breakpoints.up('md'));
|
57 |
+
const isSxUp = useMediaQuery(theme.breakpoints.up('sm'));
|
58 |
+
|
59 |
+
const radius = isSxUp ? 4 : 0;
|
60 |
+
|
61 |
+
const paperStyle: SxProps = {
|
62 |
+
py: 2,
|
63 |
+
px: 2,
|
64 |
+
borderRadius: radius,
|
65 |
+
//height: isSxUp ? 'auto' : 1,
|
66 |
+
mt: 0,
|
67 |
+
mb: isSxUp ? 2 : 0,
|
68 |
+
mr: isSxUp ? 2 : 0,
|
69 |
+
ml: isSxUp ? (isSmUp ? 0 : 2) : 0
|
70 |
+
};
|
71 |
+
|
72 |
+
return (
|
73 |
+
<Grid container columns={1} spacing={isSxUp ? (isSmUp ? 2 : 1) : 0} columnSpacing={1} >
|
74 |
+
<Grid xs={1}>
|
75 |
+
<Paper elevation={0} sx={{ ...paperStyle, height: 'auto' }} >
|
76 |
+
<Typography variant="h6" fontWeight="bold" sx={{ m: 1 }}>
|
77 |
+
{themeMode == 'light' ? 'Light Theme' : 'Dark Theme'}
|
78 |
+
</Typography>
|
79 |
+
<Grid container columns={4} spacing={2}>
|
80 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
81 |
+
<PaletteSwatch title='Primary' titleColor={light.primary} onTitle='OnPrimary' onTitleColor={light.onPrimary} />
|
82 |
+
</Grid>
|
83 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
84 |
+
<PaletteSwatch title='Secondary' titleColor={light.secondary} onTitle='OnSecondary' onTitleColor={light.onSecondary} />
|
85 |
+
</Grid>
|
86 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
87 |
+
<PaletteSwatch title='Tertiary' titleColor={light.tertiary} onTitle='OnTertiary' onTitleColor={light.onTertiary} />
|
88 |
+
</Grid>
|
89 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
90 |
+
<PaletteSwatch title='Error' titleColor={light.error} onTitle='OnError' onTitleColor={light.onError} />
|
91 |
+
</Grid>
|
92 |
+
|
93 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
94 |
+
<PaletteSwatch title='PrimaryContainer' titleColor={light.primaryContainer} onTitle='OnPrimaryContainer' onTitleColor={light.onPrimaryContainer} />
|
95 |
+
</Grid>
|
96 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
97 |
+
<PaletteSwatch title='SecondaryContainer' titleColor={light.secondaryContainer} onTitle='OnSecondaryContainer' onTitleColor={light.onSecondaryContainer} />
|
98 |
+
</Grid>
|
99 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
100 |
+
<PaletteSwatch title='TertiaryContainer' titleColor={light.tertiaryContainer} onTitle='OnTertiaryContainer' onTitleColor={light.onTertiaryContainer} />
|
101 |
+
</Grid>
|
102 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
103 |
+
<PaletteSwatch title='ErrorContainer' titleColor={light.errorContainer} onTitle='OnErrorContainer' onTitleColor={light.onErrorContainer} />
|
104 |
+
</Grid>
|
105 |
+
</Grid>
|
106 |
+
</Paper>
|
107 |
+
<Paper elevation={0} sx={{ ...paperStyle, height: 'auto' }}>
|
108 |
+
<Grid container columns={4} spacing={2}>
|
109 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
110 |
+
<PaletteSwatchSurface title='PrimaryFixed' titleColor={light.primaryFixed} onTitleColor={light.onPrimaryFixed} />
|
111 |
+
</Grid>
|
112 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
113 |
+
<PaletteSwatchSurface title='PrimaryFixedDim' titleColor={light.primaryFixedDim} onTitleColor={light.onPrimaryFixedVariant} />
|
114 |
+
</Grid>
|
115 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1} >
|
116 |
+
<PaletteSwatchSurface title='OnPrimaryFixed' titleColor={light.onPrimaryFixed} onTitleColor={light.primaryFixed} />
|
117 |
+
</Grid>
|
118 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
119 |
+
<PaletteSwatchSurface title='OnPrimaryFixedVariant' titleColor={light.onPrimaryFixedVariant} onTitleColor={light.primaryFixedDim} />
|
120 |
+
</Grid>
|
121 |
+
|
122 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
123 |
+
<PaletteSwatchSurface title='SecondaryFixed' titleColor={light.secondaryFixed} onTitleColor={light.onSecondaryFixed} />
|
124 |
+
</Grid>
|
125 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
126 |
+
<PaletteSwatchSurface title='SecondaryFixedDim' titleColor={light.secondaryFixedDim} onTitleColor={light.onSecondaryFixedVariant} />
|
127 |
+
</Grid>
|
128 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1} >
|
129 |
+
<PaletteSwatchSurface title='OnSecondaryFixed' titleColor={light.onSecondaryFixed} onTitleColor={light.secondaryFixed} />
|
130 |
+
</Grid>
|
131 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
132 |
+
<PaletteSwatchSurface title='OnSecondaryFixedVariant' titleColor={light.onSecondaryFixedVariant} onTitleColor={light.secondaryFixedDim} />
|
133 |
+
</Grid>
|
134 |
+
|
135 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
136 |
+
<PaletteSwatchSurface title='TertiaryFixed' titleColor={light.tertiaryFixed} onTitleColor={light.onTertiaryFixed} />
|
137 |
+
</Grid>
|
138 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
139 |
+
<PaletteSwatchSurface title='TertiaryFixedDim' titleColor={light.tertiaryFixedDim} onTitleColor={light.onTertiaryFixedVariant} />
|
140 |
+
</Grid>
|
141 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1} >
|
142 |
+
<PaletteSwatchSurface title='OnTertiaryFixed' titleColor={light.onTertiaryFixed} onTitleColor={light.tertiaryFixed} />
|
143 |
+
</Grid>
|
144 |
+
<Grid xs={2} sm={2} md={2} lg={1} xl={1}>
|
145 |
+
<PaletteSwatchSurface title='OnTertiaryFixedVariant' titleColor={light.onTertiaryFixedVariant} onTitleColor={light.tertiaryFixedDim} />
|
146 |
+
</Grid>
|
147 |
+
</Grid>
|
148 |
+
</Paper>
|
149 |
+
<Paper elevation={0} sx={{ ...paperStyle, height: 'auto' }}>
|
150 |
+
<Grid container columns={5} spacing={1} rowSpacing={2}>
|
151 |
+
<Grid xs={1.7}>
|
152 |
+
<PaletteSwatchSurface title='SurfaceDim' titleColor={light.surfaceDim} onTitleColor={light.onSurface} />
|
153 |
+
</Grid>
|
154 |
+
<Grid xs={1.6}>
|
155 |
+
<PaletteSwatchSurface title='Surface' titleColor={light.surface} onTitleColor={light.onSurface} />
|
156 |
+
</Grid>
|
157 |
+
<Grid xs={1.7}>
|
158 |
+
<PaletteSwatchSurface title='SurfaceBright' titleColor={light.surfaceBright} onTitleColor={light.onSurface} />
|
159 |
+
</Grid>
|
160 |
+
|
161 |
+
<Grid xs={1}>
|
162 |
+
<PaletteSwatchSurface title='Surf. ContainerLowest' titleColor={light.surfaceContainerLowest} onTitleColor={light.onSurface} />
|
163 |
+
</Grid>
|
164 |
+
<Grid xs={1}>
|
165 |
+
<PaletteSwatchSurface title='Surf. ContainerLow' titleColor={light.surfaceContainerLow} onTitleColor={light.onSurface} />
|
166 |
+
</Grid>
|
167 |
+
<Grid xs={1}>
|
168 |
+
<PaletteSwatchSurface title='Surf. Container' titleColor={light.surfaceContainer} onTitleColor={light.onSurface} />
|
169 |
+
</Grid>
|
170 |
+
<Grid xs={1}>
|
171 |
+
<PaletteSwatchSurface title='Surf. ContainerHigh' titleColor={light.surfaceContainerHigh} onTitleColor={light.onSurface} />
|
172 |
+
</Grid>
|
173 |
+
<Grid xs={1}>
|
174 |
+
<PaletteSwatchSurface title='Surf. ContainerHighest' titleColor={light.surfaceContainerHighest} onTitleColor={light.onSurface} />
|
175 |
+
</Grid>
|
176 |
+
|
177 |
+
<Grid xs={1.25}>
|
178 |
+
<PaletteSwatchSurface title='OnSurface' titleColor={light.onSurface} onTitleColor={light.surface} />
|
179 |
+
</Grid>
|
180 |
+
<Grid xs={1.25}>
|
181 |
+
<PaletteSwatchSurface title='OnSurfaceVariant' titleColor={light.onSurfaceVariant} onTitleColor={light.surface} />
|
182 |
+
</Grid>
|
183 |
+
<Grid xs={1.25}>
|
184 |
+
<PaletteSwatchSurface title='Outline' titleColor={light.outline} onTitleColor={light.surface} />
|
185 |
+
</Grid>
|
186 |
+
<Grid xs={1.25}>
|
187 |
+
<PaletteSwatchSurface title='OutlineVariant' titleColor={light.outlineVariant} onTitleColor={light.inverseSurface} />
|
188 |
+
</Grid>
|
189 |
+
</Grid>
|
190 |
+
</Paper>
|
191 |
+
<Paper elevation={0} sx={{ ...paperStyle, height: 'auto' }}>
|
192 |
+
<Grid container columns={5} spacing={1}>
|
193 |
+
<Grid xs={1.25}>
|
194 |
+
<PaletteSwatch title='InverseSurface' titleColor={light.inverseSurface} onTitle='InverseOnSurface' onTitleColor={light.inverseOnSurface} />
|
195 |
+
</Grid>
|
196 |
+
<Grid xs={1.25}>
|
197 |
+
<PaletteSwatchSurface title='InversePrimary' titleColor={light.inversePrimary} onTitleColor={light.onPrimaryContainer} />
|
198 |
+
</Grid>
|
199 |
+
<Grid xs={1.25}>
|
200 |
+
<PaletteSwatchSurface title='Scrim' titleColor={light.scrim} onTitleColor={'#FFF'} />
|
201 |
+
</Grid>
|
202 |
+
<Grid xs={1.25}>
|
203 |
+
<PaletteSwatchSurface title='Shadow' titleColor={light.shadow} onTitleColor={'#FFF'} />
|
204 |
+
</Grid>
|
205 |
+
</Grid>
|
206 |
+
</Paper>
|
207 |
+
<Paper elevation={0} sx={{ ...paperStyle }} >
|
208 |
+
<Typography variant="h6" fontWeight="bold" sx={{ m: 1, mt: 2 }}>
|
209 |
+
Custom Colors
|
210 |
+
</Typography>
|
211 |
+
<Grid container columns={3} spacing={2}>
|
212 |
+
<Grid xs={1}>
|
213 |
+
<PaletteSwatch title='Info' titleColor={light.info} onTitle='OnInfo' onTitleColor={light.onInfo} />
|
214 |
+
</Grid>
|
215 |
+
<Grid xs={1}>
|
216 |
+
<PaletteSwatch title='Warning' titleColor={light.warning} onTitle='OnWarning' onTitleColor={light.onWarning} />
|
217 |
+
</Grid>
|
218 |
+
<Grid xs={1}>
|
219 |
+
<PaletteSwatch title='Success' titleColor={light.success} onTitle='OnSuccess' onTitleColor={light.onSuccess} />
|
220 |
+
</Grid>
|
221 |
+
|
222 |
+
<Grid xs={1}>
|
223 |
+
<PaletteSwatch title='InfoContainer' titleColor={light.infoContainer} onTitle='OnInfoContainer' onTitleColor={light.onInfoContainer} />
|
224 |
+
</Grid>
|
225 |
+
<Grid xs={1}>
|
226 |
+
<PaletteSwatch title='WarningContainer' titleColor={light.warningContainer} onTitle='OnWarningContainer' onTitleColor={light.onWarningContainer} />
|
227 |
+
</Grid>
|
228 |
+
<Grid xs={1}>
|
229 |
+
<PaletteSwatch title='SuccessContainer' titleColor={light.successContainer} onTitle='OnSuccesContainer' onTitleColor={light.onSuccessContainer} />
|
230 |
+
</Grid>
|
231 |
+
</Grid>
|
232 |
+
</Paper>
|
233 |
+
</Grid>
|
234 |
+
|
235 |
+
</Grid>
|
236 |
+
);
|
237 |
+
};
|
238 |
+
|
239 |
+
export default ColorSystem;
|
front/src/pages/Express/Express.tsx
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Box, Card, CardContent, Chip, Divider, LinearProgress, Stack, Typography } from "@mui/material";
|
2 |
+
import MainContainer from "../../components/Container/MainContainer";
|
3 |
+
import { ChecklistSharp, DeveloperBoard, FlashOn, LineAxis, Settings, SettingsTwoTone, UploadFile } from "@mui/icons-material";
|
4 |
+
import { useCallback, useEffect, useState } from "react";
|
5 |
+
import { Link, useNavigate, useNavigation } from "react-router-dom";
|
6 |
+
|
7 |
+
const Express = () => {
|
8 |
+
const navigate = useNavigate()
|
9 |
+
|
10 |
+
return (
|
11 |
+
<>
|
12 |
+
<MainContainer>
|
13 |
+
<Box
|
14 |
+
sx={{
|
15 |
+
justifyContent: "center",
|
16 |
+
display: "flex",
|
17 |
+
height: "99%",
|
18 |
+
alignItems: "center",
|
19 |
+
}}
|
20 |
+
>
|
21 |
+
<Stack sx={{ height: '30vh', borderRadius: '12px', gap: "30px", minWidth: "20vw", maxWidth:"300px"}}>
|
22 |
+
<Card variant="outlined" onClick={() => navigate("/Inferrence")}>
|
23 |
+
<Box>
|
24 |
+
<CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", userSelect: "none", gap:"30px"}}>
|
25 |
+
<Box sx={{ display: "flex", flexDirection:"column" }}>
|
26 |
+
<Typography variant="h5">Express generation</Typography>
|
27 |
+
<Typography variant="body1" fontStyle={"italic"}>TAL-Noisemaker synthesizer and recommended config is used</Typography>
|
28 |
+
</Box>
|
29 |
+
<FlashOn sx={{ fontSize: "40px", color: "inherit" }} />
|
30 |
+
</CardContent>
|
31 |
+
</Box>
|
32 |
+
</Card>
|
33 |
+
<Box></Box>
|
34 |
+
<Divider>Or</Divider>
|
35 |
+
<Card variant="outlined" onClick={() => navigate("/")}>
|
36 |
+
<Box sx={{ display: "inherit"}}>
|
37 |
+
<CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", gap:"30px", userSelect: "none"}}>
|
38 |
+
<Box sx={{ display: "flex", flexDirection:"column" }}>
|
39 |
+
<Typography variant="h5">Custom generation</Typography>
|
40 |
+
<Typography variant="body1" fontStyle={"italic"}>Bring your own VST and customize your model</Typography>
|
41 |
+
</Box>
|
42 |
+
<Settings sx={{ fontSize: "40px", color: "inherit" }} />
|
43 |
+
</CardContent>
|
44 |
+
</Box>
|
45 |
+
</Card>
|
46 |
+
</Stack>
|
47 |
+
</Box>
|
48 |
+
</MainContainer>
|
49 |
+
</>
|
50 |
+
);
|
51 |
+
};
|
52 |
+
|
53 |
+
export default Express;
|
front/src/pages/Home/Home.tsx
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import { Stack } from '@mui/material';
|
3 |
+
|
4 |
+
import MainContainer from '../../components/Container/MainContainer';
|
5 |
+
|
6 |
+
import { FlashOn, Settings } from "@mui/icons-material";
|
7 |
+
import { Box, Card, CardContent, Divider, Typography } from "@mui/material";
|
8 |
+
import { useNavigate } from "react-router-dom";
|
9 |
+
|
10 |
+
const Home = () => {
|
11 |
+
const navigate = useNavigate()
|
12 |
+
|
13 |
+
return (
|
14 |
+
<>
|
15 |
+
<MainContainer>
|
16 |
+
<ExplainText/>
|
17 |
+
<Box
|
18 |
+
sx={{
|
19 |
+
justifyContent: "center",
|
20 |
+
display: "flex",
|
21 |
+
pt: 10,
|
22 |
+
height:"100%",
|
23 |
+
alignItems: "center",
|
24 |
+
}}
|
25 |
+
>
|
26 |
+
<Stack sx={{ height: '100%', borderRadius: '12px', gap: "30px", minWidth: "20vw", maxWidth:"300px"}}>
|
27 |
+
<Card variant="outlined" onClick={() => navigate("/Inferrence")}>
|
28 |
+
<Box>
|
29 |
+
<CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", userSelect: "none", gap:"30px"}}>
|
30 |
+
<Box sx={{ display: "flex", flexDirection:"column" }}>
|
31 |
+
<Typography variant="h5">Express generation</Typography>
|
32 |
+
<Typography variant="body1" fontStyle={"italic"}>TAL-Noisemaker synthesizer and recommended config is used</Typography>
|
33 |
+
</Box>
|
34 |
+
<FlashOn sx={{ fontSize: "40px", color: "inherit" }} />
|
35 |
+
</CardContent>
|
36 |
+
</Box>
|
37 |
+
</Card>
|
38 |
+
<Box></Box>
|
39 |
+
<Divider>Or</Divider>
|
40 |
+
<Card variant="outlined" onClick={() => navigate("/CustomizeVST")}>
|
41 |
+
<Box sx={{ display: "inherit"}}>
|
42 |
+
<CardContent sx={{ display: "flex", justifyItems: "center", flexDirection: "row-reverse", alignItems:"center", justifyContent: "flex-end", gap:"30px", userSelect: "none"}}>
|
43 |
+
<Box sx={{ display: "flex", flexDirection:"column" }}>
|
44 |
+
<Typography variant="h5">Custom generation</Typography>
|
45 |
+
<Typography variant="body1" fontStyle={"italic"}>Bring your own VST and customize your model</Typography>
|
46 |
+
</Box>
|
47 |
+
<Settings sx={{ fontSize: "40px", color: "inherit" }} />
|
48 |
+
</CardContent>
|
49 |
+
</Box>
|
50 |
+
</Card>
|
51 |
+
</Stack>
|
52 |
+
</Box>
|
53 |
+
</MainContainer>
|
54 |
+
</>
|
55 |
+
);
|
56 |
+
};
|
57 |
+
|
58 |
+
export default Home;
|
59 |
+
|
60 |
+
|
61 |
+
export function ExplainText(props: any) {
|
62 |
+
return (
|
63 |
+
<div
|
64 |
+
style={{
|
65 |
+
display: "flex",
|
66 |
+
justifyContent: "center",
|
67 |
+
marginBottom: "10px",
|
68 |
+
}}
|
69 |
+
>
|
70 |
+
<Box
|
71 |
+
sx={{
|
72 |
+
width: "50vw",
|
73 |
+
borderRadius: "20px",
|
74 |
+
bgcolor: "background.default",
|
75 |
+
padding: "35px"
|
76 |
+
}}
|
77 |
+
>
|
78 |
+
<Typography variant="h4">Hi!👋</Typography>
|
79 |
+
<div style={{ paddingTop: "10px" }}>
|
80 |
+
<Typography fontSize={"20px"}>
|
81 |
+
Start inferring now!!!!!! 🧑🍳🧑🍳
|
82 |
+
</Typography>
|
83 |
+
</div>
|
84 |
+
</Box>
|
85 |
+
</div>
|
86 |
+
)
|
87 |
+
}
|
front/src/pages/Inferrence/CustomizeVST/CustomizeVST.tsx
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import {
|
2 |
+
DeveloperBoardOutlined
|
3 |
+
} from "@mui/icons-material";
|
4 |
+
import {
|
5 |
+
Box,
|
6 |
+
Button,
|
7 |
+
Card,
|
8 |
+
CardActions,
|
9 |
+
CardContent,
|
10 |
+
Checkbox,
|
11 |
+
Table,
|
12 |
+
TableBody,
|
13 |
+
TableCell,
|
14 |
+
TableContainer,
|
15 |
+
TableHead,
|
16 |
+
TableRow,
|
17 |
+
TextField,
|
18 |
+
Typography
|
19 |
+
} from "@mui/material";
|
20 |
+
import { useState } from "react";
|
21 |
+
import { Link } from "react-router-dom";
|
22 |
+
import MainContainer from "../../../components/Container/MainContainer";
|
23 |
+
|
24 |
+
const CustomizeVST = () => {
|
25 |
+
type DataType = {
|
26 |
+
[key: string]: number | number[];
|
27 |
+
};
|
28 |
+
|
29 |
+
const data: DataType = {
|
30 |
+
item1: 1,
|
31 |
+
item2: 42,
|
32 |
+
item3: 2,
|
33 |
+
item4: 7,
|
34 |
+
item5: [3, 2],
|
35 |
+
};
|
36 |
+
|
37 |
+
type Column = {
|
38 |
+
id: string;
|
39 |
+
label: string;
|
40 |
+
};
|
41 |
+
|
42 |
+
const columns: Column[] = [
|
43 |
+
{ id: "checkbox", label: "Enabled" },
|
44 |
+
{ id: "name", label: "Name" },
|
45 |
+
{ id: "value", label: "Value" },
|
46 |
+
];
|
47 |
+
|
48 |
+
const [selectedItems, setSelectedItems] = useState<string[]>([]);
|
49 |
+
const [editedValues, setEditedValues] = useState<DataType>({});
|
50 |
+
|
51 |
+
const handleCheckboxChange = (itemName: string) => {
|
52 |
+
if (selectedItems.includes(itemName)) {
|
53 |
+
setSelectedItems(selectedItems.filter((item) => item !== itemName));
|
54 |
+
} else {
|
55 |
+
setSelectedItems([...selectedItems, itemName]);
|
56 |
+
}
|
57 |
+
};
|
58 |
+
|
59 |
+
const handleValueChange = (itemName: string, value: number | number[]) => {
|
60 |
+
setEditedValues((prevValues) => ({
|
61 |
+
...prevValues,
|
62 |
+
[itemName]: value,
|
63 |
+
}));
|
64 |
+
};
|
65 |
+
|
66 |
+
return (
|
67 |
+
<>
|
68 |
+
<MainContainer>
|
69 |
+
<Box
|
70 |
+
sx={{
|
71 |
+
justifyContent: "center",
|
72 |
+
display: "flex",
|
73 |
+
height: "99%",
|
74 |
+
alignItems: "center",
|
75 |
+
}}
|
76 |
+
>
|
77 |
+
<Card variant={"filled"} sx={{ width: "30vw" }}>
|
78 |
+
<Box>
|
79 |
+
<CardContent
|
80 |
+
sx={{
|
81 |
+
display: "grid",
|
82 |
+
justifyItems: "center",
|
83 |
+
alignItems: "center",
|
84 |
+
}}
|
85 |
+
>
|
86 |
+
<DeveloperBoardOutlined sx={{ fontSize: "50px" }} />
|
87 |
+
<Typography
|
88 |
+
sx={{ fontFamily: "monospace", pt: 1, fontSize: "50px" }}
|
89 |
+
>
|
90 |
+
VST Name
|
91 |
+
</Typography>
|
92 |
+
<Typography sx={{ fontFamily: "monospace", pb: 1 }}>
|
93 |
+
Properties available
|
94 |
+
</Typography>
|
95 |
+
<TableContainer sx={{}}>
|
96 |
+
<Table>
|
97 |
+
<TableHead>
|
98 |
+
<TableRow>
|
99 |
+
{columns.map((column) => (
|
100 |
+
<TableCell key={column.id}>{column.label}</TableCell>
|
101 |
+
))}
|
102 |
+
</TableRow>
|
103 |
+
</TableHead>
|
104 |
+
<TableBody>
|
105 |
+
{Object.keys(data).map((itemName) => (
|
106 |
+
<TableRow key={itemName}>
|
107 |
+
<TableCell>
|
108 |
+
<Checkbox
|
109 |
+
checked={selectedItems.includes(itemName)}
|
110 |
+
onChange={() => handleCheckboxChange(itemName)}
|
111 |
+
/>
|
112 |
+
</TableCell>
|
113 |
+
<TableCell>{itemName}</TableCell>
|
114 |
+
<TableCell>
|
115 |
+
{Array.isArray(data[itemName]) ? (
|
116 |
+
<>
|
117 |
+
<TextField
|
118 |
+
type="number"
|
119 |
+
value={
|
120 |
+
editedValues[itemName] !== undefined
|
121 |
+
? editedValues[itemName]
|
122 |
+
: data[itemName]
|
123 |
+
}
|
124 |
+
onChange={(e) =>
|
125 |
+
handleValueChange(
|
126 |
+
itemName,
|
127 |
+
Number(e.target.value)
|
128 |
+
)
|
129 |
+
}
|
130 |
+
/>
|
131 |
+
<TextField
|
132 |
+
type="number"
|
133 |
+
value={
|
134 |
+
editedValues[itemName] !== undefined
|
135 |
+
? editedValues[itemName]
|
136 |
+
: data[itemName]
|
137 |
+
}
|
138 |
+
onChange={(e) =>
|
139 |
+
handleValueChange(
|
140 |
+
itemName,
|
141 |
+
Number(e.target.value)
|
142 |
+
)
|
143 |
+
}
|
144 |
+
/>
|
145 |
+
</>
|
146 |
+
) : (
|
147 |
+
<TextField
|
148 |
+
sx={{
|
149 |
+
width: "100px",
|
150 |
+
WebkitAppearance: "none",
|
151 |
+
margin: 0,
|
152 |
+
}}
|
153 |
+
type="number"
|
154 |
+
value={
|
155 |
+
editedValues[itemName] !== undefined
|
156 |
+
? editedValues[itemName]
|
157 |
+
: data[itemName]
|
158 |
+
}
|
159 |
+
onChange={(e) =>
|
160 |
+
handleValueChange(
|
161 |
+
itemName,
|
162 |
+
Number(e.target.value)
|
163 |
+
)
|
164 |
+
}
|
165 |
+
/>
|
166 |
+
)}
|
167 |
+
</TableCell>
|
168 |
+
</TableRow>
|
169 |
+
))}
|
170 |
+
</TableBody>
|
171 |
+
</Table>
|
172 |
+
</TableContainer>
|
173 |
+
</CardContent>
|
174 |
+
<CardActions sx={{ display: "flex", justifyContent: "flex-end" }}>
|
175 |
+
<Button variant="filled" component={Link} to="/Results">
|
176 |
+
Next
|
177 |
+
</Button>
|
178 |
+
</CardActions>
|
179 |
+
</Box>
|
180 |
+
</Card>
|
181 |
+
</Box>
|
182 |
+
</MainContainer>
|
183 |
+
</>
|
184 |
+
);
|
185 |
+
};
|
186 |
+
|
187 |
+
export default CustomizeVST;
|
front/src/pages/Inferrence/Inferrence.tsx
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { UploadFile } from "@mui/icons-material";
|
2 |
+
import {
|
3 |
+
Box,
|
4 |
+
Button,
|
5 |
+
Card,
|
6 |
+
CardActions,
|
7 |
+
CardContent,
|
8 |
+
LinearProgress,
|
9 |
+
Modal,
|
10 |
+
Typography,
|
11 |
+
} from "@mui/material";
|
12 |
+
import { useCallback, useEffect, useState } from "react";
|
13 |
+
import { Link, useLocation } from "react-router-dom";
|
14 |
+
import MainContainer from "../../components/Container/MainContainer";
|
15 |
+
import AudioUploader from "../../requests/upload";
|
16 |
+
import ColorSystem from "../ColorSystem/ColorSystem";
|
17 |
+
|
18 |
+
const Inferrence = () => {
|
19 |
+
|
20 |
+
|
21 |
+
useEffect(() => {
|
22 |
+
// Retrieve values from localStorage
|
23 |
+
const storedFilePath = localStorage.getItem('file_path');
|
24 |
+
const storedCsvFilePath = localStorage.getItem('csv_file_path');
|
25 |
+
const storedOutputFilePath = localStorage.getItem('output_file_path');
|
26 |
+
|
27 |
+
// Check if values are stored and delete them
|
28 |
+
if (storedFilePath || storedCsvFilePath || storedOutputFilePath) {
|
29 |
+
localStorage.removeItem('file_path');
|
30 |
+
localStorage.removeItem('csv_file_path');
|
31 |
+
localStorage.removeItem('output_file_path');
|
32 |
+
}
|
33 |
+
}, []);
|
34 |
+
|
35 |
+
|
36 |
+
const location = useLocation();
|
37 |
+
const [selectedIndex, setSelectedIndex] = useState(
|
38 |
+
location.pathname.replace("/", "")
|
39 |
+
);
|
40 |
+
|
41 |
+
const [isVisible, setIsVisible] = useState(false);
|
42 |
+
const [files, setFile] = useState<File | null>(null);
|
43 |
+
const [filename, setFileName] = useState<string>("null");
|
44 |
+
const [NextCard, setNextCard] = useState(false);
|
45 |
+
|
46 |
+
const handleListItemClick = (index: string) => {
|
47 |
+
setSelectedIndex(index);
|
48 |
+
};
|
49 |
+
|
50 |
+
useEffect(() => {
|
51 |
+
setSelectedIndex(location.pathname.replace("/", ""));
|
52 |
+
}, [location.pathname]);
|
53 |
+
|
54 |
+
|
55 |
+
const uploadNow = () => {
|
56 |
+
//start upload function and pass the file selected as argument
|
57 |
+
};
|
58 |
+
|
59 |
+
|
60 |
+
const onDragEnter = useCallback(
|
61 |
+
(e: { stopPropagation: () => void; preventDefault: () => void }) => {
|
62 |
+
setIsVisible(true);
|
63 |
+
e.stopPropagation();
|
64 |
+
e.preventDefault();
|
65 |
+
return false;
|
66 |
+
},
|
67 |
+
[]
|
68 |
+
);
|
69 |
+
const onDragOver = useCallback(
|
70 |
+
(e: { preventDefault: () => void; stopPropagation: () => void }) => {
|
71 |
+
e.preventDefault();
|
72 |
+
e.stopPropagation();
|
73 |
+
return false;
|
74 |
+
},
|
75 |
+
[]
|
76 |
+
);
|
77 |
+
const onDragLeave = useCallback(
|
78 |
+
(e: { stopPropagation: () => void; preventDefault: () => void }) => {
|
79 |
+
setIsVisible(false);
|
80 |
+
e.stopPropagation();
|
81 |
+
e.preventDefault();
|
82 |
+
return false;
|
83 |
+
},
|
84 |
+
[]
|
85 |
+
);
|
86 |
+
const onDrop = useCallback(
|
87 |
+
(e: { preventDefault: () => void; dataTransfer: any }) => {
|
88 |
+
e.preventDefault();
|
89 |
+
const files = e.dataTransfer.files;
|
90 |
+
setFile(e.dataTransfer.files[0]);
|
91 |
+
setFileName(e.dataTransfer.files[0].name);
|
92 |
+
console.log("Files dropped: ", filename);
|
93 |
+
// Upload files
|
94 |
+
//check file type
|
95 |
+
setNextCard(true);
|
96 |
+
setIsVisible(false);
|
97 |
+
return false;
|
98 |
+
},
|
99 |
+
[]
|
100 |
+
);
|
101 |
+
|
102 |
+
useEffect(() => {
|
103 |
+
window.addEventListener("mouseup", onDragLeave);
|
104 |
+
window.addEventListener("dragenter", onDragEnter);
|
105 |
+
window.addEventListener("dragover", onDragOver);
|
106 |
+
window.addEventListener("drop", onDrop);
|
107 |
+
return () => {
|
108 |
+
window.removeEventListener("mouseup", onDragLeave);
|
109 |
+
window.removeEventListener("dragenter", onDragEnter);
|
110 |
+
window.removeEventListener("dragover", onDragOver);
|
111 |
+
window.removeEventListener("drop", onDrop);
|
112 |
+
};
|
113 |
+
}, [onDragEnter, onDragLeave, onDragOver, onDrop]);
|
114 |
+
|
115 |
+
|
116 |
+
//Modal OpenClose
|
117 |
+
const [openModal, setOpenModal] = useState(false);
|
118 |
+
const handleOpen = () => setOpenModal(true);
|
119 |
+
const handleClose = () => setOpenModal(false);
|
120 |
+
|
121 |
+
return (
|
122 |
+
<>
|
123 |
+
<MainContainer>
|
124 |
+
<Box
|
125 |
+
onDragEnter={onDragEnter}
|
126 |
+
onDragOver={onDragEnter}
|
127 |
+
onDragLeave={onDragLeave}
|
128 |
+
sx={{
|
129 |
+
justifyContent: "center",
|
130 |
+
display: "flex",
|
131 |
+
height: "99%",
|
132 |
+
alignItems: "center",
|
133 |
+
}}
|
134 |
+
>
|
135 |
+
<AudioUploader handleClose={handleClose} handleOpen={handleOpen}/>
|
136 |
+
</Box>
|
137 |
+
<GenerationModal GenerationStatus="It's working for sure" handleClose={handleClose} handleOpen={openModal}/>
|
138 |
+
</MainContainer>
|
139 |
+
</>
|
140 |
+
);
|
141 |
+
};
|
142 |
+
|
143 |
+
export default Inferrence;
|
144 |
+
|
145 |
+
interface GenerationModalProps {
|
146 |
+
GenerationStatus: string; // Replace "string" with the actual type of GenerationStatus
|
147 |
+
handleOpen : boolean;
|
148 |
+
handleClose: React.Dispatch<React.SetStateAction<boolean>>;
|
149 |
+
}
|
150 |
+
|
151 |
+
export function GenerationModal({
|
152 |
+
GenerationStatus,
|
153 |
+
handleOpen,
|
154 |
+
handleClose
|
155 |
+
}: GenerationModalProps): any {
|
156 |
+
|
157 |
+
|
158 |
+
const [statusText, setStatusText] = useState(GenerationStatus);
|
159 |
+
|
160 |
+
useEffect(() => {
|
161 |
+
// Update the displayText whenever the prop 'text' changes
|
162 |
+
setStatusText(GenerationStatus);
|
163 |
+
}, [GenerationStatus]);
|
164 |
+
|
165 |
+
return (
|
166 |
+
<div
|
167 |
+
style={{
|
168 |
+
display: "flex",
|
169 |
+
justifyContent: "center",
|
170 |
+
marginBottom: "10px",
|
171 |
+
}}
|
172 |
+
>
|
173 |
+
<Modal
|
174 |
+
open={handleOpen}
|
175 |
+
onClose={handleClose}
|
176 |
+
aria-labelledby="modal-modal-title"
|
177 |
+
aria-describedby="modal-modal-description"
|
178 |
+
>
|
179 |
+
<Box sx={style_modal}>
|
180 |
+
<Typography variant="h4">Model Running</Typography>
|
181 |
+
<div style={{ paddingTop: "10px" }}>
|
182 |
+
<Typography fontSize={"20px"}>{GenerationStatus}</Typography>
|
183 |
+
<Box sx={{ pt: 2 }}>
|
184 |
+
<LinearProgress color={"primary"} sx={{ borderRadius: "50px" }} />
|
185 |
+
</Box>
|
186 |
+
</div>
|
187 |
+
</Box>
|
188 |
+
</Modal>
|
189 |
+
</div>
|
190 |
+
);
|
191 |
+
}
|
192 |
+
|
193 |
+
const style_modal = {
|
194 |
+
position: "absolute" as "absolute",
|
195 |
+
top: "50%",
|
196 |
+
left: "50%",
|
197 |
+
transform: "translate(-50%, -50%)",
|
198 |
+
width: 500,
|
199 |
+
color: "inherit",
|
200 |
+
bgcolor: "background.paper",
|
201 |
+
p: 4,
|
202 |
+
borderRadius: "10px",
|
203 |
+
};
|
front/src/pages/Inferrence/Results/Results.tsx
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Box, Card, CardContent, Chip, Divider, Fab, Grid, LinearProgress, Stack, Typography } from "@mui/material";
|
2 |
+
import MainContainer from "../../../components/Container/MainContainer";
|
3 |
+
import { Audiotrack, ChecklistSharp, DeveloperBoard, FlashOn, LineAxis, Loop, RestartAlt, Settings, SettingsTwoTone, UploadFile } from "@mui/icons-material";
|
4 |
+
import { useCallback, useEffect, useState } from "react";
|
5 |
+
import { Link, useNavigate, useNavigation } from "react-router-dom";
|
6 |
+
import ReactAudioPlayer from "react-audio-player";
|
7 |
+
|
8 |
+
const Results = () => {
|
9 |
+
const navigate = useNavigate()
|
10 |
+
|
11 |
+
const handleRetry = () => {
|
12 |
+
// Implement retry logic here
|
13 |
+
console.log('Retry button clicked');
|
14 |
+
};
|
15 |
+
|
16 |
+
const [filePath, setFilePath] = useState('');
|
17 |
+
const [csvFilePath, setCsvFilePath] = useState(' ');
|
18 |
+
const [outputFilePath, setOutputFilePath] = useState(' ');
|
19 |
+
|
20 |
+
useEffect(() => {
|
21 |
+
// Retrieve values from localStorag
|
22 |
+
|
23 |
+
// Function to replace backslashes with forward slashes
|
24 |
+
const convertSlashes = (path: string | null ) : string => {
|
25 |
+
if(path != null){
|
26 |
+
return path.replace(/\\/g, '/');
|
27 |
+
}
|
28 |
+
return ""
|
29 |
+
}
|
30 |
+
|
31 |
+
// Update state variables with converted values
|
32 |
+
setFilePath(convertSlashes(localStorage.getItem('file_path')));
|
33 |
+
setCsvFilePath(convertSlashes(localStorage.getItem('csv_file_path')));
|
34 |
+
setOutputFilePath(convertSlashes(localStorage.getItem('output_file_path')));
|
35 |
+
}, []); // Empty dependency array ensures the useEffect runs only once on mount
|
36 |
+
|
37 |
+
|
38 |
+
return (
|
39 |
+
<MainContainer>
|
40 |
+
<Box
|
41 |
+
sx={{
|
42 |
+
justifyContent: "center",
|
43 |
+
display: "flex",
|
44 |
+
height: "99%",
|
45 |
+
alignItems: "center",
|
46 |
+
}}
|
47 |
+
>
|
48 |
+
<Stack sx={{borderRadius: '12px', gap: "30px", alignItems:"center"}}>
|
49 |
+
<Grid container spacing={2} alignItems="center" justifyContent="center">
|
50 |
+
{/* Before Card */}
|
51 |
+
<Grid item>
|
52 |
+
<Card>
|
53 |
+
<CardContent>
|
54 |
+
<Typography sx={{pt:0.5, pb: 4}} variant="h6">Sample</Typography>
|
55 |
+
{/* Add your audio player component for the 'before' state here */}
|
56 |
+
{/* Example: <AudioPlayer audioFile={beforeAudioFile} /> */}
|
57 |
+
<ReactAudioPlayer src={filePath} controls/>
|
58 |
+
</CardContent>
|
59 |
+
</Card>
|
60 |
+
</Grid>
|
61 |
+
|
62 |
+
{/* Vertical Line Divider */}
|
63 |
+
|
64 |
+
{/* After Card */}
|
65 |
+
<Grid item>
|
66 |
+
<Card>
|
67 |
+
<CardContent>
|
68 |
+
<Typography sx={{pt:0.5, pb: 4}} variant="h6">Generated</Typography>
|
69 |
+
{/* Add your audio player component for the 'before' state here */}
|
70 |
+
{/* Example: <AudioPlayer audioFile={beforeAudioFile} /> */}
|
71 |
+
<ReactAudioPlayer src={outputFilePath} controls/>
|
72 |
+
</CardContent>
|
73 |
+
</Card>
|
74 |
+
</Grid>
|
75 |
+
</Grid>
|
76 |
+
|
77 |
+
{/* Retry FAB */}
|
78 |
+
<Fab color='primary' sx={{height: "70px"}} variant='extended' component={Link} target="_blank" to={csvFilePath}>
|
79 |
+
<Audiotrack />
|
80 |
+
<Typography color="inherit" sx={{ mr: 1, fontSize: 16, fontWeight: 500, mt:0.3, ml: 2}}>Download Preset</Typography>
|
81 |
+
</Fab>
|
82 |
+
<Divider sx={{width: "5vw", py:2}}>Or</Divider>
|
83 |
+
<Fab color='surface' sx={{mt: 5, height: "70px"}} variant='extended' component={Link} to='/Inferrence'>
|
84 |
+
<RestartAlt/>
|
85 |
+
<Typography color="inherit" sx={{ mr: 1, fontSize: 16, fontWeight: 500, mt:0.3, ml: 2}}>Retry</Typography>
|
86 |
+
</Fab>
|
87 |
+
</Stack>
|
88 |
+
</Box>
|
89 |
+
</MainContainer>
|
90 |
+
);
|
91 |
+
};
|
92 |
+
|
93 |
+
export default Results;
|
94 |
+
function convertSlashes(arg0: string | null): import("react").SetStateAction<string> {
|
95 |
+
throw new Error("Function not implemented.");
|
96 |
+
}
|
97 |
+
|
front/src/pages/Layout/MainLayout.tsx
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Box, SxProps, useMediaQuery, useTheme } from "@mui/material";
|
2 |
+
import { FC, useState } from "react";
|
3 |
+
import { Outlet } from "react-router-dom";
|
4 |
+
import MainDrawer from "../../components/Drawer/MainDrawer";
|
5 |
+
import MainAppBar from "../../components/AppBar/MainAppBar";
|
6 |
+
|
7 |
+
|
8 |
+
const drawerWidth = 260;
|
9 |
+
|
10 |
+
const MainLayout: FC = () => {
|
11 |
+
|
12 |
+
const theme = useTheme();
|
13 |
+
const isSmUp = useMediaQuery(theme.breakpoints.up('md'));
|
14 |
+
|
15 |
+
const [mobileOpen, setMobileOpen] = useState(false);
|
16 |
+
|
17 |
+
const rootStyles: SxProps = {
|
18 |
+
display: 'flex',
|
19 |
+
minHeight: '100vh',
|
20 |
+
};
|
21 |
+
const navStyles: SxProps = {
|
22 |
+
width: { md: drawerWidth },
|
23 |
+
flexShrink: { md: 0 },
|
24 |
+
};
|
25 |
+
|
26 |
+
const mainStyles: SxProps = {
|
27 |
+
flex: 1,
|
28 |
+
display: 'flex',
|
29 |
+
flexDirection: 'column',
|
30 |
+
//bgcolor: '#f3f3f3'
|
31 |
+
};
|
32 |
+
const containerStyles: SxProps = {
|
33 |
+
p: 0,
|
34 |
+
flex: 1,
|
35 |
+
};
|
36 |
+
|
37 |
+
const handleDrawerToggle = () => {
|
38 |
+
setMobileOpen(!mobileOpen);
|
39 |
+
};
|
40 |
+
|
41 |
+
return (
|
42 |
+
|
43 |
+
<Box sx={rootStyles}>
|
44 |
+
<Box component="nav" sx={navStyles}>
|
45 |
+
{isSmUp ? null : (
|
46 |
+
<MainDrawer
|
47 |
+
PaperProps={{ style: { width: drawerWidth } }}
|
48 |
+
variant="temporary"
|
49 |
+
open={mobileOpen}
|
50 |
+
onClose={handleDrawerToggle}
|
51 |
+
/>
|
52 |
+
)}
|
53 |
+
<MainDrawer variant="permanent"
|
54 |
+
PaperProps={{ style: { width: drawerWidth } }}
|
55 |
+
sx={{ display: { md: 'block', sm: 'none', xs: 'none' } }} />
|
56 |
+
</Box>
|
57 |
+
<Box sx={mainStyles}>
|
58 |
+
<MainAppBar onDrawerToggle={handleDrawerToggle} />
|
59 |
+
<Box sx={containerStyles}>
|
60 |
+
<Outlet />
|
61 |
+
</Box>
|
62 |
+
</Box>
|
63 |
+
</Box>
|
64 |
+
);
|
65 |
+
}
|
66 |
+
|
67 |
+
export default MainLayout;
|
front/src/pages/pagesData.tsx
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { routerType } from "../types/router.types";
|
2 |
+
import About from "./About/About";
|
3 |
+
import Inferrence from "./Inferrence/Inferrence";
|
4 |
+
import Home from "./Home/Home";
|
5 |
+
import Express from "./Express/Express";
|
6 |
+
import Results from "./Inferrence/Results/Results";
|
7 |
+
import CustomizeVST from "./Inferrence/CustomizeVST/CustomizeVST";
|
8 |
+
|
9 |
+
const pagesData: routerType[] = [
|
10 |
+
{
|
11 |
+
path: "Home",
|
12 |
+
element: <Home />,
|
13 |
+
title: "Home",
|
14 |
+
},
|
15 |
+
{
|
16 |
+
path: "Inferrence",
|
17 |
+
element: <Inferrence/>,
|
18 |
+
title: "Inferrence"
|
19 |
+
},
|
20 |
+
{
|
21 |
+
path: "About",
|
22 |
+
element: <About />,
|
23 |
+
title: "about"
|
24 |
+
},
|
25 |
+
{
|
26 |
+
path: "Express",
|
27 |
+
element: <Express />,
|
28 |
+
title: "Express"
|
29 |
+
},
|
30 |
+
{
|
31 |
+
path: "CustomizeVST",
|
32 |
+
element: <CustomizeVST />,
|
33 |
+
title: "CustomizeVST"
|
34 |
+
},
|
35 |
+
{
|
36 |
+
path: "Results",
|
37 |
+
element: <Results/>,
|
38 |
+
title: "Results"
|
39 |
+
},
|
40 |
+
];
|
41 |
+
|
42 |
+
export default pagesData;
|
front/src/pages/router.tsx
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Navigate, Route, Routes } from "react-router-dom";
|
2 |
+
import { routerType } from "../types/router.types";
|
3 |
+
import pagesData from "./pagesData";
|
4 |
+
import MainLayout from "./Layout/MainLayout";
|
5 |
+
|
6 |
+
const Router = () => {
|
7 |
+
const pageRoutes = pagesData.map(({ path, title, element }: routerType) => {
|
8 |
+
return <Route key={title} path={`/${path}`} element={element} />;
|
9 |
+
});
|
10 |
+
|
11 |
+
return (
|
12 |
+
<Routes>
|
13 |
+
<Route element={<MainLayout />} path="/">
|
14 |
+
<Route index element={<Navigate to="/Home" replace />} />
|
15 |
+
{pageRoutes}
|
16 |
+
</Route>
|
17 |
+
</Routes>
|
18 |
+
);
|
19 |
+
};
|
20 |
+
|
21 |
+
export default Router;
|
front/src/requests/download.tsx
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import React, { useState } from 'react';
|
2 |
+
import axios from 'axios';
|
3 |
+
|
4 |
+
|
5 |
+
const AudioDownloader = () => {
|
6 |
+
|
7 |
+
const [downloadUrl, setDownloadUrl] = useState<string | null>(null);
|
8 |
+
|
9 |
+
const fileId = localStorage.getItem('uploadId');
|
10 |
+
console.log('Retrieved Upload ID:', fileId);
|
11 |
+
|
12 |
+
const handleDownload = async () => {
|
13 |
+
try {
|
14 |
+
const response = await axios.get(`http://localhost:7860/download/${fileId}`);
|
15 |
+
|
16 |
+
// Assuming the response.data contains the URL
|
17 |
+
const url = response.data.url;
|
18 |
+
const server = 'http://localhost:7860'
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
// Set the download URL in the state
|
23 |
+
setDownloadUrl(`${server}/${url}`);
|
24 |
+
} catch (error) {
|
25 |
+
console.error('Error fetching download URL:', error);
|
26 |
+
}
|
27 |
+
};
|
28 |
+
|
29 |
+
const handleClear = () => {
|
30 |
+
// Clear the download URL from the state
|
31 |
+
setDownloadUrl(null);
|
32 |
+
};
|
33 |
+
|
34 |
+
return (
|
35 |
+
<div>
|
36 |
+
<button onClick={handleDownload}>Download Audio</button>
|
37 |
+
{downloadUrl && (
|
38 |
+
<div>
|
39 |
+
<a href={downloadUrl} download={`downloadUrl`}>
|
40 |
+
Download Link
|
41 |
+
</a>
|
42 |
+
<button onClick={handleClear}>Clear Download Link</button>
|
43 |
+
</div>
|
44 |
+
)}
|
45 |
+
</div>
|
46 |
+
);
|
47 |
+
};
|
48 |
+
|
49 |
+
export default AudioDownloader;
|
front/src/requests/upload.tsx
ADDED
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import React, {
|
2 |
+
ChangeEvent,
|
3 |
+
useCallback,
|
4 |
+
useContext,
|
5 |
+
useEffect,
|
6 |
+
useRef,
|
7 |
+
useState,
|
8 |
+
} from "react";
|
9 |
+
import axios from "axios";
|
10 |
+
import { useNavigate } from "react-router-dom";
|
11 |
+
import { Delete, UploadFile } from "@mui/icons-material";
|
12 |
+
import {
|
13 |
+
Card,
|
14 |
+
Box,
|
15 |
+
CardContent,
|
16 |
+
Typography,
|
17 |
+
CardActions,
|
18 |
+
Button,
|
19 |
+
} from "@mui/material";
|
20 |
+
import { ThemeSchemeContext, ThemeModeContext } from "../theme";
|
21 |
+
|
22 |
+
const AudioUploader = ({ ...props }) => {
|
23 |
+
const { themeScheme } = useContext(ThemeSchemeContext);
|
24 |
+
const { themeMode } = useContext(ThemeModeContext);
|
25 |
+
const light = themeScheme[themeMode];
|
26 |
+
|
27 |
+
const navigate = useNavigate();
|
28 |
+
const [isVisible, setIsVisible] = useState(false);
|
29 |
+
const [NextCard, setNextCard] = useState(false);
|
30 |
+
const [isError, setIsError] = useState(false);
|
31 |
+
|
32 |
+
const [audioFile, setAudioFile] = useState<File | null>(null);
|
33 |
+
|
34 |
+
const [uploadStatus, setUploadStatus] = useState("");
|
35 |
+
const inputFile = useRef<HTMLInputElement | null>(null);
|
36 |
+
|
37 |
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
38 |
+
|
39 |
+
const onDragEnter = useCallback(
|
40 |
+
(e: { stopPropagation: () => void; preventDefault: () => void }) => {
|
41 |
+
setIsVisible(true);
|
42 |
+
e.stopPropagation();
|
43 |
+
e.preventDefault();
|
44 |
+
return false;
|
45 |
+
},
|
46 |
+
[]
|
47 |
+
);
|
48 |
+
const onDragOver = useCallback(
|
49 |
+
(e: { preventDefault: () => void; stopPropagation: () => void }) => {
|
50 |
+
e.preventDefault();
|
51 |
+
e.stopPropagation();
|
52 |
+
return false;
|
53 |
+
},
|
54 |
+
[]
|
55 |
+
);
|
56 |
+
const onDragLeave = useCallback(
|
57 |
+
(e: { stopPropagation: () => void; preventDefault: () => void }) => {
|
58 |
+
setIsVisible(false);
|
59 |
+
e.stopPropagation();
|
60 |
+
e.preventDefault();
|
61 |
+
return false;
|
62 |
+
},
|
63 |
+
[]
|
64 |
+
);
|
65 |
+
const onDrop = useCallback(
|
66 |
+
(e: { preventDefault: () => void; dataTransfer: any }) => {
|
67 |
+
e.preventDefault();
|
68 |
+
setAudioFile(e.dataTransfer.files[0]);
|
69 |
+
console.log("Files dropped: ", audioFile!.name);
|
70 |
+
setNextCard(true);
|
71 |
+
setIsVisible(false);
|
72 |
+
return false;
|
73 |
+
},
|
74 |
+
[]
|
75 |
+
);
|
76 |
+
|
77 |
+
useEffect(() => {
|
78 |
+
window.addEventListener("mouseup", onDragLeave);
|
79 |
+
window.addEventListener("dragenter", onDragEnter);
|
80 |
+
window.addEventListener("dragover", onDragOver);
|
81 |
+
window.addEventListener("drop", onDrop);
|
82 |
+
return () => {
|
83 |
+
window.removeEventListener("mouseup", onDragLeave);
|
84 |
+
window.removeEventListener("dragenter", onDragEnter);
|
85 |
+
window.removeEventListener("dragover", onDragOver);
|
86 |
+
window.removeEventListener("drop", onDrop);
|
87 |
+
};
|
88 |
+
}, [onDragEnter, onDragLeave, onDragOver, onDrop]);
|
89 |
+
|
90 |
+
const handleFileChange = (event: ChangeEvent<HTMLInputElement>) => {
|
91 |
+
const file = event.target.files?.[0];
|
92 |
+
if (file) {
|
93 |
+
setAudioFile(file);
|
94 |
+
setNextCard(true);
|
95 |
+
}
|
96 |
+
};
|
97 |
+
|
98 |
+
const onButtonClick = () => {
|
99 |
+
// `current` points to the mounted file input element
|
100 |
+
inputFile?.current?.click();
|
101 |
+
};
|
102 |
+
|
103 |
+
const handleUpload = async () => {
|
104 |
+
if (audioFile) {
|
105 |
+
try {
|
106 |
+
const form = new FormData();
|
107 |
+
|
108 |
+
if (audioFile) {
|
109 |
+
const blob = new Blob([audioFile], {
|
110 |
+
type: "application/octet-stream",
|
111 |
+
});
|
112 |
+
const audio_file = new File([blob], audioFile.name, {
|
113 |
+
type: blob.type,
|
114 |
+
});
|
115 |
+
form.append("file", audio_file);
|
116 |
+
}
|
117 |
+
|
118 |
+
const response = await axios.post(
|
119 |
+
"http://localhost:7860/upload/",
|
120 |
+
form,
|
121 |
+
{
|
122 |
+
headers: { Accept: "multipart/form-data" },
|
123 |
+
responseType: "blob",
|
124 |
+
}
|
125 |
+
);
|
126 |
+
|
127 |
+
setUploadStatus("Upload successful. Waiting for generation...");
|
128 |
+
console.log("Upload successful:", response);
|
129 |
+
|
130 |
+
// Extract JSON from the blob
|
131 |
+
const blobText = await response.data.text();
|
132 |
+
const jsonFromBlob = JSON.parse(blobText);
|
133 |
+
// Assuming the 'id' property is part of the JSON
|
134 |
+
const file_path = jsonFromBlob.file_path;
|
135 |
+
const csv_file_path = jsonFromBlob.csv_path;
|
136 |
+
const output_file_path = jsonFromBlob.output_file_path;
|
137 |
+
// Store the ID in localStorage
|
138 |
+
localStorage.setItem("file_path", file_path);
|
139 |
+
// Store the ID in localStorage
|
140 |
+
localStorage.setItem("csv_file_path", csv_file_path);
|
141 |
+
// Store the ID in localStorage
|
142 |
+
localStorage.setItem("output_file_path", output_file_path);
|
143 |
+
|
144 |
+
// Start uploading
|
145 |
+
navigate("/Results");
|
146 |
+
// setUploadStatus('Generation complete!');
|
147 |
+
} catch (error) {
|
148 |
+
console.error("Error:", error);
|
149 |
+
props.handleClose();
|
150 |
+
setIsError(true);
|
151 |
+
setNextCard(false);
|
152 |
+
setUploadStatus(`Error: ${error}`);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
};
|
156 |
+
|
157 |
+
return (
|
158 |
+
<>
|
159 |
+
<Box sx={{ display: "grid", gap: "1vh" }}>
|
160 |
+
<PaletteSwatch
|
161 |
+
title={uploadStatus}
|
162 |
+
titleColor={light.errorContainer}
|
163 |
+
onTitle={uploadStatus}
|
164 |
+
onTitleColor={light.onErrorContainer}
|
165 |
+
visible={isError}
|
166 |
+
/>
|
167 |
+
<Card variant={isVisible ? "outlined" : "filled"}>
|
168 |
+
<Box sx={{ display: NextCard ? "none" : "inherit" }}>
|
169 |
+
<CardContent sx={{ display: "grid", justifyItems: "center" }}>
|
170 |
+
<Typography gutterBottom variant="h5" sx={{ pb: 3 }}>
|
171 |
+
{isVisible
|
172 |
+
? "Drop here to upload"
|
173 |
+
: "Drag a file to start inferrence"}
|
174 |
+
</Typography>
|
175 |
+
<UploadFile sx={{ fontSize: "35px", color: "inherit" }} />
|
176 |
+
</CardContent>
|
177 |
+
<CardActions sx={{ display: "flex", justifyContent: "flex-end" }}>
|
178 |
+
<input
|
179 |
+
type="file"
|
180 |
+
accept="audio/*"
|
181 |
+
ref={inputFile}
|
182 |
+
style={{ display: "none" }}
|
183 |
+
onChange={handleFileChange}
|
184 |
+
/>
|
185 |
+
|
186 |
+
<Button
|
187 |
+
variant="filled"
|
188 |
+
size="small"
|
189 |
+
onClick={() => onButtonClick()}
|
190 |
+
>
|
191 |
+
Upload
|
192 |
+
</Button>
|
193 |
+
</CardActions>
|
194 |
+
</Box>
|
195 |
+
<Box sx={{ display: NextCard ? "inherit" : "none" }}>
|
196 |
+
<CardContent
|
197 |
+
sx={{
|
198 |
+
display: "flex",
|
199 |
+
justifyItems: "center",
|
200 |
+
flexDirection: "column",
|
201 |
+
alignItems: "flex-end",
|
202 |
+
gap: "1vh",
|
203 |
+
}}
|
204 |
+
>
|
205 |
+
<Box sx={{ mr: "1" }}>
|
206 |
+
<Button
|
207 |
+
variant="outlined"
|
208 |
+
size="small"
|
209 |
+
onClick={() => {
|
210 |
+
setNextCard(false);
|
211 |
+
setIsVisible(false);
|
212 |
+
}}
|
213 |
+
>
|
214 |
+
<Delete />
|
215 |
+
</Button>
|
216 |
+
</Box>
|
217 |
+
<Typography fontFamily={"monospace"} fontSize={"15pt"}>
|
218 |
+
{audioFile?.name}
|
219 |
+
</Typography>
|
220 |
+
</CardContent>
|
221 |
+
<CardActions sx={{ display: "flex", justifyContent: "center" }}>
|
222 |
+
<Button
|
223 |
+
variant="filled"
|
224 |
+
size="medium"
|
225 |
+
onClick={() => handleUpload()}
|
226 |
+
>
|
227 |
+
Confirm
|
228 |
+
</Button>
|
229 |
+
</CardActions>
|
230 |
+
</Box>
|
231 |
+
</Card>
|
232 |
+
</Box>
|
233 |
+
</>
|
234 |
+
);
|
235 |
+
};
|
236 |
+
|
237 |
+
export default AudioUploader;
|
238 |
+
|
239 |
+
const PaletteSwatch = ({ onTitle, titleColor, onTitleColor, visible }: any) => {
|
240 |
+
return (
|
241 |
+
<Box
|
242 |
+
sx={{
|
243 |
+
p: 1.5,
|
244 |
+
borderRadius: "10px",
|
245 |
+
bgcolor: onTitleColor,
|
246 |
+
color: titleColor,
|
247 |
+
visibility: visible ? "visible" : "collapse",
|
248 |
+
}}
|
249 |
+
>
|
250 |
+
<Typography fontSize={12} fontWeight={"bold"}>
|
251 |
+
{onTitle}
|
252 |
+
</Typography>
|
253 |
+
</Box>
|
254 |
+
);
|
255 |
+
};
|
front/src/theme/M3/M3.tsx
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
import ThemeModeProvider from "./providers/ThemeModeProvider";
|
4 |
+
import ThemeSchemeProvider from "./providers/ThemeSchemeProvider";
|
5 |
+
import M3Theme from "./wrapper/M3Theme";
|
6 |
+
|
7 |
+
interface M3Props {
|
8 |
+
children?: React.ReactNode;
|
9 |
+
};
|
10 |
+
|
11 |
+
const M3 = ({ children }: M3Props) => {
|
12 |
+
|
13 |
+
return (
|
14 |
+
// ThemeModeProvider -> ThemeSchemeProvider
|
15 |
+
<ThemeModeProvider>
|
16 |
+
<ThemeSchemeProvider>
|
17 |
+
<M3Theme>
|
18 |
+
{children}
|
19 |
+
</M3Theme>
|
20 |
+
</ThemeSchemeProvider>
|
21 |
+
</ThemeModeProvider >
|
22 |
+
);
|
23 |
+
}
|
24 |
+
|
25 |
+
export default M3;
|
front/src/theme/M3/components/Accordion.ts
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import {
|
3 |
+
Theme,
|
4 |
+
ComponentsProps, ComponentsOverrides, ComponentsVariants
|
5 |
+
} from '@mui/material';
|
6 |
+
|
7 |
+
interface M3Accordion {
|
8 |
+
MuiAccordion: {
|
9 |
+
defaultProps?: ComponentsProps['MuiAccordion'];
|
10 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiAccordion'];
|
11 |
+
variants?: ComponentsVariants['MuiAccordion'];
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
export const getAccordion = (theme: Theme): M3Accordion => {
|
16 |
+
const { palette } = theme;
|
17 |
+
return {
|
18 |
+
MuiAccordion: {
|
19 |
+
styleOverrides: {
|
20 |
+
root: {
|
21 |
+
boxShadow: theme.shadows[1],
|
22 |
+
border: `0px solid ${palette.outlineVariant.main}`,
|
23 |
+
color: palette.onBackground.main,
|
24 |
+
backgroundColor: palette.surfaceBright.main,
|
25 |
+
'&:before': {
|
26 |
+
backgroundColor: palette.surfaceBright.main,
|
27 |
+
display: 'none'
|
28 |
+
},
|
29 |
+
'&.Mui-disabled': {
|
30 |
+
backgroundColor: palette.inverseOnSurface.main,
|
31 |
+
color: palette.inverseSurface.main,
|
32 |
+
border: `0px solid ${palette.outlineVariant.main}`,
|
33 |
+
},
|
34 |
+
'& .MuiAccordionSummary-root > .MuiAccordionSummary-expandIconWrapper ': {
|
35 |
+
color: palette.onBackground.main,
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
};
|
41 |
+
}
|
front/src/theme/M3/components/Alert.ts
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants } from "@mui/material";
|
2 |
+
|
3 |
+
interface M3Alert {
|
4 |
+
MuiAlert: {
|
5 |
+
defaultProps?: ComponentsProps['MuiAlert'];
|
6 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiAlert'];
|
7 |
+
variants?: ComponentsVariants['MuiAlert'];
|
8 |
+
}
|
9 |
+
};
|
10 |
+
|
11 |
+
export const getAlert = (theme: Theme): M3Alert => {
|
12 |
+
const { palette } = theme;
|
13 |
+
return {
|
14 |
+
MuiAlert: {
|
15 |
+
defaultProps: {
|
16 |
+
variant: 'standard'
|
17 |
+
},
|
18 |
+
styleOverrides: {
|
19 |
+
root: {
|
20 |
+
borderRadius: '20px'
|
21 |
+
},
|
22 |
+
standardError: {
|
23 |
+
background: palette.errorContainer.main,
|
24 |
+
color: palette.onErrorContainer.main
|
25 |
+
},
|
26 |
+
standardInfo: {
|
27 |
+
background: palette.infoContainer.main,
|
28 |
+
color: palette.infoContainer.contrastText
|
29 |
+
},
|
30 |
+
standardWarning: {
|
31 |
+
background: palette.warningContainer.main,
|
32 |
+
color: palette.onWarningContainer.main
|
33 |
+
},
|
34 |
+
standardSuccess: {
|
35 |
+
background: palette.successContainer.main,
|
36 |
+
color: palette.onSuccessContainer.main
|
37 |
+
},
|
38 |
+
|
39 |
+
filledError: {
|
40 |
+
background: palette.error.main,
|
41 |
+
color: palette.onError.main
|
42 |
+
},
|
43 |
+
filledInfo: {
|
44 |
+
background: palette.info.main,
|
45 |
+
color: palette.onInfo.main
|
46 |
+
},
|
47 |
+
filledWarning: {
|
48 |
+
background: palette.warning.main,
|
49 |
+
color: palette.onWarning.main
|
50 |
+
},
|
51 |
+
filledSuccess: {
|
52 |
+
background: palette.success.main,
|
53 |
+
color: palette.onSuccess.main
|
54 |
+
},
|
55 |
+
|
56 |
+
outlinedError: {
|
57 |
+
color: palette.error.main
|
58 |
+
},
|
59 |
+
outlinedInfo: {
|
60 |
+
color: palette.info.main
|
61 |
+
},
|
62 |
+
outlinedWarning: {
|
63 |
+
color: palette.warning.main
|
64 |
+
},
|
65 |
+
outlinedSuccess: {
|
66 |
+
color: palette.success.main
|
67 |
+
},
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
front/src/theme/M3/components/AppBar.ts
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import {
|
3 |
+
Theme,
|
4 |
+
ComponentsProps, ComponentsOverrides, ComponentsVariants
|
5 |
+
} from '@mui/material';
|
6 |
+
|
7 |
+
interface M3AppBar {
|
8 |
+
MuiAppBar: {
|
9 |
+
defaultProps?: ComponentsProps['MuiAppBar'];
|
10 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiAppBar'];
|
11 |
+
variants?: ComponentsVariants['MuiAppBar'];
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
export const getAppBar = (theme: Theme): M3AppBar => {
|
16 |
+
const { palette } = theme;
|
17 |
+
return {
|
18 |
+
MuiAppBar: {
|
19 |
+
defaultProps: {
|
20 |
+
elevation: 0,
|
21 |
+
color: 'default'
|
22 |
+
},
|
23 |
+
styleOverrides: {
|
24 |
+
colorDefault: {
|
25 |
+
background: palette.surfaceContainer.main,
|
26 |
+
color: palette.onSurface.main
|
27 |
+
},
|
28 |
+
colorPrimary: {
|
29 |
+
background: palette.surface.main,
|
30 |
+
color: palette.onSurface.main
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
};
|
35 |
+
}
|
front/src/theme/M3/components/Badge.ts
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import {
|
3 |
+
Theme,
|
4 |
+
ComponentsProps, ComponentsOverrides, ComponentsVariants
|
5 |
+
} from '@mui/material';
|
6 |
+
|
7 |
+
declare module '@mui/material/Badge' {
|
8 |
+
interface BadgePropsColorOverrides {
|
9 |
+
tertiary: true;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
interface M3Badge {
|
14 |
+
MuiBadge: {
|
15 |
+
defaultProps?: ComponentsProps['MuiBadge'];
|
16 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiBadge'];
|
17 |
+
variants?: ComponentsVariants['MuiBadge'];
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
export const getBadge = (theme: Theme): M3Badge => {
|
22 |
+
const { palette } = theme;
|
23 |
+
return {
|
24 |
+
MuiBadge: {
|
25 |
+
defaultProps: { color: 'default' },
|
26 |
+
variants: [
|
27 |
+
{
|
28 |
+
props: { color: 'default' },
|
29 |
+
style: {
|
30 |
+
'.MuiBadge-badge': {
|
31 |
+
backgroundColor: palette.error.main,
|
32 |
+
color: palette.onError.main
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
]
|
37 |
+
}
|
38 |
+
};
|
39 |
+
}
|
front/src/theme/M3/components/Button.ts
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import {
|
3 |
+
Theme,
|
4 |
+
ComponentsProps, ComponentsOverrides, ComponentsVariants, alpha
|
5 |
+
} from '@mui/material';
|
6 |
+
import { StateLayer, getStateLayerColor } from '../..';
|
7 |
+
|
8 |
+
declare module '@mui/material/Button' {
|
9 |
+
interface ButtonPropsVariantOverrides {
|
10 |
+
elevated: true;
|
11 |
+
filled: true;
|
12 |
+
tonal: true;
|
13 |
+
outlined: true;
|
14 |
+
text: true;
|
15 |
+
contained: false;
|
16 |
+
}
|
17 |
+
interface ButtonPropsColorOverrides {
|
18 |
+
tertiary: true;
|
19 |
+
surface: true;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
interface M3Button {
|
24 |
+
MuiButton: {
|
25 |
+
defaultProps?: ComponentsProps['MuiButton'];
|
26 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiButton'];
|
27 |
+
variants?: ComponentsVariants['MuiButton'];
|
28 |
+
}
|
29 |
+
}
|
30 |
+
export const getButton = (theme: Theme): M3Button => {
|
31 |
+
const { palette } = theme;
|
32 |
+
return {
|
33 |
+
MuiButton: {
|
34 |
+
styleOverrides: {
|
35 |
+
root: {
|
36 |
+
borderRadius: '30px',
|
37 |
+
textTransform: 'none',
|
38 |
+
fontWeight: 'bold',
|
39 |
+
'&:has(>svg)': {
|
40 |
+
padding: '8px',
|
41 |
+
borderRadius: '50%',
|
42 |
+
minWidth: '1em',
|
43 |
+
minHeight: '1em'
|
44 |
+
}
|
45 |
+
}
|
46 |
+
},
|
47 |
+
variants: [
|
48 |
+
{
|
49 |
+
props: { variant: 'elevated' },
|
50 |
+
style: {
|
51 |
+
boxShadow: theme.shadows[1],
|
52 |
+
backgroundColor: palette.surfaceContainerLow.main,
|
53 |
+
color: palette.primary.main,
|
54 |
+
'&:hover': {
|
55 |
+
background: getStateLayerColor(StateLayer.Hover, palette.surfaceContainerLow.main, palette.primary.main),
|
56 |
+
boxShadow: theme.shadows[2]
|
57 |
+
},
|
58 |
+
'&:focus': {
|
59 |
+
background: getStateLayerColor(StateLayer.Focus, palette.surfaceContainerLow.main, palette.primary.main)
|
60 |
+
},
|
61 |
+
'&:active': {
|
62 |
+
background: getStateLayerColor(StateLayer.Press, palette.surfaceContainerLow.main, palette.primary.main)
|
63 |
+
},
|
64 |
+
'&.Mui-disabled': {
|
65 |
+
backgroundColor: alpha(palette.onSurface.main, 0.12),
|
66 |
+
color: alpha(palette.onSurface.main, 0.38),
|
67 |
+
boxShadow: theme.shadows[0]
|
68 |
+
},
|
69 |
+
}
|
70 |
+
},
|
71 |
+
{
|
72 |
+
props: { variant: 'filled' },
|
73 |
+
style: {
|
74 |
+
backgroundColor: palette.primary.main,
|
75 |
+
color: palette.onPrimary.main,
|
76 |
+
boxShadow: theme.shadows[0],
|
77 |
+
'&.Mui-disabled': {
|
78 |
+
backgroundColor: alpha(palette.onSurface.main, 0.12),
|
79 |
+
color: alpha(palette.onSurface.main, 0.38),
|
80 |
+
boxShadow: theme.shadows[0]
|
81 |
+
},
|
82 |
+
'&:hover': {
|
83 |
+
backgroundColor: getStateLayerColor(StateLayer.Hover, palette.primary.main, palette.onPrimary.main),
|
84 |
+
boxShadow: theme.shadows[1],
|
85 |
+
},
|
86 |
+
'&:focus': {
|
87 |
+
backgroundColor: getStateLayerColor(StateLayer.Focus, palette.primary.main, palette.onPrimary.main),
|
88 |
+
boxShadow: theme.shadows[0],
|
89 |
+
},
|
90 |
+
'&:active': {
|
91 |
+
backgroundColor: getStateLayerColor(StateLayer.Press, palette.primary.main, palette.onPrimary.main),
|
92 |
+
boxShadow: theme.shadows[0],
|
93 |
+
}
|
94 |
+
}
|
95 |
+
},
|
96 |
+
{
|
97 |
+
props: { variant: 'tonal' },
|
98 |
+
style: {
|
99 |
+
backgroundColor: palette.secondaryContainer.main,
|
100 |
+
color: palette.onSecondaryContainer.main,
|
101 |
+
boxShadow: theme.shadows[0],
|
102 |
+
'&.Mui-disabled': {
|
103 |
+
backgroundColor: alpha(palette.onSurface.main, 0.12),
|
104 |
+
color: alpha(palette.onSurface.main, 0.38),
|
105 |
+
boxShadow: theme.shadows[0]
|
106 |
+
},
|
107 |
+
'&:hover': {
|
108 |
+
backgroundColor: getStateLayerColor(StateLayer.Hover, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
109 |
+
boxShadow: theme.shadows[1],
|
110 |
+
},
|
111 |
+
'&:focus': {
|
112 |
+
backgroundColor: getStateLayerColor(StateLayer.Focus, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
113 |
+
boxShadow: theme.shadows[0],
|
114 |
+
},
|
115 |
+
'&:active': {
|
116 |
+
backgroundColor: getStateLayerColor(StateLayer.Press, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
117 |
+
boxShadow: theme.shadows[0],
|
118 |
+
}
|
119 |
+
}
|
120 |
+
},
|
121 |
+
{
|
122 |
+
props: { variant: 'outlined' },
|
123 |
+
style: {
|
124 |
+
//backgroundColor: palette.surface.main,
|
125 |
+
color: palette.primary.main,
|
126 |
+
borderColor: palette.outline.main,
|
127 |
+
borderWidth: '1px',
|
128 |
+
boxShadow: theme.shadows[0],
|
129 |
+
'&.Mui-disabled': {
|
130 |
+
borderColor: alpha(palette.onSurface.main, 0.12),
|
131 |
+
color: alpha(palette.onSurface.main, 0.38),
|
132 |
+
},
|
133 |
+
'&:hover': {
|
134 |
+
backgroundColor: getStateLayerColor(StateLayer.Hover, palette.surface.main, palette.primary.main),
|
135 |
+
borderColor: getStateLayerColor(StateLayer.Hover, palette.outline.main, palette.primary.main),
|
136 |
+
},
|
137 |
+
'&:focus': {
|
138 |
+
backgroundColor: getStateLayerColor(StateLayer.Focus, palette.surface.main, palette.primary.main),
|
139 |
+
borderColor: getStateLayerColor(StateLayer.Focus, palette.primary.main, palette.primary.main),
|
140 |
+
},
|
141 |
+
'&:active': {
|
142 |
+
backgroundColor: getStateLayerColor(StateLayer.Press, palette.surface.main, palette.primary.main),
|
143 |
+
borderColor: getStateLayerColor(StateLayer.Press, palette.outline.main, palette.primary.main),
|
144 |
+
}
|
145 |
+
}
|
146 |
+
},
|
147 |
+
{
|
148 |
+
props: { variant: 'text' },
|
149 |
+
style: {
|
150 |
+
backgroundColor: 'transparent',
|
151 |
+
color: palette.primary.main,
|
152 |
+
boxShadow: theme.shadows[0],
|
153 |
+
padding: '5px 15px',
|
154 |
+
'&.Mui-disabled': {
|
155 |
+
color: alpha(palette.onSurface.main, 0.38),
|
156 |
+
},
|
157 |
+
'&:hover': {
|
158 |
+
backgroundColor: getStateLayerColor(StateLayer.Hover, palette.surface.main, palette.primary.main),
|
159 |
+
},
|
160 |
+
'&:focus': {
|
161 |
+
backgroundColor: getStateLayerColor(StateLayer.Focus, palette.surface.main, palette.primary.main),
|
162 |
+
},
|
163 |
+
'&:active': {
|
164 |
+
backgroundColor: getStateLayerColor(StateLayer.Press, palette.surface.main, palette.primary.main),
|
165 |
+
},
|
166 |
+
}
|
167 |
+
}
|
168 |
+
]
|
169 |
+
}
|
170 |
+
};
|
171 |
+
}
|
front/src/theme/M3/components/Card.ts
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import {
|
3 |
+
Theme,
|
4 |
+
ComponentsProps, ComponentsOverrides, ComponentsVariants
|
5 |
+
} from '@mui/material';
|
6 |
+
import { StateLayer, getStateLayerColor } from '../..';
|
7 |
+
import { alpha } from '@mui/material';
|
8 |
+
|
9 |
+
declare module '@mui/material/Paper' {
|
10 |
+
interface PaperPropsVariantOverrides {
|
11 |
+
filled: true;
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
interface M3Card {
|
16 |
+
MuiCard: {
|
17 |
+
defaultProps?: ComponentsProps['MuiCard'];
|
18 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiCard'];
|
19 |
+
variants?: ComponentsVariants['MuiCard'];
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
export const getCard = (theme: Theme): M3Card => {
|
24 |
+
const { palette } = theme;
|
25 |
+
return {
|
26 |
+
MuiCard: {
|
27 |
+
styleOverrides: {
|
28 |
+
root: {
|
29 |
+
borderRadius: '20px',
|
30 |
+
padding: '10px 6px'
|
31 |
+
}
|
32 |
+
},
|
33 |
+
variants: [
|
34 |
+
{
|
35 |
+
props: { variant: 'elevation' },
|
36 |
+
style: {
|
37 |
+
boxShadow: theme.shadows[1],
|
38 |
+
backgroundColor: palette.surfaceContainerLow.main,
|
39 |
+
transition: theme.transitions.create(
|
40 |
+
['background-color', 'box-shadow', 'border-color', 'color'],
|
41 |
+
{
|
42 |
+
duration: theme.transitions.duration.short,
|
43 |
+
},
|
44 |
+
),
|
45 |
+
'&:hover': {
|
46 |
+
background: getStateLayerColor(StateLayer.Hover, palette.surfaceContainerLow.main, palette.primary.main),
|
47 |
+
boxShadow: theme.shadows[2]
|
48 |
+
},
|
49 |
+
'&:focus': {
|
50 |
+
boxShadow: theme.shadows[1],
|
51 |
+
background: getStateLayerColor(StateLayer.Focus, palette.surfaceContainerLow.main, palette.primary.main)
|
52 |
+
},
|
53 |
+
'&:active': {
|
54 |
+
boxShadow: theme.shadows[1],
|
55 |
+
background: getStateLayerColor(StateLayer.Press, palette.surfaceContainerLow.main, palette.primary.main)
|
56 |
+
},
|
57 |
+
'&.Mui-disabled': {
|
58 |
+
backgroundColor: alpha(palette.surfaceContainerLow.main, 0.38),
|
59 |
+
color: palette.surfaceVariant.main,
|
60 |
+
boxShadow: theme.shadows[0]
|
61 |
+
},
|
62 |
+
}
|
63 |
+
},
|
64 |
+
{
|
65 |
+
props: { variant: 'filled' },
|
66 |
+
style: {
|
67 |
+
boxShadow: theme.shadows[0],
|
68 |
+
backgroundColor: palette.surfaceContainerHighest.main,
|
69 |
+
transition: theme.transitions.create(
|
70 |
+
['background-color', 'box-shadow', 'border-color', 'color'],
|
71 |
+
{
|
72 |
+
duration: theme.transitions.duration.short,
|
73 |
+
},
|
74 |
+
),
|
75 |
+
'&:hover': {
|
76 |
+
background: getStateLayerColor(StateLayer.Hover, palette.surfaceContainerHighest.main, palette.primary.main),
|
77 |
+
boxShadow: theme.shadows[1]
|
78 |
+
},
|
79 |
+
'&:focus': {
|
80 |
+
boxShadow: theme.shadows[0],
|
81 |
+
background: getStateLayerColor(StateLayer.Focus, palette.surfaceContainerHighest.main, palette.primary.main)
|
82 |
+
},
|
83 |
+
'&:active': {
|
84 |
+
boxShadow: theme.shadows[1],
|
85 |
+
background: getStateLayerColor(StateLayer.Press, palette.surfaceContainerHighest.main, palette.primary.main)
|
86 |
+
},
|
87 |
+
'&.Mui-disabled': {
|
88 |
+
backgroundColor: alpha(palette.surfaceContainerHighest.main, 0.38),
|
89 |
+
color: palette.surfaceVariant.main,
|
90 |
+
boxShadow: theme.shadows[1]
|
91 |
+
},
|
92 |
+
}
|
93 |
+
},
|
94 |
+
{
|
95 |
+
props: { variant: 'outlined' },
|
96 |
+
style: {
|
97 |
+
boxShadow: theme.shadows[0],
|
98 |
+
backgroundColor: palette.surface.main,
|
99 |
+
borderColor: palette.outline.main,
|
100 |
+
transition: theme.transitions.create(
|
101 |
+
['background-color', 'box-shadow', 'border-color', 'color'],
|
102 |
+
{
|
103 |
+
duration: theme.transitions.duration.short,
|
104 |
+
},
|
105 |
+
),
|
106 |
+
'&:hover': {
|
107 |
+
background: getStateLayerColor(StateLayer.Hover, palette.surface.main, palette.primary.main),
|
108 |
+
boxShadow: theme.shadows[1]
|
109 |
+
},
|
110 |
+
'&:focus': {
|
111 |
+
boxShadow: theme.shadows[0],
|
112 |
+
background: getStateLayerColor(StateLayer.Focus, palette.surface.main, palette.primary.main)
|
113 |
+
},
|
114 |
+
'&:active': {
|
115 |
+
boxShadow: theme.shadows[2],
|
116 |
+
background: getStateLayerColor(StateLayer.Press, palette.surfaceContainerHighest.main, palette.primary.main)
|
117 |
+
},
|
118 |
+
'&.Mui-disabled': {
|
119 |
+
borderColor: alpha(palette.surfaceContainerHighest.main, 0.12),
|
120 |
+
boxShadow: theme.shadows[0]
|
121 |
+
},
|
122 |
+
}
|
123 |
+
}
|
124 |
+
]
|
125 |
+
}
|
126 |
+
};
|
127 |
+
}
|
front/src/theme/M3/components/CssBaseline.ts
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants } from "@mui/material";
|
2 |
+
|
3 |
+
interface M3CssBaseline {
|
4 |
+
MuiCssBaseline: {
|
5 |
+
defaultProps?: ComponentsProps['MuiCssBaseline'];
|
6 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiCssBaseline'];
|
7 |
+
variants?: ComponentsVariants['MuiCssBaseline'];
|
8 |
+
}
|
9 |
+
};
|
10 |
+
|
11 |
+
export const getCssBaseline = (_theme: Theme): M3CssBaseline => {
|
12 |
+
return {
|
13 |
+
MuiCssBaseline: {
|
14 |
+
defaultProps: {
|
15 |
+
enableColorScheme: true,
|
16 |
+
|
17 |
+
},
|
18 |
+
styleOverrides: {
|
19 |
+
'*::-webkit-scrollbar': {
|
20 |
+
'display': 'none'
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
front/src/theme/M3/components/Drawer.ts
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants } from "@mui/material";
|
2 |
+
|
3 |
+
interface M3Drawer {
|
4 |
+
MuiDrawer: {
|
5 |
+
defaultProps?: ComponentsProps['MuiDrawer'];
|
6 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiDrawer'];
|
7 |
+
variants?: ComponentsVariants['MuiDrawer'];
|
8 |
+
}
|
9 |
+
};
|
10 |
+
|
11 |
+
export const getDrawer = (theme: Theme): M3Drawer => {
|
12 |
+
const { palette } = theme;
|
13 |
+
return {
|
14 |
+
MuiDrawer: {
|
15 |
+
styleOverrides: {
|
16 |
+
paper: {
|
17 |
+
border: '0px',
|
18 |
+
background: palette.surfaceContainer.main,
|
19 |
+
color: palette.onSurfaceVariant.main
|
20 |
+
}
|
21 |
+
}
|
22 |
+
},
|
23 |
+
}
|
24 |
+
}
|
front/src/theme/M3/components/Fab.ts
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants } from "@mui/material";
|
2 |
+
import { StateLayer, getStateLayerColor } from "../..";
|
3 |
+
|
4 |
+
interface M3Fab {
|
5 |
+
MuiFab: {
|
6 |
+
defaultProps?: ComponentsProps['MuiFab'];
|
7 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiFab'];
|
8 |
+
variants?: ComponentsVariants['MuiFab'];
|
9 |
+
}
|
10 |
+
};
|
11 |
+
|
12 |
+
declare module '@mui/material/Fab' {
|
13 |
+
interface FabPropsColorOverrides {
|
14 |
+
primary: true,
|
15 |
+
surface: true,
|
16 |
+
secondary: true,
|
17 |
+
tertiary: true,
|
18 |
+
|
19 |
+
success: false,
|
20 |
+
info: false,
|
21 |
+
warning: false,
|
22 |
+
error: false,
|
23 |
+
default: false,
|
24 |
+
inherit: false
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
export const getFab = (theme: Theme): M3Fab => {
|
29 |
+
const { palette } = theme;
|
30 |
+
return {
|
31 |
+
MuiFab: {
|
32 |
+
defaultProps: { color: 'secondary' },
|
33 |
+
styleOverrides: {
|
34 |
+
root: {
|
35 |
+
boxShadow: theme.shadows[3],
|
36 |
+
borderRadius: '18px'
|
37 |
+
}
|
38 |
+
},
|
39 |
+
variants: [
|
40 |
+
{
|
41 |
+
props: { color: 'primary' },
|
42 |
+
style:
|
43 |
+
{
|
44 |
+
backgroundColor: palette.primaryContainer.main,
|
45 |
+
color: palette.onPrimaryContainer.main,
|
46 |
+
'&:hover': {
|
47 |
+
background: getStateLayerColor(StateLayer.Hover, palette.primaryContainer.main, palette.onPrimaryContainer.main),
|
48 |
+
boxShadow: theme.shadows[4]
|
49 |
+
},
|
50 |
+
'&:focus': {
|
51 |
+
background: getStateLayerColor(StateLayer.Focus, palette.primaryContainer.main, palette.onPrimaryContainer.main),
|
52 |
+
boxShadow: theme.shadows[3]
|
53 |
+
},
|
54 |
+
'&:active': {
|
55 |
+
background: getStateLayerColor(StateLayer.Press, palette.primaryContainer.main, palette.onPrimaryContainer.main),
|
56 |
+
boxShadow: theme.shadows[3]
|
57 |
+
},
|
58 |
+
}
|
59 |
+
|
60 |
+
},
|
61 |
+
{
|
62 |
+
props: { color: 'secondary' },
|
63 |
+
style:
|
64 |
+
{
|
65 |
+
backgroundColor: palette.secondaryContainer.main,
|
66 |
+
color: palette.onSecondaryContainer.main,
|
67 |
+
'&:hover': {
|
68 |
+
background: getStateLayerColor(StateLayer.Hover, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
69 |
+
boxShadow: theme.shadows[4]
|
70 |
+
},
|
71 |
+
'&:focus': {
|
72 |
+
background: getStateLayerColor(StateLayer.Focus, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
73 |
+
boxShadow: theme.shadows[3]
|
74 |
+
},
|
75 |
+
'&:active': {
|
76 |
+
background: getStateLayerColor(StateLayer.Press, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
77 |
+
boxShadow: theme.shadows[3]
|
78 |
+
},
|
79 |
+
}
|
80 |
+
|
81 |
+
},
|
82 |
+
{
|
83 |
+
props: { color: 'surface' },
|
84 |
+
style:
|
85 |
+
{
|
86 |
+
backgroundColor: palette.surfaceContainer.main,
|
87 |
+
color: palette.primary.main,
|
88 |
+
'&:hover': {
|
89 |
+
background: getStateLayerColor(StateLayer.Hover, palette.surfaceContainer.main, palette.primary.main),
|
90 |
+
boxShadow: theme.shadows[4]
|
91 |
+
},
|
92 |
+
'&:focus': {
|
93 |
+
background: getStateLayerColor(StateLayer.Focus, palette.surfaceContainer.main, palette.primary.main),
|
94 |
+
boxShadow: theme.shadows[3]
|
95 |
+
},
|
96 |
+
'&:active': {
|
97 |
+
background: getStateLayerColor(StateLayer.Press, palette.surfaceContainer.main, palette.primary.main),
|
98 |
+
boxShadow: theme.shadows[3]
|
99 |
+
},
|
100 |
+
}
|
101 |
+
|
102 |
+
},
|
103 |
+
{
|
104 |
+
props: { color: 'tertiary' },
|
105 |
+
style: {
|
106 |
+
backgroundColor: palette.tertiaryContainer.main,
|
107 |
+
color: palette.onTertiaryContainer.main,
|
108 |
+
'&:hover': {
|
109 |
+
background: getStateLayerColor(StateLayer.Hover, palette.tertiaryContainer.main, palette.onTertiaryContainer.main),
|
110 |
+
boxShadow: theme.shadows[4]
|
111 |
+
},
|
112 |
+
'&:focus': {
|
113 |
+
background: getStateLayerColor(StateLayer.Focus, palette.tertiaryContainer.main, palette.onTertiaryContainer.main),
|
114 |
+
boxShadow: theme.shadows[3]
|
115 |
+
},
|
116 |
+
'&:active': {
|
117 |
+
background: getStateLayerColor(StateLayer.Press, palette.tertiaryContainer.main, palette.onTertiaryContainer.main),
|
118 |
+
boxShadow: theme.shadows[3]
|
119 |
+
},
|
120 |
+
}
|
121 |
+
|
122 |
+
}
|
123 |
+
]
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
front/src/theme/M3/components/ListItem.ts
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants } from "@mui/material";
|
2 |
+
|
3 |
+
interface M3ListItem {
|
4 |
+
MuiListItem: {
|
5 |
+
defaultProps?: ComponentsProps['MuiListItem'];
|
6 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiListItem'];
|
7 |
+
variants?: ComponentsVariants['MuiListItem'];
|
8 |
+
}
|
9 |
+
};
|
10 |
+
|
11 |
+
export const getListItem = (_theme: Theme): M3ListItem => {
|
12 |
+
//const { palette } = theme;
|
13 |
+
return {
|
14 |
+
MuiListItem: {
|
15 |
+
styleOverrides: {
|
16 |
+
root: {
|
17 |
+
paddingTop: 1,
|
18 |
+
paddingBottom: 1,
|
19 |
+
'& .MuiListItemButton-root': {
|
20 |
+
paddingTop: 8,
|
21 |
+
paddingBottom: 8
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
front/src/theme/M3/components/ListItemButton.ts
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants } from "@mui/material";
|
2 |
+
import { StateLayer, getStateLayerColor } from "../..";
|
3 |
+
|
4 |
+
interface M3ListItemButton {
|
5 |
+
MuiListItemButton: {
|
6 |
+
defaultProps?: ComponentsProps['MuiListItemButton'];
|
7 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiListItemButton'];
|
8 |
+
variants?: ComponentsVariants['MuiListItemButton'];
|
9 |
+
}
|
10 |
+
};
|
11 |
+
|
12 |
+
export const getListItemButton = (theme: Theme): M3ListItemButton => {
|
13 |
+
const { palette } = theme;
|
14 |
+
return {
|
15 |
+
MuiListItemButton: {
|
16 |
+
styleOverrides: {
|
17 |
+
root: {
|
18 |
+
borderRadius: 50,
|
19 |
+
color: palette.onSurfaceVariant.main,
|
20 |
+
'&:hover': {
|
21 |
+
backgroundColor: getStateLayerColor(StateLayer.Hover, palette.surfaceContainerLow.main, palette.onSurface.main),
|
22 |
+
color: getStateLayerColor(StateLayer.Hover, palette.onSurfaceVariant.main, palette.onSurface.main)
|
23 |
+
},
|
24 |
+
/*'&:focus': {
|
25 |
+
backgroundColor: getStateLayerColor(StateLayer.Focus, palette.surfaceContainerLow.main, palette.onSurface.main),
|
26 |
+
color: getStateLayerColor(StateLayer.Focus, palette.onSurfaceVariant.main, palette.onSurface.main)
|
27 |
+
},*/
|
28 |
+
'&:active': {
|
29 |
+
backgroundColor: getStateLayerColor(StateLayer.Press, palette.surfaceContainerLow.main, palette.onSecondaryContainer.main),
|
30 |
+
color: getStateLayerColor(StateLayer.Press, palette.onSurfaceVariant.main, palette.onSurface.main)
|
31 |
+
},
|
32 |
+
'&.Mui-selected': {
|
33 |
+
color: palette.onSecondaryContainer.main,
|
34 |
+
background: palette.secondaryContainer.main,
|
35 |
+
'& > .MuiListItemText-root > .MuiTypography-root': {
|
36 |
+
fontWeight: 'bold'
|
37 |
+
},
|
38 |
+
'&:hover': {
|
39 |
+
backgroundColor: getStateLayerColor(StateLayer.Hover, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
40 |
+
color: getStateLayerColor(StateLayer.Hover, palette.onSecondaryContainer.main, palette.secondaryContainer.main)
|
41 |
+
},
|
42 |
+
/*'&:focus': {
|
43 |
+
backgroundColor: getStateLayerColor(StateLayer.Focus, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
44 |
+
color: getStateLayerColor(StateLayer.Focus, palette.onSecondaryContainer.main, palette.secondaryContainer.main)
|
45 |
+
},*/
|
46 |
+
'&:active': {
|
47 |
+
backgroundColor: getStateLayerColor(StateLayer.Press, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
48 |
+
color: getStateLayerColor(StateLayer.Press, palette.onSecondaryContainer.main, palette.secondaryContainer.main)
|
49 |
+
},
|
50 |
+
}
|
51 |
+
},
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
front/src/theme/M3/components/ListItemIcon.ts
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants } from "@mui/material";
|
2 |
+
|
3 |
+
interface M3ListItemIcon {
|
4 |
+
MuiListItemIcon: {
|
5 |
+
defaultProps?: ComponentsProps['MuiListItemIcon'];
|
6 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiListItemIcon'];
|
7 |
+
variants?: ComponentsVariants['MuiListItemIcon'];
|
8 |
+
}
|
9 |
+
};
|
10 |
+
|
11 |
+
export const getListItemIcon = (_theme: Theme): M3ListItemIcon => {
|
12 |
+
//const { palette } = theme;
|
13 |
+
return {
|
14 |
+
MuiListItemIcon: {
|
15 |
+
styleOverrides: {
|
16 |
+
root: {
|
17 |
+
color: 'inherit',
|
18 |
+
minWidth: 32,
|
19 |
+
'&.Mui-selected': {
|
20 |
+
fontWeight: 'bold'
|
21 |
+
},
|
22 |
+
},
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
front/src/theme/M3/components/Menu.ts
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import {
|
3 |
+
Theme,
|
4 |
+
ComponentsProps, ComponentsOverrides, ComponentsVariants
|
5 |
+
} from '@mui/material';
|
6 |
+
|
7 |
+
interface M3Menu {
|
8 |
+
MuiMenu: {
|
9 |
+
defaultProps?: ComponentsProps['MuiMenu'];
|
10 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiMenu'];
|
11 |
+
variants?: ComponentsVariants['MuiMenu'];
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
export const getMenu = (theme: Theme): M3Menu => {
|
16 |
+
const { palette } = theme;
|
17 |
+
return {
|
18 |
+
MuiMenu: {
|
19 |
+
defaultProps: { color: 'default' },
|
20 |
+
styleOverrides: {
|
21 |
+
root: {
|
22 |
+
},
|
23 |
+
paper: {
|
24 |
+
backgroundColor: palette.surfaceContainerLow.main,
|
25 |
+
boxShadow: theme.shadows[3],
|
26 |
+
color: palette.onSurface.main
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
};
|
31 |
+
}
|
front/src/theme/M3/components/Switch.ts
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants, alpha } from "@mui/material";
|
2 |
+
|
3 |
+
interface M3Switch {
|
4 |
+
MuiSwitch: {
|
5 |
+
defaultProps?: ComponentsProps['MuiSwitch'];
|
6 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiSwitch'];
|
7 |
+
variants?: ComponentsVariants['MuiSwitch'];
|
8 |
+
}
|
9 |
+
};
|
10 |
+
|
11 |
+
export const getSwitch = (theme: Theme): M3Switch => {
|
12 |
+
const { palette } = theme;
|
13 |
+
return {
|
14 |
+
MuiSwitch: {
|
15 |
+
styleOverrides: {
|
16 |
+
root: {
|
17 |
+
width: 42,
|
18 |
+
height: 26,
|
19 |
+
padding: 0,
|
20 |
+
marginLeft: 12,
|
21 |
+
marginRight: 8,
|
22 |
+
borderColor: palette.outline.main,
|
23 |
+
'& .MuiSwitch-switchBase': {
|
24 |
+
padding: 0,
|
25 |
+
margin: 7,
|
26 |
+
transitionDuration: '100ms',
|
27 |
+
'&.Mui-checked': {
|
28 |
+
transform: 'translateX(16px)',
|
29 |
+
margin: 4,
|
30 |
+
'& + .MuiSwitch-track': {
|
31 |
+
backgroundColor: palette.primary.main,
|
32 |
+
opacity: 1,
|
33 |
+
border: 0,
|
34 |
+
},
|
35 |
+
'& .MuiSwitch-thumb': {
|
36 |
+
color: palette.onPrimary.main,
|
37 |
+
width: 18,
|
38 |
+
height: 18,
|
39 |
+
},
|
40 |
+
'&.Mui-disabled + .MuiSwitch-track': {
|
41 |
+
backgroundColor: alpha(palette.onSurface.main, 0.1),
|
42 |
+
},
|
43 |
+
'&.Mui-disabled .MuiSwitch-thumb': {
|
44 |
+
color: alpha(palette.surface.main, 0.8),
|
45 |
+
},
|
46 |
+
},
|
47 |
+
'&.Mui-focusVisible .MuiSwitch-thumb': {
|
48 |
+
color: palette.primary.main,
|
49 |
+
border: `6px solid ${palette.onPrimary.main}`,
|
50 |
+
},
|
51 |
+
'&.Mui-disabled .MuiSwitch-thumb': {
|
52 |
+
color: alpha(palette.onSurface.main, 0.3),
|
53 |
+
},
|
54 |
+
},
|
55 |
+
'& .MuiSwitch-thumb': {
|
56 |
+
boxSizing: 'border-box',
|
57 |
+
color: palette.outline.main,
|
58 |
+
width: 12,
|
59 |
+
height: 12,
|
60 |
+
'&:before': {
|
61 |
+
content: "''",
|
62 |
+
position: 'absolute',
|
63 |
+
width: '100%',
|
64 |
+
height: '100%',
|
65 |
+
left: 0,
|
66 |
+
top: 0,
|
67 |
+
backgroundRepeat: 'no-repeat',
|
68 |
+
backgroundPosition: 'center',
|
69 |
+
},
|
70 |
+
},
|
71 |
+
'& .MuiSwitch-track': {
|
72 |
+
borderRadius: 20,
|
73 |
+
border: `2px solid ${palette.outline.main}`,
|
74 |
+
backgroundColor: palette.surfaceContainerHighest.main,
|
75 |
+
|
76 |
+
opacity: 1,
|
77 |
+
transition: 'background .2s'
|
78 |
+
},
|
79 |
+
},
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
front/src/theme/M3/components/ToggleButton.ts
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import {
|
3 |
+
Theme,
|
4 |
+
ComponentsProps, ComponentsOverrides, ComponentsVariants
|
5 |
+
} from '@mui/material';
|
6 |
+
//import { StateLayer, getStateLayerColor } from '../..';
|
7 |
+
|
8 |
+
|
9 |
+
interface M3ToggleButton {
|
10 |
+
MuiToggleButton: {
|
11 |
+
defaultProps?: ComponentsProps['MuiToggleButton'];
|
12 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiToggleButton'];
|
13 |
+
variants?: ComponentsVariants['MuiToggleButton'];
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
export const getToggleButton = (theme: Theme): M3ToggleButton => {
|
18 |
+
const { palette } = theme;
|
19 |
+
return {
|
20 |
+
MuiToggleButton: {
|
21 |
+
styleOverrides: {
|
22 |
+
root: {
|
23 |
+
borderRadius: '50px',
|
24 |
+
textTransform: 'none',
|
25 |
+
color: palette.onSurface.main,
|
26 |
+
"&.Mui-selected": {
|
27 |
+
color: palette.onSecondaryContainer.main,
|
28 |
+
backgroundColor: palette.secondaryContainer.main,
|
29 |
+
},
|
30 |
+
'&.MuiToggleButton-primary': {
|
31 |
+
borderColor: 'transparent'
|
32 |
+
},
|
33 |
+
'&.MuiToggleButton-primary.Mui-selected': {
|
34 |
+
color: palette.onPrimary.main,
|
35 |
+
backgroundColor: palette.primary.main
|
36 |
+
},
|
37 |
+
/*'&.MuiToggleButton-primary.Mui-selected:hover': {
|
38 |
+
background: getStateLayerColor(StateLayer.Hover, palette.primary.main, palette.onPrimary.main),
|
39 |
+
},
|
40 |
+
'&.Mui-selected:not(.MuiToggleButtonGroup-grouped):has(>svg)': {
|
41 |
+
color: palette.onPrimary.main,
|
42 |
+
backgroundColor: palette.primary.main
|
43 |
+
},*/
|
44 |
+
|
45 |
+
/*'&:hover': {
|
46 |
+
background: getStateLayerColor(StateLayer.Hover, palette.surface.main, palette.primary.main),
|
47 |
+
},
|
48 |
+
'&.Mui-selected:hover': {
|
49 |
+
background: getStateLayerColor(StateLayer.Hover, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
50 |
+
},
|
51 |
+
'&:focus': {
|
52 |
+
background: getStateLayerColor(StateLayer.Focus, palette.surface.main, palette.onSurface.main),
|
53 |
+
},
|
54 |
+
'&.Mui-selected:focus': {
|
55 |
+
background: getStateLayerColor(StateLayer.Focus, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
56 |
+
},
|
57 |
+
'&:active': {
|
58 |
+
background: getStateLayerColor(StateLayer.Press, palette.surface.main, palette.onSurface.main),
|
59 |
+
},
|
60 |
+
'&.Mui-selected:active': {
|
61 |
+
background: getStateLayerColor(StateLayer.Press, palette.secondaryContainer.main, palette.onSecondaryContainer.main),
|
62 |
+
}*/
|
63 |
+
},
|
64 |
+
},
|
65 |
+
}
|
66 |
+
|
67 |
+
};
|
68 |
+
}
|
front/src/theme/M3/components/ToggleButtonGroup.ts
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import {
|
3 |
+
Theme,
|
4 |
+
ComponentsProps, ComponentsOverrides, ComponentsVariants
|
5 |
+
} from '@mui/material';
|
6 |
+
import { StateLayer, getStateLayerColor } from '../..';
|
7 |
+
|
8 |
+
|
9 |
+
interface M3ToggleButtonGroup {
|
10 |
+
MuiToggleButtonGroup: {
|
11 |
+
defaultProps?: ComponentsProps['MuiToggleButtonGroup'];
|
12 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiToggleButtonGroup'];
|
13 |
+
variants?: ComponentsVariants['MuiToggleButtonGroup'];
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
export const getToggleButtonGroup = (theme: Theme): M3ToggleButtonGroup => {
|
18 |
+
const { palette } = theme;
|
19 |
+
return {
|
20 |
+
MuiToggleButtonGroup: {
|
21 |
+
styleOverrides: {
|
22 |
+
grouped: {
|
23 |
+
borderRadius: '50px',
|
24 |
+
borderColor: palette.outline.main,
|
25 |
+
'&:not(:first-of-type)': {
|
26 |
+
marginLeft: 0,
|
27 |
+
borderLeft: 0,
|
28 |
+
},
|
29 |
+
'&:hover': {
|
30 |
+
background: getStateLayerColor(StateLayer.Hover, palette.surface.main, palette.primary.main)
|
31 |
+
},
|
32 |
+
'&.Mui-selected:hover': {
|
33 |
+
background: getStateLayerColor(StateLayer.Hover, palette.secondaryContainer.main, palette.onSecondaryContainer.main)
|
34 |
+
}
|
35 |
+
},
|
36 |
+
}
|
37 |
+
},
|
38 |
+
};
|
39 |
+
}
|
front/src/theme/M3/components/Tooltip.ts
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants } from "@mui/material";
|
2 |
+
|
3 |
+
interface M3Tooltip {
|
4 |
+
MuiTooltip: {
|
5 |
+
defaultProps?: ComponentsProps['MuiTooltip'];
|
6 |
+
styleOverrides?: ComponentsOverrides<Theme>['MuiTooltip'];
|
7 |
+
variants?: ComponentsVariants['MuiTooltip'];
|
8 |
+
}
|
9 |
+
};
|
10 |
+
|
11 |
+
export const getTooltip = (theme: Theme): M3Tooltip => {
|
12 |
+
const { palette } = theme;
|
13 |
+
return {
|
14 |
+
MuiTooltip: {
|
15 |
+
styleOverrides: {
|
16 |
+
tooltip: {
|
17 |
+
background: palette.inverseSurface.main,
|
18 |
+
color: palette.inverseOnSurface.main
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
front/src/theme/M3/components/index.ts
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export * from './CssBaseline';
|
2 |
+
export * from './Alert';
|
3 |
+
export * from './Accordion'
|
4 |
+
export * from './AppBar';
|
5 |
+
export * from './Badge';
|
6 |
+
export * from './Button';
|
7 |
+
export * from './Card';
|
8 |
+
export * from './Drawer';
|
9 |
+
export * from './Fab';
|
10 |
+
export * from './ListItem';
|
11 |
+
export * from './ListItemButton';
|
12 |
+
export * from './ListItemIcon';
|
13 |
+
export * from './Menu';
|
14 |
+
export * from './Switch';
|
15 |
+
export * from './ToggleButton';
|
16 |
+
export * from './ToggleButtonGroup';
|
17 |
+
export * from './Tooltip';
|
front/src/theme/M3/hooks/useThemeMode.ts
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { useLayoutEffect, useState } from 'react';
|
2 |
+
import { ThemeMode } from '../..';
|
3 |
+
|
4 |
+
export const THEME_MODE_KEY = 'ThemeModeKey';
|
5 |
+
|
6 |
+
export const useThemeMode = () => {
|
7 |
+
|
8 |
+
const [themeMode, setThemeMode] = useState<ThemeMode>('light');
|
9 |
+
|
10 |
+
useLayoutEffect(() => {
|
11 |
+
if (localStorage.getItem(THEME_MODE_KEY)) {
|
12 |
+
const localMode = JSON.parse(localStorage.getItem(THEME_MODE_KEY) || '{}');
|
13 |
+
setThemeMode(localMode);
|
14 |
+
}
|
15 |
+
}, []);
|
16 |
+
|
17 |
+
const toggleTheme = () => {
|
18 |
+
const value = themeMode == 'light' ? 'dark' : 'light';
|
19 |
+
setThemeMode(value);
|
20 |
+
localStorage.setItem(THEME_MODE_KEY, JSON.stringify(value));
|
21 |
+
}
|
22 |
+
|
23 |
+
return [themeMode, toggleTheme, setThemeMode] as const;
|
24 |
+
}
|
front/src/theme/M3/hooks/useTonalPalette.ts
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { argbFromHex, hexFromArgb, themeFromSourceColor } from '@material/material-color-utilities'
|
2 |
+
import { TonalPalette, TonalPaletteDefault } from '../..';
|
3 |
+
import { useLayoutEffect, useState } from 'react';
|
4 |
+
|
5 |
+
export const TONAL_PALETTE_KEY = 'TonalPaletteKey';
|
6 |
+
|
7 |
+
const LEVELS = [0, 4, 6, 10, 12, 17, 20, 22, 24, 30, 40, 50, 60, 70, 80, 87, 90, 92, 94, 95, 96, 98, 99, 100];
|
8 |
+
|
9 |
+
export const useTonalPalette = () => {
|
10 |
+
|
11 |
+
const [tonalPalette, setTonalPalette] = useState<TonalPalette>(TonalPaletteDefault);
|
12 |
+
|
13 |
+
useLayoutEffect(() => {
|
14 |
+
if (localStorage.getItem(TONAL_PALETTE_KEY)) {
|
15 |
+
const localTonalPalette = JSON.parse(localStorage.getItem(TONAL_PALETTE_KEY) || '{}');
|
16 |
+
setTonalPalette(localTonalPalette);
|
17 |
+
}
|
18 |
+
}, []);
|
19 |
+
|
20 |
+
const generatePalette = (hexColor: string) => {
|
21 |
+
const intColor = argbFromHex(hexColor)
|
22 |
+
const { palettes } = themeFromSourceColor(intColor);
|
23 |
+
const tones: any = {};
|
24 |
+
|
25 |
+
for (const [key, palette] of Object.entries(palettes)) {
|
26 |
+
const tonelevel: any = {}
|
27 |
+
for (const level of LEVELS) {
|
28 |
+
tonelevel[level] = hexFromArgb(palette.tone(level));
|
29 |
+
}
|
30 |
+
tones[key] = tonelevel;
|
31 |
+
}
|
32 |
+
|
33 |
+
setTonalPalette(tones);
|
34 |
+
localStorage.setItem(TONAL_PALETTE_KEY, JSON.stringify(tones));
|
35 |
+
}
|
36 |
+
|
37 |
+
/*
|
38 |
+
const setDefaultPalette = () => {
|
39 |
+
generatePalette('#6750A4');
|
40 |
+
}*/
|
41 |
+
|
42 |
+
return [tonalPalette, generatePalette] as const;
|
43 |
+
}
|
front/src/theme/M3/providers/ThemeModeProvider.tsx
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { FC, createContext } from 'react';
|
2 |
+
import { ThemeMode, useThemeMode } from '../..';
|
3 |
+
|
4 |
+
|
5 |
+
export type ThemeModeContextType = {
|
6 |
+
themeMode: ThemeMode,
|
7 |
+
toggleTheme: () => void,
|
8 |
+
setThemeMode: (mode: ThemeMode) => void
|
9 |
+
};
|
10 |
+
|
11 |
+
export interface ThemeModeProviderProps {
|
12 |
+
children?: React.ReactNode;
|
13 |
+
};
|
14 |
+
|
15 |
+
export const ThemeModeContext = createContext<ThemeModeContextType>({
|
16 |
+
themeMode: 'light',
|
17 |
+
toggleTheme: () => { },
|
18 |
+
setThemeMode: () => { }
|
19 |
+
});
|
20 |
+
|
21 |
+
const ThemeModeProvider: FC<ThemeModeProviderProps> = ({ children }) => {
|
22 |
+
|
23 |
+
const [themeMode, toggleTheme, setThemeMode] = useThemeMode();
|
24 |
+
|
25 |
+
return (<ThemeModeContext.Provider value={{ themeMode, toggleTheme, setThemeMode }}>
|
26 |
+
{children}
|
27 |
+
</ThemeModeContext.Provider>);
|
28 |
+
};
|
29 |
+
|
30 |
+
export default ThemeModeProvider;
|
front/src/theme/M3/providers/ThemeSchemeProvider.tsx
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { createContext, FC, useLayoutEffect, useState } from 'react';
|
2 |
+
|
3 |
+
import { generateDesignTokens, ThemeScheme, ThemeSchemeDefault, useTonalPalette } from "../..";
|
4 |
+
|
5 |
+
export interface ThemeSchemeContextType {
|
6 |
+
generateScheme: (hexColor: string) => void;
|
7 |
+
themeScheme: ThemeScheme;
|
8 |
+
};
|
9 |
+
|
10 |
+
export interface ThemeSchemeProviderProps {
|
11 |
+
children?: React.ReactNode;
|
12 |
+
};
|
13 |
+
|
14 |
+
export const ThemeSchemeContext = createContext<ThemeSchemeContextType>({
|
15 |
+
generateScheme: () => { },
|
16 |
+
themeScheme: ThemeSchemeDefault
|
17 |
+
});
|
18 |
+
|
19 |
+
const ThemeSchemeProvider: FC<ThemeSchemeProviderProps> = ({ children }) => {
|
20 |
+
|
21 |
+
const [tonalPalette, generatePalette] = useTonalPalette();
|
22 |
+
const [themeScheme, setThemeScheme] = useState<ThemeScheme>(ThemeSchemeDefault);
|
23 |
+
|
24 |
+
useLayoutEffect(() => {
|
25 |
+
const lightTokens = generateDesignTokens('light', tonalPalette);
|
26 |
+
const darkTokens = generateDesignTokens('dark', tonalPalette);
|
27 |
+
|
28 |
+
setThemeScheme({
|
29 |
+
light: lightTokens,
|
30 |
+
dark: darkTokens,
|
31 |
+
tones: tonalPalette
|
32 |
+
});
|
33 |
+
|
34 |
+
}, [tonalPalette]);
|
35 |
+
|
36 |
+
const generateScheme = (hexColor: string) => {
|
37 |
+
generatePalette(hexColor);
|
38 |
+
};
|
39 |
+
|
40 |
+
return (
|
41 |
+
<ThemeSchemeContext.Provider value={{ generateScheme, themeScheme }}>
|
42 |
+
{children}
|
43 |
+
</ThemeSchemeContext.Provider >
|
44 |
+
);
|
45 |
+
}
|
46 |
+
|
47 |
+
export default ThemeSchemeProvider;
|
front/src/theme/M3/types/ThemeMode.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
export type ThemeMode = 'light' | 'dark';
|
front/src/theme/M3/types/ThemeScheme.ts
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { DarkTokensDefault, LightTokensDefault, ThemeTokens } from "./ThemeTokens"
|
2 |
+
import { TonalPalette, TonalPaletteDefault } from './TonalPalette';
|
3 |
+
|
4 |
+
export type ThemeScheme = {
|
5 |
+
tones: TonalPalette;
|
6 |
+
light: ThemeTokens;
|
7 |
+
dark: ThemeTokens;
|
8 |
+
}
|
9 |
+
|
10 |
+
export const ThemeSchemeDefault = {
|
11 |
+
tones: TonalPaletteDefault,
|
12 |
+
light: LightTokensDefault,
|
13 |
+
dark: DarkTokensDefault,
|
14 |
+
}
|
front/src/theme/M3/types/ThemeTokens.ts
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export type ThemeTokens = {
|
2 |
+
|
3 |
+
primary: string;
|
4 |
+
onPrimary: string;
|
5 |
+
primaryContainer: string;
|
6 |
+
onPrimaryContainer: string;
|
7 |
+
|
8 |
+
secondary: string;
|
9 |
+
onSecondary: string;
|
10 |
+
secondaryContainer: string;
|
11 |
+
onSecondaryContainer: string;
|
12 |
+
|
13 |
+
tertiary: string;
|
14 |
+
onTertiary: string;
|
15 |
+
tertiaryContainer: string;
|
16 |
+
onTertiaryContainer: string;
|
17 |
+
|
18 |
+
error: string;
|
19 |
+
onError: string;
|
20 |
+
errorContainer: string;
|
21 |
+
onErrorContainer: string;
|
22 |
+
|
23 |
+
primaryFixed: string;
|
24 |
+
primaryFixedDim: string;
|
25 |
+
onPrimaryFixed: string;
|
26 |
+
onPrimaryFixedVariant: string;
|
27 |
+
|
28 |
+
secondaryFixed: string;
|
29 |
+
secondaryFixedDim: string;
|
30 |
+
onSecondaryFixed: string;
|
31 |
+
onSecondaryFixedVariant: string;
|
32 |
+
|
33 |
+
tertiaryFixed: string;
|
34 |
+
tertiaryFixedDim: string;
|
35 |
+
onTertiaryFixed: string;
|
36 |
+
onTertiaryFixedVariant: string;
|
37 |
+
|
38 |
+
surface: string;
|
39 |
+
onSurface: string;
|
40 |
+
|
41 |
+
surfaceDim: string;
|
42 |
+
surfaceBright: string;
|
43 |
+
|
44 |
+
surfaceContainerLowest: string;
|
45 |
+
surfaceContainerLow: string;
|
46 |
+
surfaceContainer: string;
|
47 |
+
surfaceContainerHigh: string;
|
48 |
+
surfaceContainerHighest: string;
|
49 |
+
|
50 |
+
surfaceVariant: string;
|
51 |
+
onSurfaceVariant: string;
|
52 |
+
|
53 |
+
outline: string;
|
54 |
+
outlineVariant: string;
|
55 |
+
|
56 |
+
inverseSurface: string;
|
57 |
+
inverseOnSurface: string;
|
58 |
+
inversePrimary: string;
|
59 |
+
inverseOnPrimary: string;
|
60 |
+
|
61 |
+
shadow: string;
|
62 |
+
scrim: string;
|
63 |
+
|
64 |
+
surfaceTintColor: string;
|
65 |
+
|
66 |
+
background: string;
|
67 |
+
onBackground: string;
|
68 |
+
|
69 |
+
info: string;
|
70 |
+
onInfo: string;
|
71 |
+
infoContainer: string;
|
72 |
+
onInfoContainer: string;
|
73 |
+
|
74 |
+
success: string;
|
75 |
+
onSuccess: string;
|
76 |
+
successContainer: string;
|
77 |
+
onSuccessContainer: string;
|
78 |
+
|
79 |
+
warning: string;
|
80 |
+
onWarning: string;
|
81 |
+
warningContainer: string;
|
82 |
+
onWarningContainer: string;
|
83 |
+
}
|
84 |
+
|
85 |
+
export const LightTokensDefault: ThemeTokens = {
|
86 |
+
"primary": "#6750a4",
|
87 |
+
"onPrimary": "#ffffff",
|
88 |
+
"primaryContainer": "#e9ddff",
|
89 |
+
"onPrimaryContainer": "#22005d",
|
90 |
+
"secondary": "#625b71",
|
91 |
+
"onSecondary": "#ffffff",
|
92 |
+
"secondaryContainer": "#e8def8",
|
93 |
+
"onSecondaryContainer": "#1e192b",
|
94 |
+
"tertiary": "#7e5260",
|
95 |
+
"onTertiary": "#ffffff",
|
96 |
+
"tertiaryContainer": "#ffd9e3",
|
97 |
+
"onTertiaryContainer": "#31101d",
|
98 |
+
"error": "#ba1a1a",
|
99 |
+
"onError": "#ffffff",
|
100 |
+
"errorContainer": "#ffdad6",
|
101 |
+
"onErrorContainer": "#410002",
|
102 |
+
"primaryFixed": "#e9ddff",
|
103 |
+
"primaryFixedDim": "#cfbcff",
|
104 |
+
"onPrimaryFixed": "#22005d",
|
105 |
+
"onPrimaryFixedVariant": "#4f378a",
|
106 |
+
"secondaryFixed": "#e8def8",
|
107 |
+
"secondaryFixedDim": "#cbc2db",
|
108 |
+
"onSecondaryFixed": "#1e192b",
|
109 |
+
"onSecondaryFixedVariant": "#4a4458",
|
110 |
+
"tertiaryFixed": "#ffd9e3",
|
111 |
+
"tertiaryFixedDim": "#efb8c8",
|
112 |
+
"onTertiaryFixed": "#31101d",
|
113 |
+
"onTertiaryFixedVariant": "#633b48",
|
114 |
+
"surface": "#fdf8fd",
|
115 |
+
"onSurface": "#1c1b1e",
|
116 |
+
"surfaceDim": "#ddd8dd",
|
117 |
+
"surfaceBright": "#fdf8fd",
|
118 |
+
"surfaceContainerLowest": "#ffffff",
|
119 |
+
"surfaceContainerLow": "#f7f2f7",
|
120 |
+
"surfaceContainer": "#f2ecf1",
|
121 |
+
"surfaceContainerHigh": "#ece7eb",
|
122 |
+
"surfaceContainerHighest": "#e6e1e6",
|
123 |
+
"surfaceVariant": "#e7e0eb",
|
124 |
+
"onSurfaceVariant": "#49454e",
|
125 |
+
"outline": "#7a757f",
|
126 |
+
"outlineVariant": "#cac4cf",
|
127 |
+
"inverseSurface": "#313033",
|
128 |
+
"inverseOnSurface": "#f4eff4",
|
129 |
+
"inversePrimary": "#cfbcff",
|
130 |
+
"inverseOnPrimary": "",
|
131 |
+
"shadow": "#000000",
|
132 |
+
"scrim": "#000000",
|
133 |
+
"surfaceTintColor": "#6750a4",
|
134 |
+
"background": "#fdf8fd",
|
135 |
+
"onBackground": "#1c1b1e",
|
136 |
+
|
137 |
+
"info": "#125db2",
|
138 |
+
"onInfo": "#ffffff",
|
139 |
+
"infoContainer": "#d6e3ff",
|
140 |
+
"onInfoContainer": "#001b3d",
|
141 |
+
|
142 |
+
"success": "#006d43",
|
143 |
+
"onSuccess": "#ffffff",
|
144 |
+
"successContainer": "#92f7bc",
|
145 |
+
"onSuccessContainer": "#002111",
|
146 |
+
|
147 |
+
"warning": "#ad3212",
|
148 |
+
"onWarning": "#ffffff",
|
149 |
+
"warningContainer": "#ffdad2",
|
150 |
+
"onWarningContainer": "#3c0700"
|
151 |
+
};
|
152 |
+
export const DarkTokensDefault: ThemeTokens = {
|
153 |
+
"primary": "#cfbcff",
|
154 |
+
"onPrimary": "#4f378a",
|
155 |
+
"primaryContainer": "#4f378a",
|
156 |
+
"onPrimaryContainer": "#e9ddff",
|
157 |
+
"secondary": "#cbc2db",
|
158 |
+
"onSecondary": "#332d41",
|
159 |
+
"secondaryContainer": "#4a4458",
|
160 |
+
"onSecondaryContainer": "#e8def8",
|
161 |
+
"tertiary": "#efb8c8",
|
162 |
+
"onTertiary": "#633b48",
|
163 |
+
"tertiaryContainer": "#633b48",
|
164 |
+
"onTertiaryContainer": "#ffd9e3",
|
165 |
+
"error": "#ffb4ab",
|
166 |
+
"onError": "#690005",
|
167 |
+
"errorContainer": "#93000a",
|
168 |
+
"onErrorContainer": "#ffdad6",
|
169 |
+
"primaryFixed": "#e9ddff",
|
170 |
+
"primaryFixedDim": "#cfbcff",
|
171 |
+
"onPrimaryFixed": "#22005d",
|
172 |
+
"onPrimaryFixedVariant": "#4f378a",
|
173 |
+
"secondaryFixed": "#e8def8",
|
174 |
+
"secondaryFixedDim": "#cbc2db",
|
175 |
+
"onSecondaryFixed": "#1e192b",
|
176 |
+
"onSecondaryFixedVariant": "#4a4458",
|
177 |
+
"tertiaryFixed": "#ffd9e3",
|
178 |
+
"tertiaryFixedDim": "#efb8c8",
|
179 |
+
"onTertiaryFixed": "#31101d",
|
180 |
+
"onTertiaryFixedVariant": "#633b48",
|
181 |
+
"surface": "#141316",
|
182 |
+
"onSurface": "#e6e1e6",
|
183 |
+
"surfaceDim": "#141316",
|
184 |
+
"surfaceBright": "#3a383c",
|
185 |
+
"surfaceContainerLowest": "#0f0e11",
|
186 |
+
"surfaceContainerLow": "#1c1b1e",
|
187 |
+
"surfaceContainer": "#201f22",
|
188 |
+
"surfaceContainerHigh": "#2b292d",
|
189 |
+
"surfaceContainerHighest": "#363438",
|
190 |
+
"surfaceVariant": "#49454e",
|
191 |
+
"onSurfaceVariant": "#cac4cf",
|
192 |
+
"outline": "#948f99",
|
193 |
+
"outlineVariant": "#49454e",
|
194 |
+
"inverseSurface": "#e6e1e6",
|
195 |
+
"inverseOnSurface": "#313033",
|
196 |
+
"inversePrimary": "#6750a4",
|
197 |
+
"inverseOnPrimary": "",
|
198 |
+
"shadow": "#000000",
|
199 |
+
"scrim": "#000000",
|
200 |
+
"surfaceTintColor": "#cfbcff",
|
201 |
+
"background": "#141316",
|
202 |
+
"onBackground": "#e6e1e6",
|
203 |
+
|
204 |
+
"info": "#a9c7ff",
|
205 |
+
"onInfo": "#003063",
|
206 |
+
"infoContainer": "#00468c",
|
207 |
+
"onInfoContainer": "#d6e3ff",
|
208 |
+
|
209 |
+
"success": "#76daa1",
|
210 |
+
"onSuccess": "#003920",
|
211 |
+
"successContainer": "#005231",
|
212 |
+
"onSuccessContainer": "#92f7bc",
|
213 |
+
|
214 |
+
"warning": "#ffb4a2",
|
215 |
+
"onWarning": "#621200",
|
216 |
+
"warningContainer": "#8a1d00",
|
217 |
+
"onWarningContainer": "#ffdad2"
|
218 |
+
};
|