mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
formatting
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import type { FC } from 'react';
|
||||
import type { Blocker } from 'react-router-dom';
|
||||
|
||||
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material';
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogTitle
|
||||
} from '@mui/material';
|
||||
|
||||
import { dialogStyle } from 'CustomTheme';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
@@ -18,10 +24,18 @@ const BlockNavigation: FC<BlockNavigationProps> = ({ blocker }) => {
|
||||
<DialogTitle>{LL.BLOCK_NAVIGATE_1()}</DialogTitle>
|
||||
<DialogContent dividers>{LL.BLOCK_NAVIGATE_2()}</DialogContent>
|
||||
<DialogActions>
|
||||
<Button variant="outlined" onClick={() => blocker.reset?.()} color="secondary">
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={() => blocker.reset?.()}
|
||||
color="secondary"
|
||||
>
|
||||
{LL.STAY()}
|
||||
</Button>
|
||||
<Button variant="contained" onClick={() => blocker.proceed?.()} color="primary">
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={() => blocker.proceed?.()}
|
||||
color="primary"
|
||||
>
|
||||
{LL.LEAVE()}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
||||
@@ -7,7 +7,11 @@ import type { RequiredChildrenProps } from 'utils';
|
||||
|
||||
const RequireAdmin: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
const authenticatedContext = useContext(AuthenticatedContext);
|
||||
return authenticatedContext.me.admin ? <>{children}</> : <Navigate replace to="/" />;
|
||||
return authenticatedContext.me.admin ? (
|
||||
<>{children}</>
|
||||
) : (
|
||||
<Navigate replace to="/" />
|
||||
);
|
||||
};
|
||||
|
||||
export default RequireAdmin;
|
||||
|
||||
@@ -5,7 +5,10 @@ import { Navigate, useLocation } from 'react-router-dom';
|
||||
import { storeLoginRedirect } from 'api/authentication';
|
||||
|
||||
import type { AuthenticatedContextValue } from 'contexts/authentication/context';
|
||||
import { AuthenticatedContext, AuthenticationContext } from 'contexts/authentication/context';
|
||||
import {
|
||||
AuthenticatedContext,
|
||||
AuthenticationContext
|
||||
} from 'contexts/authentication/context';
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
|
||||
const RequireAuthenticated: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
@@ -19,7 +22,9 @@ const RequireAuthenticated: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
});
|
||||
|
||||
return authenticationContext.me ? (
|
||||
<AuthenticatedContext.Provider value={authenticationContext as AuthenticatedContextValue}>
|
||||
<AuthenticatedContext.Provider
|
||||
value={authenticationContext as AuthenticatedContextValue}
|
||||
>
|
||||
{children}
|
||||
</AuthenticatedContext.Provider>
|
||||
) : (
|
||||
|
||||
@@ -10,7 +10,11 @@ import type { RequiredChildrenProps } from 'utils';
|
||||
const RequireUnauthenticated: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
const authenticationContext = useContext(AuthenticationContext);
|
||||
|
||||
return authenticationContext.me ? <Navigate to={AuthenticationApi.fetchLoginRedirect()} /> : <>{children}</>;
|
||||
return authenticationContext.me ? (
|
||||
<Navigate to={AuthenticationApi.fetchLoginRedirect()} />
|
||||
) : (
|
||||
<>{children}</>
|
||||
);
|
||||
};
|
||||
|
||||
export default RequireUnauthenticated;
|
||||
|
||||
@@ -20,7 +20,11 @@ const RouterTabs: FC<RouterTabsProps> = ({ value, children }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<Tabs value={value} onChange={handleTabChange} variant={smallDown ? 'scrollable' : 'fullWidth'}>
|
||||
<Tabs
|
||||
value={value}
|
||||
onChange={handleTabChange}
|
||||
variant={smallDown ? 'scrollable' : 'fullWidth'}
|
||||
>
|
||||
{children}
|
||||
</Tabs>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user