All files / src/app/HamburgerMenu/ProfileSettings ProfileEmailDisplay.tsx

100% Statements 49/49
100% Branches 4/4
100% Functions 1/1
100% Lines 49/49

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 46 47 48 49 501x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 3x 6x 9x 9x 9x 9x  
/**
 * @file ProfileEmailDisplay.tsx
 * @module app/HamburgerMenu/ProfileSettings/ProfileEmailDisplay
 *
 * @summary
 * Displays user's email or demo account message.
 * Handles both regular and demo user scenarios.
 *
 * @example
 * ```tsx
 * <ProfileEmailDisplay email="user@example.com" isDemo={false} />
 * ```
 */
 
import { Box, Typography } from '@mui/material';
import { useTranslation } from 'react-i18next';
 
interface ProfileEmailDisplayProps {
  /** User's email address */
  email?: string;
 
  /** Whether this is a demo account */
  isDemo: boolean;
}
 
/**
 * Profile email display component.
 *
 * Shows either user's email or demo account message depending on account type.
 *
 * @param props - Component props
 * @returns JSX element displaying email or demo message
 */
export default function ProfileEmailDisplay({ email, isDemo }: ProfileEmailDisplayProps) {
  const { t } = useTranslation(['common', 'auth']);
 
  return (
    <Box>
      <Typography variant="caption" color="text.secondary" sx={{ fontWeight: 600 }}>
        {t('common:email', 'Email')}
      </Typography>
      <Typography variant="body2">
        {isDemo
          ? t('auth:demo.noEmailProvided', 'Demo Account, No email provided')
          : email || '—'}
      </Typography>
    </Box>
  );
}