fix: add Edit (pencil) icon to Documents page (refs #51)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 2m50s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 38s
Deploy to Staging / Verify Staging (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 2m50s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 38s
Deploy to Staging / Verify Staging (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
Added missing Edit icon button between Eye and Trash icons. Clicking Edit opens EditDocumentDialog to modify the document. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,10 +12,13 @@ import {
|
|||||||
useMediaQuery,
|
useMediaQuery,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import VisibilityIcon from '@mui/icons-material/Visibility';
|
import VisibilityIcon from '@mui/icons-material/Visibility';
|
||||||
|
import EditIcon from '@mui/icons-material/Edit';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { AddDocumentDialog } from '../components/AddDocumentDialog';
|
import { AddDocumentDialog } from '../components/AddDocumentDialog';
|
||||||
|
import { EditDocumentDialog } from '../components/EditDocumentDialog';
|
||||||
import { ExpirationBadge } from '../components/ExpirationBadge';
|
import { ExpirationBadge } from '../components/ExpirationBadge';
|
||||||
|
import type { DocumentRecord } from '../types/documents.types';
|
||||||
import { DocumentCardMetadata } from '../components/DocumentCardMetadata';
|
import { DocumentCardMetadata } from '../components/DocumentCardMetadata';
|
||||||
import { useVehicles } from '../../vehicles/hooks/useVehicles';
|
import { useVehicles } from '../../vehicles/hooks/useVehicles';
|
||||||
import { getVehicleLabel } from '../utils/vehicleLabel';
|
import { getVehicleLabel } from '../utils/vehicleLabel';
|
||||||
@@ -27,6 +30,7 @@ export const DocumentsPage: React.FC = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const removeDoc = useDeleteDocument();
|
const removeDoc = useDeleteDocument();
|
||||||
const [isAddOpen, setIsAddOpen] = React.useState(false);
|
const [isAddOpen, setIsAddOpen] = React.useState(false);
|
||||||
|
const [editingDoc, setEditingDoc] = React.useState<DocumentRecord | null>(null);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
|
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
|
||||||
|
|
||||||
@@ -100,6 +104,13 @@ export const DocumentsPage: React.FC = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
<AddDocumentDialog open={isAddOpen} onClose={() => setIsAddOpen(false)} />
|
<AddDocumentDialog open={isAddOpen} onClose={() => setIsAddOpen(false)} />
|
||||||
|
{editingDoc && (
|
||||||
|
<EditDocumentDialog
|
||||||
|
open={!!editingDoc}
|
||||||
|
onClose={() => setEditingDoc(null)}
|
||||||
|
document={editingDoc}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{isLoading && (
|
{isLoading && (
|
||||||
<Box sx={{ display: 'flex', justifyContent: 'center', py: 6 }}>
|
<Box sx={{ display: 'flex', justifyContent: 'center', py: 6 }}>
|
||||||
@@ -235,6 +246,27 @@ export const DocumentsPage: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<VisibilityIcon fontSize={isMobile ? 'medium' : 'small'} />
|
<VisibilityIcon fontSize={isMobile ? 'medium' : 'small'} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
size={isMobile ? 'medium' : 'small'}
|
||||||
|
onClick={() => setEditingDoc(doc)}
|
||||||
|
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="Edit"
|
||||||
|
>
|
||||||
|
<EditIcon fontSize={isMobile ? 'medium' : 'small'} />
|
||||||
|
</IconButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
size={isMobile ? 'medium' : 'small'}
|
size={isMobile ? 'medium' : 'small'}
|
||||||
onClick={() => removeDoc.mutate(doc.id)}
|
onClick={() => removeDoc.mutate(doc.id)}
|
||||||
|
|||||||
Reference in New Issue
Block a user