diff --git a/frontend/src/features/documents/pages/DocumentsPage.tsx b/frontend/src/features/documents/pages/DocumentsPage.tsx index f45464c..0848216 100644 --- a/frontend/src/features/documents/pages/DocumentsPage.tsx +++ b/frontend/src/features/documents/pages/DocumentsPage.tsx @@ -1,8 +1,18 @@ import React, { useMemo } from 'react'; import { useAuth0 } from '@auth0/auth0-react'; import { useDocumentsList, useDeleteDocument } from '../hooks/useDocuments'; -import { Card } from '../../../shared-minimal/components/Card'; -import { Button } from '../../../shared-minimal/components/Button'; +import { + Card, + CardContent, + Box, + Typography, + IconButton, + Button, + useTheme, + useMediaQuery, +} from '@mui/material'; +import VisibilityIcon from '@mui/icons-material/Visibility'; +import DeleteIcon from '@mui/icons-material/Delete'; import { useNavigate } from 'react-router-dom'; import { AddDocumentDialog } from '../components/AddDocumentDialog'; import { ExpirationBadge } from '../components/ExpirationBadge'; @@ -17,41 +27,43 @@ export const DocumentsPage: React.FC = () => { const navigate = useNavigate(); const removeDoc = useDeleteDocument(); const [isAddOpen, setIsAddOpen] = React.useState(false); + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('sm')); const vehiclesMap = useMemo(() => new Map(vehicles?.map(v => [v.id, v]) || []), [vehicles]); // Show loading while auth is initializing if (authLoading) { return ( -
-

Documents

-
-
Checking authentication...
-
-
+ + Documents + + Checking authentication... + + ); } // Show login prompt when not authenticated if (!isAuthenticated) { return ( -
-

Documents

- -
-
- + + Documents + + + + -
-

Authentication Required

-

Please log in to view your documents

- -
+
-
+ ); } @@ -59,115 +71,198 @@ export const DocumentsPage: React.FC = () => { const isAuthError = error && (error as any).response?.status === 401; if (isAuthError) { return ( -
-

Documents

- -
-
- + + Documents + + + + -
-

Session Expired

-

Your session has expired. Please log in again to continue.

- -
+
-
+ ); } return ( -
-
-

Documents

-
- -
-
+ + + Documents + + setIsAddOpen(false)} /> {isLoading && ( -
-
Loading documents...
-
+ + Loading documents... + )} {error && !isAuthError && ( - -
-
- + + + + -
-

Error Loading Documents

-

Failed to load documents. Please try again.

- -
+
)} {!isLoading && !error && data && data.length === 0 && ( - -
-
- + + + + -
-

No Documents Yet

-

You haven't added any documents yet. Documents will appear here once you create them.

- -
+
)} {!isLoading && !error && data && data.length > 0 && ( -
+ {data.map((doc) => { const vehicle = vehiclesMap.get(doc.vehicleId); const vehicleLabel = getVehicleLabel(vehicle); return ( - -
-
- {doc.title} + + + + {doc.title} -
-
Type: {doc.documentType}
+ + Type: {doc.documentType} -
- Vehicle: - -
+ + {doc.sharedVehicleIds.length > 0 && ( -
+ Shared with {doc.sharedVehicleIds.length} other vehicle{doc.sharedVehicleIds.length > 1 ? 's' : ''} -
+ )} -
- - -
-
+ + + navigate(`/garage/documents/${doc.id}`)} + sx={{ + color: 'text.secondary', + minWidth: isMobile ? 48 : 'auto', + minHeight: isMobile ? 48 : 'auto', + '&:hover': { + backgroundColor: 'primary.main', + color: 'white', + }, + ...(isMobile && { + border: '1px solid', + borderColor: 'divider', + borderRadius: 2, + }), + }} + title="View Details" + > + + + removeDoc.mutate(doc.id)} + sx={{ + color: 'error.main', + minWidth: isMobile ? 48 : 'auto', + minHeight: isMobile ? 48 : 'auto', + '&:hover': { + backgroundColor: 'error.main', + color: 'white', + }, + ...(isMobile && { + border: '1px solid', + borderColor: 'error.main', + borderRadius: 2, + }), + }} + title="Delete" + > + + +
); })} -
+
)} -
+ ); }; diff --git a/frontend/src/features/fuel-logs/components/FuelLogsList.tsx b/frontend/src/features/fuel-logs/components/FuelLogsList.tsx index 64df06f..6e5a6f5 100644 --- a/frontend/src/features/fuel-logs/components/FuelLogsList.tsx +++ b/frontend/src/features/fuel-logs/components/FuelLogsList.tsx @@ -162,7 +162,12 @@ export const FuelLogsList: React.FC = ({ logs, onEdit, onDele flexDirection: isMobile ? 'column' : 'row', alignItems: isMobile ? 'stretch' : 'center', gap: isMobile ? 1 : 0, - py: isMobile ? 2 : 1 + py: isMobile ? 2 : 1, + '&:hover': { + backgroundColor: 'action.hover', + }, + transition: 'background-color 0.2s ease-in-out', + cursor: 'default', }} > = ({ const subtypeCount = record.subtypeCount || record.subtypes?.length || 0; return ( - + = const reminderDisplay = getReminderDisplay(schedule); return ( - +