Prevent toasts for color data changes

This commit is contained in:
Sam Becker 2026-02-21 23:23:01 -06:00
parent 9142619746
commit d5809547ea
2 changed files with 10 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import {
useState,
} from 'react';
import {
FIELDS_TO_NOT_TOAST,
FIELDS_WITH_JSON,
FORM_METADATA_ENTRIES_BY_SECTION,
FORM_SECTIONS,
@ -184,8 +185,10 @@ export default function PhotoForm({
setDetectedFilm(updatedExifData.film);
}
if (changedKeys.length > 0) {
const fields = convertFormKeysToLabels(changedKeys);
const keysToToast = changedKeys.filter(key =>
!FIELDS_TO_NOT_TOAST.includes(key));
if (keysToToast.length > 0) {
const fields = convertFormKeysToLabels(keysToToast);
toastSuccess(`Updated EXIF fields: ${fields.join(', ')}`, 8000);
} else {
toastWarning('No new EXIF data found');

View File

@ -291,6 +291,11 @@ const FORM_METADATA = (
},
});
export const FIELDS_TO_NOT_TOAST: (keyof PhotoFormData)[] = [
'colorData',
'colorSort',
];
export const FIELDS_WITH_JSON = Object.entries(FORM_METADATA())
.filter(([_, meta]) => meta.isJson)
.map(([key]) => key as keyof PhotoFormData);