diff --git a/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryEditPanel.tsx b/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryEditPanel.tsx index 6acefcf7dc3..b9eea8f5d4b 100644 --- a/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryEditPanel.tsx +++ b/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryEditPanel.tsx @@ -364,9 +364,22 @@ export const GalleryEditPanel: React.FC = ({ } function renderPerformersField() { + const date = (() => { + try { + return schema.validateSyncAt("date", formik.values); + } catch (e) { + return undefined; + } + })(); + const title = intl.formatMessage({ id: "performers" }); const control = ( - + ); return renderField("performer_ids", title, control, fullWidthProps); diff --git a/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryScrapeDialog.tsx b/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryScrapeDialog.tsx index dd3357fec83..5fe20b7b0f9 100644 --- a/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryScrapeDialog.tsx +++ b/ui/v2.5/src/components/Galleries/GalleryDetails/GalleryScrapeDialog.tsx @@ -199,6 +199,7 @@ export const GalleryScrapeDialog: React.FC = ({ onChange={(value) => setPerformers(value)} newObjects={newPerformers} onCreateNew={createNewPerformer} + ageFromDate={date.useNewValue ? date.newValue : date.originalValue} /> {scrapedTagsRow} = ({ } function renderPerformersField() { + const date = (() => { + try { + return schema.validateSyncAt("date", formik.values); + } catch (e) { + return undefined; + } + })(); + const title = intl.formatMessage({ id: "performers" }); const control = ( - + ); return renderField("performer_ids", title, control, fullWidthProps); diff --git a/ui/v2.5/src/components/Performers/PerformerSelect.tsx b/ui/v2.5/src/components/Performers/PerformerSelect.tsx index 1b24b737a13..9b4f033caa0 100644 --- a/ui/v2.5/src/components/Performers/PerformerSelect.tsx +++ b/ui/v2.5/src/components/Performers/PerformerSelect.tsx @@ -71,7 +71,7 @@ const performerSelectSort = PatchFunction( ); const _PerformerSelect: React.FC< - IFilterProps & IFilterValueProps + IFilterProps & IFilterValueProps & { ageFromDate?: string | null } > = (props) => { const [createPerformer] = usePerformerCreate(); @@ -117,6 +117,27 @@ const _PerformerSelect: React.FC< ); } + const sceneAge = TextUtils.age(object.birthdate, props.ageFromDate); + + const age = + sceneAge < 18 + ? TextUtils.age(object.birthdate, object.death_date) + : sceneAge; + + const ageL10nId = + !props.ageFromDate || sceneAge < 18 + ? "media_info.performer_card.age" + : "age_on_date"; + + const ageL10String = intl.formatMessage({ + id: "years_old", + defaultMessage: "years old", + }); + const ageString = intl.formatMessage( + { id: ageL10nId }, + { age, years_old: ageL10String } + ); + thisOptionProps = { ...optionProps, children: ( @@ -154,12 +175,10 @@ const _PerformerSelect: React.FC< )} {object.birthdate && ( - {`${ - object.birthdate - } (${TextUtils.age( - object.birthdate, - object.death_date - )})`} + + {object.birthdate} + {` (${ageString})`} + )} diff --git a/ui/v2.5/src/components/Scenes/SceneDetails/SceneEditPanel.tsx b/ui/v2.5/src/components/Scenes/SceneDetails/SceneEditPanel.tsx index 2eef3de1fb4..35899f60dab 100644 --- a/ui/v2.5/src/components/Scenes/SceneDetails/SceneEditPanel.tsx +++ b/ui/v2.5/src/components/Scenes/SceneDetails/SceneEditPanel.tsx @@ -623,9 +623,22 @@ export const SceneEditPanel: React.FC = ({ } function renderPerformersField() { + const date = (() => { + try { + return schema.validateSyncAt("date", formik.values); + } catch (e) { + return undefined; + } + })(); + const title = intl.formatMessage({ id: "performers" }); const control = ( - + ); return renderField("performer_ids", title, control, fullWidthProps); diff --git a/ui/v2.5/src/components/Scenes/SceneDetails/SceneScrapeDialog.tsx b/ui/v2.5/src/components/Scenes/SceneDetails/SceneScrapeDialog.tsx index e66ee8b367b..d6acfabfb43 100644 --- a/ui/v2.5/src/components/Scenes/SceneDetails/SceneScrapeDialog.tsx +++ b/ui/v2.5/src/components/Scenes/SceneDetails/SceneScrapeDialog.tsx @@ -252,6 +252,7 @@ export const SceneScrapeDialog: React.FC = ({ onChange={(value) => setPerformers(value)} newObjects={newPerformers} onCreateNew={createNewPerformer} + ageFromDate={date.useNewValue ? date.newValue : date.originalValue} /> = ({ title={intl.formatMessage({ id: "performers" })} result={performers} onChange={(value) => setPerformers(value)} + ageFromDate={date.useNewValue ? date.newValue : date.originalValue} /> = Omit< >; export const ScrapedPerformersRow: React.FC< - IScrapedObjectRowImpl -> = ({ title, result, onChange, newObjects, onCreateNew }) => { + IScrapedObjectRowImpl & { ageFromDate?: string | null } +> = ({ title, result, onChange, newObjects, onCreateNew, ageFromDate }) => { const performersCopy = useMemo(() => { return ( newObjects?.map((p) => { @@ -179,6 +179,7 @@ export const ScrapedPerformersRow: React.FC< } }} values={selectValue} + ageFromDate={ageFromDate} /> ); } diff --git a/ui/v2.5/src/components/Tagger/scenes/PerformerResult.tsx b/ui/v2.5/src/components/Tagger/scenes/PerformerResult.tsx index 25f0ca88f73..f606f4669b6 100755 --- a/ui/v2.5/src/components/Tagger/scenes/PerformerResult.tsx +++ b/ui/v2.5/src/components/Tagger/scenes/PerformerResult.tsx @@ -51,6 +51,7 @@ interface IPerformerResultProps { onCreate: () => void; onLink?: () => Promise; endpoint?: string; + ageFromDate?: string | null; } const PerformerResult: React.FC = ({ @@ -60,6 +61,7 @@ const PerformerResult: React.FC = ({ onCreate, onLink, endpoint, + ageFromDate, }) => { const { data: performerData, loading: stashLoading } = GQL.useFindPerformerQuery({ @@ -191,6 +193,7 @@ const PerformerResult: React.FC = ({ onSelect={handleSelect} active={selectedSource === "existing"} isClearable={false} + ageFromDate={ageFromDate} /> {maybeRenderLinkButton()} diff --git a/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx b/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx index cc8f6a132e6..c375df0684d 100755 --- a/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx +++ b/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx @@ -699,6 +699,11 @@ const StashSearchResult: React.FC = ({ currentSource?.sourceInput.stash_box_endpoint ?? undefined } key={`${performer.name ?? performer.remote_site_id ?? ""}`} + ageFromDate={ + !scene.date || excludedFields.date + ? stashScene.date + : scene.date + } /> ))} diff --git a/ui/v2.5/src/components/Tagger/styles.scss b/ui/v2.5/src/components/Tagger/styles.scss index 5fcff5baf02..bdaed5a0f04 100644 --- a/ui/v2.5/src/components/Tagger/styles.scss +++ b/ui/v2.5/src/components/Tagger/styles.scss @@ -70,7 +70,7 @@ .performer-select, .studio-select { - width: 14rem; + width: 18rem; // stylelint-disable-next-line selector-class-pattern &-active .react-select__control { diff --git a/ui/v2.5/src/locales/en-GB.json b/ui/v2.5/src/locales/en-GB.json index 5145ea829cd..f0e807ef6a9 100644 --- a/ui/v2.5/src/locales/en-GB.json +++ b/ui/v2.5/src/locales/en-GB.json @@ -139,6 +139,7 @@ }, "actions_name": "Actions", "age": "Age", + "age_on_date": "{age} on this date", "aliases": "Aliases", "all": "all", "also_known_as": "Also known as",