Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add birthdate to performer select and restyle #5076

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ui/v2.5/graphql/data/performer-slim.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ fragment SelectPerformerData on Performer {
disambiguation
alias_list
image_path
birthdate
death_date
}
70 changes: 52 additions & 18 deletions ui/v2.5/src/components/Performers/PerformerSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Performer>;

Expand Down Expand Up @@ -112,23 +120,49 @@ const _PerformerSelect: React.FC<
thisOptionProps = {
...optionProps,
children: (
<span className="react-select-image-option performer-select-option">
<Link
to={`/performers/${object.id}`}
target="_blank"
className="performer-select-image-link"
>
<img
className="performer-select-image"
src={object.image_path ?? ""}
loading="lazy"
/>
</Link>
<span>{name}</span>
{object.disambiguation && (
<span className="performer-disambiguation">{` (${object.disambiguation})`}</span>
)}
{alias && <span className="alias">{` (${alias})`}</span>}
<span className="performer-select-option">
<span className="performer-select-row">
<Link
to={`/performers/${object.id}`}
target="_blank"
className="performer-select-image-link"
>
<img
className="performer-select-image"
src={object.image_path ?? ""}
loading="lazy"
/>
</Link>
<span className="performer-select-details">
<TruncatedText
className="performer-select-name"
text={
<span>
{name}
{alias && (
<span className="performer-select-alias">{` (${alias})`}</span>
)}
</span>
}
lineCount={1}
/>

{object.disambiguation && (
<span className="performer-select-disambiguation">
{object.disambiguation}
</span>
)}

{object.birthdate && (
<span className="performer-select-birthdate">{`${
object.birthdate
} (${TextUtils.age(
object.birthdate,
object.death_date
)})`}</span>
)}
</span>
</span>
</span>
),
};
Expand Down
52 changes: 37 additions & 15 deletions ui/v2.5/src/components/Performers/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}

Expand Down
Loading