From 83bacf0e2f4355b5776c1e65a5221fcd28b1522d Mon Sep 17 00:00:00 2001 From: Eric Gullickson <16152721+ericgullickson@users.noreply.github.com> Date: Fri, 13 Feb 2026 21:14:22 -0600 Subject: [PATCH] chore: accept PDF files in receipt upload dialog (refs #182) Co-Authored-By: Claude Opus 4.6 --- .../maintenance/components/AddReceiptDialog.tsx | 14 ++++++++++---- .../src/shared/components/CameraCapture/types.ts | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/src/features/maintenance/components/AddReceiptDialog.tsx b/frontend/src/features/maintenance/components/AddReceiptDialog.tsx index a2728d8..65123ff 100644 --- a/frontend/src/features/maintenance/components/AddReceiptDialog.tsx +++ b/frontend/src/features/maintenance/components/AddReceiptDialog.tsx @@ -47,11 +47,17 @@ export const AddReceiptDialog: React.FC = ({ file.name.toLowerCase().endsWith('.heif') ); } + if (format === 'application/pdf') { + return ( + file.type === 'application/pdf' || + file.name.toLowerCase().endsWith('.pdf') + ); + } return file.type === format; }); if (!isValidType) { - return 'Invalid file type. Accepted formats: JPEG, PNG, HEIC'; + return 'Invalid file type. Accepted formats: JPEG, PNG, HEIC, PDF'; } if (file.size > DEFAULT_MAX_FILE_SIZE) { @@ -207,10 +213,10 @@ export const AddReceiptDialog: React.FC = ({ textAlign="center" fontWeight={500} > - {isDragging ? 'Drop image here' : 'Drag and drop an image, or tap to browse'} + {isDragging ? 'Drop file here' : 'Drag and drop an image or PDF, or tap to browse'} - JPEG, PNG, HEIC -- up to 10MB + JPEG, PNG, HEIC, PDF -- up to 10MB @@ -265,7 +271,7 @@ export const AddReceiptDialog: React.FC = ({ accept={DEFAULT_ACCEPTED_FORMATS.join(',')} onChange={handleInputChange} style={{ display: 'none' }} - aria-label="Select receipt image" + aria-label="Select receipt file" /> ); diff --git a/frontend/src/shared/components/CameraCapture/types.ts b/frontend/src/shared/components/CameraCapture/types.ts index f60f6e8..5be9dca 100644 --- a/frontend/src/shared/components/CameraCapture/types.ts +++ b/frontend/src/shared/components/CameraCapture/types.ts @@ -127,6 +127,7 @@ export const DEFAULT_ACCEPTED_FORMATS = [ 'image/png', 'image/heic', 'image/heif', + 'application/pdf', ]; /** Default max file size (10MB) */