All files / src/pages/auth LogoutSuccess.tsx

100% Statements 45/45
100% Branches 2/2
100% Functions 2/2
100% Lines 45/45

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 461x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x  
/**
 * @file LogoutSuccess.tsx
 * @description
 * Public confirmation screen shown after a successful logout.
 * Side-effects happen exclusively in LogoutPage.
 *
 * @responsibilities
 * - Display a confirmation message after successful logout.
 * - Provide a button to navigate back to the login page.
 *
 * @i18n
 * - Uses 'auth' namespace: logoutSuccessTitle, logoutSuccessBody, signIn.
 */
 
import * as React from 'react';
import { Box, Button, Typography } from '@mui/material';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
 
const LogoutSuccess: React.FC = () => {
  const { t } = useTranslation<'auth'>('auth');
  const navigate = useNavigate();
 
  return (
    <Box sx={{ display: 'grid', placeItems: 'center', minHeight: '70vh', px: 3 }}>
      <Box sx={{ textAlign: 'center', maxWidth: 560 }}>
        <Typography variant="h5" gutterBottom>
          {t('logoutSuccessTitle')}
        </Typography>
        <Typography variant="body1" color="text.secondary" gutterBottom>
          {t('logoutSuccessBody')}
        </Typography>
        <Button
          variant="contained"
          sx={{ mt: 2 }}
          onClick={() => navigate('/login', { replace: true })}
        >
          {t('signIn')}
        </Button>
      </Box>
    </Box>
  );
};
 
export default LogoutSuccess;