All files / src/app/footer AppFooter.tsx

100% Statements 166/166
100% Branches 4/4
100% Functions 2/2
100% Lines 166/166

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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 1671x 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x  
/**
 * @file AppFooter.tsx
 * @module app/footer/AppFooter
 *
 * @summary
 * Main application footer component (replaces Footer.tsx).
 * Thin orchestrator managing footer layout and section composition.
 * Displays legal info, support links, system health, and localization.
 *
 * @enterprise
 * - Collapsible details panel (click expand button)
 * - Compact status bar always visible
 * - Real-time system health monitoring
 * - i18n support for all text
 * - Responsive layout for mobile and desktop
 * - Full TypeDoc coverage for footer orchestration
 */
 
import {
  Box,
  Container,
  Typography,
  Divider,
  Stack,
  Collapse,
  IconButton,
} from '@mui/material';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { useTranslation } from 'react-i18next';
import { useFooterState } from './useFooterState';
import FooterLegal from './FooterLegal';
import FooterLinks from './FooterLinks';
import HealthStatusDisplay from './HealthStatusDisplay';
import LocalizationDisplay from './LocalizationDisplay';
import FooterMetaInfo from './FooterMetaInfo';
 
/**
 * Application footer component.
 *
 * Thin orchestrator that delegates to focused sub-components.
 * Manages collapsible details panel and compact status bar layout.
 *
 * Features:
 * - Collapsible details section with legal, links, health, and localization
 * - Compact always-visible status bar
 * - Real-time system health monitoring
 * - i18n support for all labels and text
 * - Responsive design for mobile and desktop
 *
 * @returns JSX element rendering the application footer
 *
 * @example
 * ```tsx
 * <AppFooter />
 * ```
 */
export default function AppFooter() {
  const { t } = useTranslation(['common', 'footer']);
  const { detailsOpen, toggleDetails, health, config } = useFooterState();
 
  return (
    <Box
      component="footer"
      sx={{
        mt: 'auto',
        borderTop: '1px solid',
        borderTopColor: 'divider',
        bgcolor: 'background.default',
        zIndex: (theme) => theme.zIndex.appBar - 1,
      }}
    >
      <Container maxWidth="xl" sx={{ py: 0.5 }}>
        {/* Collapsible Details Panel */}
        <Collapse in={detailsOpen} unmountOnExit>
          <Stack
            direction={{ xs: 'column', sm: 'row' }}
            spacing={2}
            sx={{ mb: 0.75 }}
          >
            {/* Legal & Meta Information */}
            <FooterLegal
              appVersion={config.appVersion}
              buildId={config.buildId}
              environment={config.environment}
            />
 
            {/* Support & Documentation Links */}
            <FooterLinks />
 
            {/* System Health Status */}
            <Box sx={{ minWidth: 0, flex: 1 }}>
              <Typography
                variant="caption"
                sx={{ fontWeight: 600, display: 'block', mb: 0.25 }}
              >
                {t('footer:section.health', 'System Health')}
              </Typography>
              <HealthStatusDisplay health={health} />
            </Box>
 
            {/* Language & Region */}
            <LocalizationDisplay
              currentLanguage={config.currentLanguage}
              region={config.region}
            />
          </Stack>
 
          <Divider sx={{ mb: 0.5 }} />
 
          {/* Privacy Notice */}
          <Typography
            variant="caption"
            color="text.secondary"
            display="block"
            sx={{ mb: 0.5, lineHeight: 1.4 }}
          >
            {t('footer:privacy.notice', 'This portfolio showcases a fictional enterprise inventory system. No real customer data is stored. For demonstration purposes only.')}
          </Typography>
        </Collapse>
 
        {/* Compact Status Bar (always visible) */}
        <Stack
          direction="row"
          alignItems="center"
          justifyContent="space-between"
          spacing={2}
          sx={{ minHeight: 40 }}
        >
          {/* Meta Information */}
          <FooterMetaInfo
            appVersion={config.appVersion}
            buildId={config.buildId}
            environment={config.environment}
            currentLanguage={config.currentLanguage}
            region={config.region}
          />
 
          {/* Health Status and Expand Button */}
          <Stack
            direction="row"
            spacing={1}
            alignItems="center"
            sx={{ flexShrink: 0 }}
          >
            <HealthStatusDisplay health={health} />
            <Divider orientation="vertical" flexItem />
            <IconButton
              size="small"
              onClick={toggleDetails}
              aria-label="Footer details"
              sx={{ ml: 0.5 }}
            >
              <ExpandMoreIcon
                sx={{
                  fontSize: '1.1rem',
                  transform: detailsOpen ? 'rotate(180deg)' : 'rotate(0deg)',
                  transition: 'transform 0.2s',
                }}
              />
            </IconButton>
          </Stack>
        </Stack>
      </Container>
    </Box>
  );
}