This commit is contained in:
proddy
2024-08-08 12:39:48 +02:00
parent dc53ff42f6
commit 3481a879c2
59 changed files with 259 additions and 453 deletions

View File

@@ -1,4 +1,4 @@
import { type ChangeEventHandler, type FC, useContext } from 'react';
import { type ChangeEventHandler, useContext } from 'react';
import { MenuItem, TextField } from '@mui/material';
@@ -16,7 +16,7 @@ import { I18nContext } from 'i18n/i18n-react';
import type { Locales } from 'i18n/i18n-types';
import { loadLocaleAsync } from 'i18n/i18n-util.async';
const LanguageSelector: FC = () => {
const LanguageSelector = () => {
const { setLocale, locale } = useContext(I18nContext);
const onLocaleSelected: ChangeEventHandler<HTMLInputElement> = async ({

View File

@@ -1,4 +1,3 @@
import type { FC } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
@@ -7,12 +6,7 @@ import { AppBar, IconButton, Toolbar, Typography } from '@mui/material';
export const DRAWER_WIDTH = 210;
interface LayoutAppBarProps {
title: string;
onToggleDrawer: () => void;
}
const LayoutAppBar: FC<LayoutAppBarProps> = ({ title, onToggleDrawer }) => {
export default function LayoutAppBar({ title, onToggleDrawer }) {
const pathnames = useLocation()
.pathname.split('/')
.filter((x) => x);
@@ -56,6 +50,4 @@ const LayoutAppBar: FC<LayoutAppBarProps> = ({ title, onToggleDrawer }) => {
</Toolbar>
</AppBar>
);
};
export default LayoutAppBar;
}

View File

@@ -1,5 +1,3 @@
import type { FC } from 'react';
import { Box, Divider, Drawer, Toolbar, Typography, styled } from '@mui/material';
import { PROJECT_NAME } from 'api/env';
@@ -18,12 +16,7 @@ const LayoutDrawerLogo = styled('img')(({ theme }) => ({
}
}));
interface LayoutDrawerProps {
mobileOpen: boolean;
onClose: () => void;
}
const LayoutDrawer: FC<LayoutDrawerProps> = ({ mobileOpen, onClose }) => {
export default function LayoutDrawerProps({ mobileOpen, onClose }) {
const drawer = (
<>
<Toolbar disableGutters>
@@ -66,6 +59,4 @@ const LayoutDrawer: FC<LayoutDrawerProps> = ({ mobileOpen, onClose }) => {
</Drawer>
</Box>
);
};
export default LayoutDrawer;
}

View File

@@ -1,5 +1,4 @@
import { useContext, useState } from 'react';
import type { FC } from 'react';
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
import AssessmentIcon from '@mui/icons-material/Assessment';
@@ -30,7 +29,7 @@ import LayoutMenuItem from 'components/layout/LayoutMenuItem';
import { AuthenticatedContext } from 'contexts/authentication';
import { useI18nContext } from 'i18n/i18n-react';
const LayoutMenu: FC = () => {
const LayoutMenu = () => {
const { me, signOut } = useContext(AuthenticatedContext);
const { LL } = useI18nContext();

View File

@@ -1,49 +0,0 @@
import type { FC } from 'react';
import WarningIcon from '@mui/icons-material/Warning';
import { Box, Paper, Typography } from '@mui/material';
interface ApplicationErrorProps {
message?: string;
}
const ApplicationError: FC<ApplicationErrorProps> = ({ message }) => (
<Box display="flex" height="100vh" justifyContent="center" flexDirection="column">
<Paper
elevation={10}
sx={{
textAlign: 'center',
padding: '280px 0 40px 0',
backgroundImage: 'url("/app/icon.png")',
backgroundRepeat: 'no-repeat',
backgroundPosition: '50% 40px',
backgroundSize: '200px auto',
width: '100%',
borderRadius: 0
}}
>
<Box
display="flex"
flexDirection="row"
justifyContent="center"
alignItems="center"
mb={2}
>
<WarningIcon fontSize="large" color="error" />
<Box ml={2}>
<Typography variant="h4">Application Error</Typography>
</Box>
</Box>
<Typography variant="subtitle1" gutterBottom>
Failed to configure the application, please refresh to try again.
</Typography>
{message && (
<Typography variant="subtitle2" gutterBottom>
{message}
</Typography>
)}
</Paper>
</Box>
);
export default ApplicationError;

View File

@@ -1,3 +1,2 @@
export { default as ApplicationError } from './ApplicationError';
export { default as LoadingSpinner } from './LoadingSpinner';
export { default as FormLoader } from './FormLoader';

View File

@@ -1,6 +1,3 @@
import type { FC } from 'react';
import type { Blocker } from 'react-router-dom';
import {
Button,
Dialog,
@@ -12,11 +9,7 @@ import {
import { dialogStyle } from 'CustomTheme';
import { useI18nContext } from 'i18n/i18n-react';
interface BlockNavigationProps {
blocker: Blocker;
}
const BlockNavigation: FC<BlockNavigationProps> = ({ blocker }) => {
export default function BlockNavigation({ blocker }) {
const { LL } = useI18nContext();
return (
@@ -41,6 +34,4 @@ const BlockNavigation: FC<BlockNavigationProps> = ({ blocker }) => {
</DialogActions>
</Dialog>
);
};
export default BlockNavigation;
}

View File

@@ -8,7 +8,7 @@ import CloudUploadIcon from '@mui/icons-material/CloudUpload';
import { Box, Button, LinearProgress, Typography, useTheme } from '@mui/material';
import type { Theme } from '@mui/material';
import type { Progress } from 'alova/client';
import type { Progress } from 'alova';
import { useI18nContext } from 'i18n/i18n-react';
const getBorderColor = (theme: Theme, props: DropzoneState) => {