chore: accept PDF files in receipt upload dialog (refs #182)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m39s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 23s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eric Gullickson
2026-02-13 21:14:22 -06:00
parent 812823f2f1
commit 83bacf0e2f
2 changed files with 11 additions and 4 deletions

View File

@@ -47,11 +47,17 @@ export const AddReceiptDialog: React.FC<AddReceiptDialogProps> = ({
file.name.toLowerCase().endsWith('.heif') file.name.toLowerCase().endsWith('.heif')
); );
} }
if (format === 'application/pdf') {
return (
file.type === 'application/pdf' ||
file.name.toLowerCase().endsWith('.pdf')
);
}
return file.type === format; return file.type === format;
}); });
if (!isValidType) { 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) { if (file.size > DEFAULT_MAX_FILE_SIZE) {
@@ -207,10 +213,10 @@ export const AddReceiptDialog: React.FC<AddReceiptDialogProps> = ({
textAlign="center" textAlign="center"
fontWeight={500} 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'}
</Typography> </Typography>
<Typography variant="caption" color="text.secondary" textAlign="center"> <Typography variant="caption" color="text.secondary" textAlign="center">
JPEG, PNG, HEIC -- up to 10MB JPEG, PNG, HEIC, PDF -- up to 10MB
</Typography> </Typography>
</Box> </Box>
@@ -265,7 +271,7 @@ export const AddReceiptDialog: React.FC<AddReceiptDialogProps> = ({
accept={DEFAULT_ACCEPTED_FORMATS.join(',')} accept={DEFAULT_ACCEPTED_FORMATS.join(',')}
onChange={handleInputChange} onChange={handleInputChange}
style={{ display: 'none' }} style={{ display: 'none' }}
aria-label="Select receipt image" aria-label="Select receipt file"
/> />
</Dialog> </Dialog>
); );

View File

@@ -127,6 +127,7 @@ export const DEFAULT_ACCEPTED_FORMATS = [
'image/png', 'image/png',
'image/heic', 'image/heic',
'image/heif', 'image/heif',
'application/pdf',
]; ];
/** Default max file size (10MB) */ /** Default max file size (10MB) */