Add Studio Code and Photographer to Galleries. (#4195)

* Added Studio Code and Photographer to Galleries
* Fix gallery display on mobile
* Fixed potential panic when scraping with a bad configuration
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
bob123491234
2023-11-27 22:05:33 -06:00
committed by GitHub
parent b78771dbcd
commit d1018b4c5d
25 changed files with 243 additions and 102 deletions

View File

@@ -86,8 +86,10 @@ export const GalleryEditPanel: React.FC<IProps> = ({
const schema = yup.object({
title: titleRequired ? yup.string().required() : yup.string().ensure(),
code: yup.string().ensure(),
urls: yupUniqueStringList("urls"),
date: yupDateString(intl),
photographer: yup.string().ensure(),
rating100: yup.number().integer().nullable().defined(),
studio_id: yup.string().required().nullable(),
performer_ids: yup.array(yup.string().required()).defined(),
@@ -98,8 +100,10 @@ export const GalleryEditPanel: React.FC<IProps> = ({
const initialValues = {
title: gallery?.title ?? "",
code: gallery?.code ?? "",
urls: gallery?.urls ?? [],
date: gallery?.date ?? "",
photographer: gallery?.photographer ?? "",
rating100: gallery?.rating100 ?? null,
studio_id: gallery?.studio?.id ?? null,
performer_ids: (gallery?.performers ?? []).map((p) => p.id),
@@ -288,10 +292,18 @@ export const GalleryEditPanel: React.FC<IProps> = ({
formik.setFieldValue("title", galleryData.title);
}
if (galleryData.code) {
formik.setFieldValue("code", galleryData.code);
}
if (galleryData.details) {
formik.setFieldValue("details", galleryData.details);
}
if (galleryData.photographer) {
formik.setFieldValue("photographer", galleryData.photographer);
}
if (galleryData.date) {
formik.setFieldValue("date", galleryData.date);
}
@@ -490,6 +502,7 @@ export const GalleryEditPanel: React.FC<IProps> = ({
<Row className="form-container px-3">
<Col lg={7} xl={12}>
{renderInputField("title")}
{renderInputField("code", "text", "scene_code")}
{renderURLListField(
"urls",
@@ -499,6 +512,7 @@ export const GalleryEditPanel: React.FC<IProps> = ({
)}
{renderDateField("date")}
{renderInputField("photographer")}
{renderRatingField("rating100", "rating")}
{renderScenesField()}