Always show all film simulations for fujis
This commit is contained in:
parent
b943d3c102
commit
16c58facc9
@ -9,11 +9,13 @@ import {
|
||||
absolutePathForFilmImage,
|
||||
} from '@/app/paths';
|
||||
import {
|
||||
FILM_SIMULATION_FORM_INPUT_OPTIONS,
|
||||
FujifilmSimulation,
|
||||
labelForFilm,
|
||||
} from '@/platforms/fujifilm/simulation';
|
||||
import { formatCount } from '@/utility/string';
|
||||
import { formatCountDescriptive } from '@/utility/string';
|
||||
import { AnnotatedTag } from '@/photo/form';
|
||||
|
||||
export type FilmSimulation = FujifilmSimulation;
|
||||
|
||||
@ -85,10 +87,30 @@ export const generateMetaForFilm = (
|
||||
export const photoHasFilmData = (photo: Photo) =>
|
||||
Boolean(photo.film);
|
||||
|
||||
export const convertFilmsForForm = (films: Films = []) =>
|
||||
sortFilms(films)
|
||||
.map(({ film, count }) => ({
|
||||
value: film,
|
||||
annotation: formatCount(count),
|
||||
annotationAria: formatCountDescriptive(count),
|
||||
}));
|
||||
export const convertFilmsForForm = (
|
||||
_films: Films = [],
|
||||
includeAllFujifilmSimulations?: boolean,
|
||||
): AnnotatedTag[] => {
|
||||
const films = includeAllFujifilmSimulations
|
||||
? FILM_SIMULATION_FORM_INPUT_OPTIONS.map(film => ({
|
||||
value: film.value,
|
||||
} as AnnotatedTag))
|
||||
: [];
|
||||
|
||||
_films.forEach(({ film, count }) => {
|
||||
const index = films.findIndex(f => f.value === film);
|
||||
const annotation = formatCount(count);
|
||||
const annotationAria = formatCountDescriptive(count);
|
||||
if (index !== -1) {
|
||||
films[index] = {
|
||||
...films[index],
|
||||
annotation,
|
||||
annotationAria,
|
||||
};
|
||||
} else {
|
||||
films.push({ value: film, annotation, annotationAria });
|
||||
}
|
||||
});
|
||||
|
||||
return films.sort((a, b) => a.value.localeCompare(b.value));
|
||||
};
|
||||
|
||||
@ -44,6 +44,7 @@ import ApplyRecipeTitleGloballyCheckbox from './ApplyRecipesGloballyCheckbox';
|
||||
import { convertFilmsForForm, Films, FilmSimulation } from '@/film';
|
||||
import IconFavs from '@/components/icons/IconFavs';
|
||||
import IconHidden from '@/components/icons/IconHidden';
|
||||
import { isMakeFujifilm } from '@/platforms/fujifilm';
|
||||
|
||||
const THUMBNAIL_SIZE = 300;
|
||||
|
||||
@ -328,7 +329,7 @@ export default function PhotoForm({
|
||||
{FORM_METADATA_ENTRIES(
|
||||
convertTagsForForm(uniqueTags),
|
||||
convertRecipesForForm(uniqueRecipes),
|
||||
convertFilmsForForm(uniqueFilms),
|
||||
convertFilmsForForm(uniqueFilms, isMakeFujifilm(formData.make)),
|
||||
aiContent !== undefined,
|
||||
shouldStripGpsData,
|
||||
)
|
||||
|
||||
@ -20,7 +20,10 @@ const BYTES_PER_TAG = 12;
|
||||
const BYTES_PER_TAG_VALUE = 4;
|
||||
|
||||
export const isExifForFujifilm = (data: ExifData) =>
|
||||
data.tags?.Make === MAKE_FUJIFILM;
|
||||
data.tags?.Make?.toLocaleUpperCase() === MAKE_FUJIFILM;
|
||||
|
||||
export const isMakeFujifilm = (make?: string) =>
|
||||
make?.toLocaleUpperCase() === MAKE_FUJIFILM;
|
||||
|
||||
export const parseFujifilmMakerNote = (
|
||||
bytes: Buffer,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user