From 004b141cabd1f31f8c6d5919f2ba58237e63b557 Mon Sep 17 00:00:00 2001 From: Matthias Hochmeister Date: Tue, 3 Mar 2026 13:27:27 +0100 Subject: [PATCH] bug fixes --- .../src/components/dashboard/ActivityFeed.tsx | 174 ------------------ .../src/components/dashboard/UserProfile.tsx | 3 + frontend/src/components/dashboard/index.ts | 1 - frontend/src/pages/Dashboard.tsx | 97 ++++------ 4 files changed, 42 insertions(+), 233 deletions(-) delete mode 100644 frontend/src/components/dashboard/ActivityFeed.tsx diff --git a/frontend/src/components/dashboard/ActivityFeed.tsx b/frontend/src/components/dashboard/ActivityFeed.tsx deleted file mode 100644 index 7be3bc6..0000000 --- a/frontend/src/components/dashboard/ActivityFeed.tsx +++ /dev/null @@ -1,174 +0,0 @@ -import React from 'react'; -import { - Card, - CardContent, - Typography, - List, - ListItem, - ListItemAvatar, - ListItemText, - Avatar, - Box, -} from '@mui/material'; -import { - LocalFireDepartment, - Person, - DirectionsCar, - Assignment, -} from '@mui/icons-material'; - -interface Activity { - id: string; - type: 'incident' | 'member' | 'vehicle' | 'task'; - title: string; - description: string; - timestamp: string; -} - -// Placeholder activities -const placeholderActivities: Activity[] = [ - { - id: '1', - type: 'incident', - title: 'Brandeinsatz', - description: 'Kleinbrand in der Hauptstraße', - timestamp: 'Vor 2 Stunden', - }, - { - id: '2', - type: 'member', - title: 'Neues Mitglied', - description: 'Max Mustermann ist der Feuerwehr beigetreten', - timestamp: 'Vor 5 Stunden', - }, - { - id: '3', - type: 'vehicle', - title: 'Fahrzeugwartung', - description: 'LF 16/12 - Wartung abgeschlossen', - timestamp: 'Gestern', - }, - { - id: '4', - type: 'task', - title: 'Aufgabe zugewiesen', - description: 'Neue Aufgabe: Inventur Atemschutzgeräte', - timestamp: 'Vor 2 Tagen', - }, -]; - -const ActivityFeed: React.FC = () => { - const getActivityIcon = (type: Activity['type']) => { - switch (type) { - case 'incident': - return ; - case 'member': - return ; - case 'vehicle': - return ; - case 'task': - return ; - default: - return ; - } - }; - - const getActivityColor = (type: Activity['type']) => { - switch (type) { - case 'incident': - return 'error.main'; - case 'member': - return 'success.main'; - case 'vehicle': - return 'warning.main'; - case 'task': - return 'info.main'; - default: - return 'primary.main'; - } - }; - - return ( - - - - Letzte Aktivitäten - - - - {placeholderActivities.map((activity, index) => ( - - - - - {getActivityIcon(activity.type)} - - - - {activity.title} - - } - secondary={ - - - {activity.description} - - - {activity.timestamp} - - - } - /> - - - ))} - - - {placeholderActivities.length === 0 && ( - - - Keine Aktivitäten vorhanden - - - )} - - - ); -}; - -export default ActivityFeed; diff --git a/frontend/src/components/dashboard/UserProfile.tsx b/frontend/src/components/dashboard/UserProfile.tsx index 8ded6a6..69427a1 100644 --- a/frontend/src/components/dashboard/UserProfile.tsx +++ b/frontend/src/components/dashboard/UserProfile.tsx @@ -61,6 +61,9 @@ const UserProfile: React.FC = ({ user }) => { {/* User Info */} + Willkommen zurück, {user.given_name || user.name.split(' ')[0]}! + + {user.name} diff --git a/frontend/src/components/dashboard/index.ts b/frontend/src/components/dashboard/index.ts index 8e5fe28..015289d 100644 --- a/frontend/src/components/dashboard/index.ts +++ b/frontend/src/components/dashboard/index.ts @@ -1,7 +1,6 @@ export { default as UserProfile } from './UserProfile'; export { default as ServiceCard } from './ServiceCard'; export { default as StatsCard } from './StatsCard'; -export { default as ActivityFeed } from './ActivityFeed'; export { default as DashboardLayout } from './DashboardLayout'; export { default as PersonalWarningsBanner } from './PersonalWarningsBanner'; export { default as UpcomingEventsWidget } from './UpcomingEventsWidget'; diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 7ac309f..3560f95 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -2,8 +2,6 @@ import { useState, useEffect } from 'react'; import { Container, Box, - Typography, - Grid, Fade, } from '@mui/material'; import { useAuth } from '../contexts/AuthContext'; @@ -12,7 +10,6 @@ import SkeletonCard from '../components/shared/SkeletonCard'; import UserProfile from '../components/dashboard/UserProfile'; import NextcloudTalkWidget from '../components/dashboard/NextcloudTalkWidget'; import UpcomingEventsWidget from '../components/dashboard/UpcomingEventsWidget'; -import ActivityFeed from '../components/dashboard/ActivityFeed'; import AtemschutzDashboardCard from '../components/atemschutz/AtemschutzDashboardCard'; import EquipmentDashboardCard from '../components/equipment/EquipmentDashboardCard'; import VehicleDashboardCard from '../components/vehicles/VehicleDashboardCard'; @@ -33,25 +30,22 @@ function Dashboard() { return ( - - {/* Welcome Message */} - - {dataLoading ? ( - - ) : ( - - - - Willkommen zurück, {user?.given_name || user?.name.split(' ')[0]}! - - - - )} - - - {/* User Profile Card */} + + {/* User Profile Card — full width, contains welcome greeting */} {user && ( - + {dataLoading ? ( ) : ( @@ -61,82 +55,69 @@ function Dashboard() { )} - + )} - {/* Personal Atemschutz Warnings — shown only when relevant */} + {/* Personal Warnings Banner — full width, conditionally rendered */} {user && ( - + - + )} {/* Vehicle Status Card */} - - - + + + - + {/* Equipment Status Card */} - - - + + + - + {/* Atemschutz Status Card */} - - - + + + - + {/* Upcoming Events Widget */} - + - + - + {/* Nextcloud Talk Widget */} - + {dataLoading ? ( ) : ( - - + + )} - - - {/* Activity Feed */} - - {dataLoading ? ( - - ) : ( - - - - - - )} - - + + );