diff --git a/frontend/src/components/dashboard/.!60585!PersonalWarningsBanner.tsx b/frontend/src/components/dashboard/.!60585!PersonalWarningsBanner.tsx deleted file mode 100644 index 5ec031d..0000000 --- a/frontend/src/components/dashboard/.!60585!PersonalWarningsBanner.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { - Alert, - AlertTitle, - Box, - CircularProgress, - Divider, - Link, - Typography, -} from '@mui/material'; -import { NotificationsActive as NotificationsActiveIcon } from '@mui/icons-material'; -import { Link as RouterLink } from 'react-router-dom'; -import { atemschutzApi } from '../../services/atemschutz'; -import type { User } from '../../types/auth.types'; -import type { AtemschutzUebersicht } from '../../types/atemschutz.types'; - -// ── Constants ───────────────────────────────────────────────────────────────── - -/** Show a warning banner if a deadline is within this many days. */ -const WARNING_THRESHOLD_DAYS = 60; - -// ── Types ───────────────────────────────────────────────────────────────────── - -interface PersonalWarning { - key: string; - /** Negative = overdue, 0 = today, positive = days remaining. */ - tageRest: number; - label: string; - /** Short description of what the user should do */ - action: string; -} - -// ── Helpers ─────────────────────────────────────────────────────────────────── - -function buildWarnings(record: AtemschutzUebersicht): PersonalWarning[] { - const warnings: PersonalWarning[] = []; - - if (record.untersuchung_tage_rest \!== null && record.untersuchung_tage_rest <= WARNING_THRESHOLD_DAYS) { - warnings.push({ - key: 'untersuchung', - tageRest: record.untersuchung_tage_rest, - label: 'Atemschutz-Untersuchung', - action: 'Termin beim Betriebsarzt vereinbaren', - }); - } - - if (record.leistungstest_tage_rest \!== null && record.leistungstest_tage_rest <= WARNING_THRESHOLD_DAYS) { - warnings.push({ - key: 'leistungstest', - tageRest: record.leistungstest_tage_rest, - label: 'Leistungstest', - action: 'Atemschutzwart kontaktieren', - }); - } - - return warnings; -} - -function tageText(tage: number): string { - if (tage < 0) { - const abs = Math.abs(tage); diff --git a/frontend/src/components/dashboard/PersonalWarningsBanner.tsx b/frontend/src/components/dashboard/PersonalWarningsBanner.tsx index 0792096..f62b114 100644 --- a/frontend/src/components/dashboard/PersonalWarningsBanner.tsx +++ b/frontend/src/components/dashboard/PersonalWarningsBanner.tsx @@ -35,7 +35,7 @@ interface PersonalWarning { function buildWarnings(record: AtemschutzUebersicht): PersonalWarning[] { const warnings: PersonalWarning[] = []; - if (record.untersuchung_tage_rest \!== null && record.untersuchung_tage_rest <= WARNING_THRESHOLD_DAYS) { + if (record.untersuchung_tage_rest !== null && record.untersuchung_tage_rest <= WARNING_THRESHOLD_DAYS) { warnings.push({ key: 'untersuchung', tageRest: record.untersuchung_tage_rest, @@ -44,7 +44,7 @@ function buildWarnings(record: AtemschutzUebersicht): PersonalWarning[] { }); } - if (record.leistungstest_tage_rest \!== null && record.leistungstest_tage_rest <= WARNING_THRESHOLD_DAYS) { + if (record.leistungstest_tage_rest !== null && record.leistungstest_tage_rest <= WARNING_THRESHOLD_DAYS) { warnings.push({ key: 'leistungstest', tageRest: record.leistungstest_tage_rest, diff --git a/frontend/src/components/shared/Header.tsx b/frontend/src/components/shared/Header.tsx index bf96bbb..8ee38f5 100644 --- a/frontend/src/components/shared/Header.tsx +++ b/frontend/src/components/shared/Header.tsx @@ -41,8 +41,8 @@ function Header({ onMenuClick }: HeaderProps) { if (\!record) return; let count = 0; const THRESHOLD = 60; - if (record.untersuchung_tage_rest \!== null && record.untersuchung_tage_rest <= THRESHOLD) count++; - if (record.leistungstest_tage_rest \!== null && record.leistungstest_tage_rest <= THRESHOLD) count++; + if (record.untersuchung_tage_rest !== null && record.untersuchung_tage_rest <= THRESHOLD) count++; + if (record.leistungstest_tage_rest !== null && record.leistungstest_tage_rest <= THRESHOLD) count++; setWarningCount(count); }) .catch(() => { /* non-critical */ });