mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
42 lines
982 B
TypeScript
42 lines
982 B
TypeScript
import type { Blocker } from 'react-router';
|
|
|
|
import {
|
|
Button,
|
|
Dialog,
|
|
DialogActions,
|
|
DialogContent,
|
|
DialogTitle
|
|
} from '@mui/material';
|
|
|
|
import { dialogStyle } from 'CustomTheme';
|
|
import { useI18nContext } from 'i18n/i18n-react';
|
|
|
|
const BlockNavigation = ({ blocker }: { blocker: Blocker }) => {
|
|
const { LL } = useI18nContext();
|
|
|
|
return (
|
|
<Dialog sx={dialogStyle} open={blocker.state === 'blocked'}>
|
|
<DialogTitle>{LL.BLOCK_NAVIGATE_1()}</DialogTitle>
|
|
<DialogContent dividers>{LL.BLOCK_NAVIGATE_2()}</DialogContent>
|
|
<DialogActions>
|
|
<Button
|
|
variant="outlined"
|
|
onClick={() => blocker.reset?.()}
|
|
color="secondary"
|
|
>
|
|
{LL.STAY()}
|
|
</Button>
|
|
<Button
|
|
variant="contained"
|
|
onClick={() => blocker.proceed?.()}
|
|
color="primary"
|
|
>
|
|
{LL.LEAVE()}
|
|
</Button>
|
|
</DialogActions>
|
|
</Dialog>
|
|
);
|
|
};
|
|
|
|
export default BlockNavigation;
|