2026-02-12 19:16:16 +00:00
|
|
|
import { type CSSProperties } from "react";
|
2024-10-23 19:11:06 -04:00
|
|
|
import { useSelector } from "react-redux";
|
2024-07-19 10:40:40 -07:00
|
|
|
import "react-toastify/dist/ReactToastify.css";
|
|
|
|
|
import { ToastContainer } from "react-toastify";
|
2024-08-28 22:14:55 -04:00
|
|
|
import { ThemeProvider } from "@emotion/react";
|
2024-11-09 08:01:14 -05:00
|
|
|
import { CssBaseline, GlobalStyles } from "@mui/material";
|
2026-03-02 22:37:58 +00:00
|
|
|
import { SWRConfig } from "swr";
|
2024-12-12 00:09:41 -05:00
|
|
|
import { Routes } from "./Routes";
|
2026-02-20 18:13:39 +00:00
|
|
|
import AppLayout from "@/Components/layout/AppLayout";
|
2026-02-09 23:51:18 +00:00
|
|
|
import type { RootState } from "@/Types/state";
|
2026-02-20 18:10:43 +00:00
|
|
|
import { lightTheme, darkTheme } from "@/Utils/Theme/Theme";
|
2024-12-12 00:09:41 -05:00
|
|
|
|
2026-03-02 22:37:58 +00:00
|
|
|
const swrConfig = {
|
|
|
|
|
dedupingInterval: 5000,
|
|
|
|
|
revalidateOnFocus: false,
|
|
|
|
|
revalidateOnReconnect: true,
|
|
|
|
|
shouldRetryOnError: false,
|
|
|
|
|
errorRetryCount: 2,
|
|
|
|
|
errorRetryInterval: 1000,
|
|
|
|
|
focusThrottleInterval: 5000,
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-03 12:29:37 -04:00
|
|
|
function App() {
|
2026-02-09 23:51:18 +00:00
|
|
|
const mode = useSelector((state: RootState) => state.ui.mode);
|
2026-02-20 18:10:43 +00:00
|
|
|
const theme = mode === "light" ? lightTheme : darkTheme;
|
2026-01-22 12:27:18 -05:00
|
|
|
|
2024-10-17 12:05:06 +08:00
|
|
|
return (
|
2026-03-02 22:37:58 +00:00
|
|
|
<SWRConfig value={swrConfig}>
|
|
|
|
|
<ThemeProvider theme={theme}>
|
|
|
|
|
<CssBaseline />
|
|
|
|
|
<GlobalStyles
|
|
|
|
|
styles={{
|
|
|
|
|
body: {
|
|
|
|
|
backgroundColor: theme.palette.background.default,
|
|
|
|
|
},
|
2026-04-26 01:56:13 -04:00
|
|
|
".Toastify__progress-bar": {
|
2026-04-26 01:32:05 -04:00
|
|
|
height: 2,
|
|
|
|
|
bottom: 0,
|
|
|
|
|
top: "auto",
|
|
|
|
|
},
|
2026-04-26 01:56:13 -04:00
|
|
|
".Toastify__progress-bar--bg": {
|
|
|
|
|
display: "none",
|
|
|
|
|
},
|
2026-03-02 22:37:58 +00:00
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<AppLayout>
|
|
|
|
|
<Routes />
|
|
|
|
|
</AppLayout>
|
|
|
|
|
<ToastContainer
|
|
|
|
|
newestOnTop={true}
|
|
|
|
|
theme={mode}
|
2026-04-26 01:32:05 -04:00
|
|
|
icon={false}
|
2026-03-02 22:37:58 +00:00
|
|
|
style={
|
|
|
|
|
{
|
2026-04-26 01:21:54 -04:00
|
|
|
"--toastify-color-progress-light": theme.palette.primary.main,
|
|
|
|
|
"--toastify-color-progress-dark": theme.palette.primary.main,
|
2026-04-26 01:32:05 -04:00
|
|
|
"--toastify-toast-min-height": "40px",
|
|
|
|
|
"--toastify-toast-padding": "8px 12px",
|
2026-04-26 01:56:13 -04:00
|
|
|
"--toastify-toast-width": "auto",
|
2026-03-02 22:37:58 +00:00
|
|
|
} as CSSProperties
|
|
|
|
|
}
|
2026-04-26 01:56:13 -04:00
|
|
|
toastStyle={{
|
|
|
|
|
minHeight: 40,
|
|
|
|
|
padding: "8px 12px",
|
|
|
|
|
width: "auto",
|
|
|
|
|
maxWidth: "min(560px, calc(100vw - 32px))",
|
|
|
|
|
}}
|
2026-04-26 01:32:05 -04:00
|
|
|
progressStyle={{ height: 2 }}
|
2026-03-02 22:37:58 +00:00
|
|
|
/>
|
|
|
|
|
</ThemeProvider>
|
|
|
|
|
</SWRConfig>
|
2024-10-17 12:05:06 +08:00
|
|
|
);
|
2024-05-03 12:29:37 -04:00
|
|
|
}
|
|
|
|
|
|
2024-05-11 22:48:09 +03:30
|
|
|
export default App;
|