From 5d30a63ee2944fd44fe6b6cf7fbf7b5e129278b4 Mon Sep 17 00:00:00 2001 From: dogwithakeyboard Date: Mon, 15 Jul 2024 20:36:45 +0100 Subject: [PATCH] add birthdate to performer select and restyle --- ui/v2.5/graphql/data/performer-slim.graphql | 2 + .../components/Performers/PerformerSelect.tsx | 70 ++++++++++++++----- ui/v2.5/src/components/Performers/styles.scss | 52 ++++++++++---- 3 files changed, 91 insertions(+), 33 deletions(-) diff --git a/ui/v2.5/graphql/data/performer-slim.graphql b/ui/v2.5/graphql/data/performer-slim.graphql index d9f5f423383..1a4b9833bc8 100644 --- a/ui/v2.5/graphql/data/performer-slim.graphql +++ b/ui/v2.5/graphql/data/performer-slim.graphql @@ -39,4 +39,6 @@ fragment SelectPerformerData on Performer { disambiguation alias_list image_path + birthdate + death_date } diff --git a/ui/v2.5/src/components/Performers/PerformerSelect.tsx b/ui/v2.5/src/components/Performers/PerformerSelect.tsx index 17d885d5a1e..1b24b737a13 100644 --- a/ui/v2.5/src/components/Performers/PerformerSelect.tsx +++ b/ui/v2.5/src/components/Performers/PerformerSelect.tsx @@ -28,6 +28,8 @@ import { useCompare } from "src/hooks/state"; import { Link } from "react-router-dom"; import { sortByRelevance } from "src/utils/query"; import { PatchComponent, PatchFunction } from "src/patch"; +import { TruncatedText } from "../Shared/TruncatedText"; +import TextUtils from "src/utils/text"; export type SelectObject = { id: string; @@ -37,7 +39,13 @@ export type SelectObject = { export type Performer = Pick< GQL.Performer, - "id" | "name" | "alias_list" | "disambiguation" | "image_path" + | "id" + | "name" + | "alias_list" + | "disambiguation" + | "image_path" + | "birthdate" + | "death_date" >; type Option = SelectOption; @@ -112,23 +120,49 @@ const _PerformerSelect: React.FC< thisOptionProps = { ...optionProps, children: ( - - - - - {name} - {object.disambiguation && ( - {` (${object.disambiguation})`} - )} - {alias && {` (${alias})`}} + + + + + + + + {name} + {alias && ( + {` (${alias})`} + )} + + } + lineCount={1} + /> + + {object.disambiguation && ( + + {object.disambiguation} + + )} + + {object.birthdate && ( + {`${ + object.birthdate + } (${TextUtils.age( + object.birthdate, + object.death_date + )})`} + )} + + ), }; diff --git a/ui/v2.5/src/components/Performers/styles.scss b/ui/v2.5/src/components/Performers/styles.scss index 3dbee55c95e..b3531b0008a 100644 --- a/ui/v2.5/src/components/Performers/styles.scss +++ b/ui/v2.5/src/components/Performers/styles.scss @@ -198,24 +198,46 @@ } } -.performer-select { - .performer-disambiguation { - white-space: pre; - } +.performer-select-option { + .performer-select-row { + align-items: center; + display: flex; + width: 100%; - .performer-select-value .performer-disambiguation { - color: initial; - } + .performer-select-image { + margin-right: 0.4em; + max-height: 50px; + max-width: 50px; + } - .alias { - font-weight: bold; - white-space: pre; - } + .performer-select-details { + display: flex; + flex-direction: column; + justify-content: flex-start; + max-height: 4.1rem; + overflow: hidden; + + .performer-select-name { + flex-shrink: 0; + white-space: pre-wrap; + word-break: break-all; + + .performer-select-alias { + font-size: 0.8rem; + font-weight: bold; + } + } - .performer-select-image { - margin-right: 0.5em; - max-height: 50px; - max-width: 50px; + .performer-select-disambiguation, + .performer-select-birthdate { + color: $text-muted; + flex-shrink: 0; + font-size: 0.9rem; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } } }