Hide caption field for photos without titles
This commit is contained in:
parent
2ec32cac12
commit
fead3d01e5
@ -170,13 +170,13 @@ export default function PhotoForm({
|
||||
validate,
|
||||
capitalize,
|
||||
hideIfEmpty,
|
||||
hideBasedOnCamera,
|
||||
shouldHide,
|
||||
loadingMessage,
|
||||
type,
|
||||
}]) =>
|
||||
(
|
||||
(!hideIfEmpty || formData[key]) &&
|
||||
!hideBasedOnCamera?.(formData.make)
|
||||
!shouldHide?.(formData)
|
||||
) &&
|
||||
<FieldSetWithStatus
|
||||
key={key}
|
||||
|
||||
@ -42,7 +42,7 @@ type FormMeta = {
|
||||
capitalize?: boolean
|
||||
hide?: boolean
|
||||
hideIfEmpty?: boolean
|
||||
hideBasedOnCamera?: (make?: string, mode?: string) => boolean
|
||||
shouldHide?: (formData: Partial<PhotoFormData>) => boolean
|
||||
loadingMessage?: string
|
||||
type?: FieldSetType
|
||||
selectOptions?: { value: string, label: string }[]
|
||||
@ -54,7 +54,11 @@ const FORM_METADATA = (
|
||||
tagOptions?: AnnotatedTag[]
|
||||
): Record<keyof PhotoFormData, FormMeta> => ({
|
||||
title: { label: 'title', capitalize: true },
|
||||
caption: { label: 'caption', capitalize: true },
|
||||
caption: {
|
||||
label: 'caption',
|
||||
capitalize: true,
|
||||
shouldHide: ({ title, caption }) => !title && !caption,
|
||||
},
|
||||
description: { label: 'description', capitalize: true, hide: true},
|
||||
tags: {
|
||||
label: 'tags',
|
||||
@ -80,7 +84,7 @@ const FORM_METADATA = (
|
||||
label: 'fujifilm simulation',
|
||||
selectOptions: FILM_SIMULATION_FORM_INPUT_OPTIONS,
|
||||
selectOptionsDefaultLabel: 'Unknown',
|
||||
hideBasedOnCamera: make => make !== MAKE_FUJIFILM,
|
||||
shouldHide: ({ make }) => make !== MAKE_FUJIFILM,
|
||||
},
|
||||
focalLength: { label: 'focal length' },
|
||||
focalLengthIn35MmFormat: { label: 'focal length 35mm-equivalent' },
|
||||
|
||||
Loading…
Reference in New Issue
Block a user