Skip to content

Commit

Permalink
Update hair colors and fix text display on edit (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
Flashy78 authored Nov 24, 2024
1 parent 96c6bbd commit a000fa4
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 15 deletions.
69 changes: 59 additions & 10 deletions frontend/src/components/editCard/ModifyEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
EthnicityEnum,
BreastTypeEnum,
EditFragment,
HairColorEnum,
EyeColorEnum,
} from "src/graphql";
import {
formatDuration,
Expand All @@ -22,6 +24,13 @@ import {
categoryHref,
compareByName,
} from "src/utils";
import {
EthnicityTypes,
HairColorTypes,
EyeColorTypes,
BreastTypes,
GenderTypes,
} from "src/constants";
import { Icon } from "src/components/fragments";
import ChangeRow from "src/components/changeRow";
import ImageChangeRow from "src/components/imageChangeRow";
Expand Down Expand Up @@ -174,8 +183,14 @@ export const renderPerformerDetails = (
/>
<ChangeRow
name="Gender"
newValue={performerDetails.gender}
oldValue={oldPerformerDetails?.gender}
newValue={
performerDetails.gender &&
GenderTypes[performerDetails.gender as keyof typeof GenderEnum]
}
oldValue={
oldPerformerDetails?.gender &&
GenderTypes[oldPerformerDetails.gender as keyof typeof GenderEnum]
}
showDiff={showDiff}
/>
<ChangeRow
Expand All @@ -186,14 +201,32 @@ export const renderPerformerDetails = (
/>
<ChangeRow
name="Eye Color"
newValue={performerDetails.eye_color}
oldValue={oldPerformerDetails?.eye_color}
newValue={
performerDetails.eye_color &&
EyeColorTypes[performerDetails.eye_color as keyof typeof EyeColorEnum]
}
oldValue={
oldPerformerDetails?.eye_color &&
EyeColorTypes[
oldPerformerDetails.eye_color as keyof typeof EyeColorEnum
]
}
showDiff={showDiff}
/>
<ChangeRow
name="Hair Color"
newValue={performerDetails.hair_color}
oldValue={oldPerformerDetails?.hair_color}
newValue={
performerDetails.hair_color &&
HairColorTypes[
performerDetails.hair_color as keyof typeof HairColorEnum
]
}
oldValue={
oldPerformerDetails?.hair_color &&
HairColorTypes[
oldPerformerDetails.hair_color as keyof typeof HairColorEnum
]
}
showDiff={showDiff}
/>
<ChangeRow
Expand All @@ -204,8 +237,16 @@ export const renderPerformerDetails = (
/>
<ChangeRow
name="Breast Type"
newValue={performerDetails.breast_type}
oldValue={oldPerformerDetails?.breast_type}
newValue={
performerDetails.breast_type &&
BreastTypes[performerDetails.breast_type as keyof typeof BreastTypeEnum]
}
oldValue={
oldPerformerDetails?.breast_type &&
BreastTypes[
oldPerformerDetails.breast_type as keyof typeof BreastTypeEnum
]
}
showDiff={showDiff}
/>
<ChangeRow
Expand Down Expand Up @@ -238,8 +279,16 @@ export const renderPerformerDetails = (
/>
<ChangeRow
name="Ethnicity"
newValue={performerDetails.ethnicity}
oldValue={oldPerformerDetails?.ethnicity}
newValue={
performerDetails.ethnicity &&
EthnicityTypes[performerDetails.ethnicity as keyof typeof EthnicityEnum]
}
oldValue={
oldPerformerDetails?.ethnicity &&
EthnicityTypes[
oldPerformerDetails.ethnicity as keyof typeof EthnicityEnum
]
}
showDiff={showDiff}
/>
<ChangeRow
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/constants/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ export const HairColorTypes: EnumDictionary<HairColorEnum, string> = {
[HairColorEnum.AUBURN]: "Auburn",
[HairColorEnum.BALD]: "Bald",
[HairColorEnum.BLACK]: "Black",
[HairColorEnum.BLONDE]: "Blonde",
[HairColorEnum.BRUNETTE]: "Brunette",
[HairColorEnum.BLONDE]: "Blond",
[HairColorEnum.BRUNETTE]: "Brown",
[HairColorEnum.GREY]: "Grey",
[HairColorEnum.OTHER]: "Other",
[HairColorEnum.RED]: "Red",
[HairColorEnum.VARIOUS]: "Various",
[HairColorEnum.WHITE]: "White",
};

export const GenderTypes: EnumDictionary<GenderEnum, string> = {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ export enum HairColorEnum {
OTHER = "OTHER",
RED = "RED",
VARIOUS = "VARIOUS",
WHITE = "WHITE",
}

export type IdCriterionInput = {
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/pages/performers/performerForm/PerformerForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ const GENDER: OptionEnum[] = [

const HAIR: OptionEnum[] = [
{ value: "null", label: "Unknown" },
{ value: "BLONDE", label: "Blonde" },
{ value: "BRUNETTE", label: "Brunette" },
{ value: "BLONDE", label: "Blond" },
{ value: "BRUNETTE", label: "Brown" },
{ value: "BLACK", label: "Black" },
{ value: "RED", label: "Red" },
{ value: "AUBURN", label: "Auburn" },
{ value: "GREY", label: "Grey" },
{ value: "WHITE", label: "White" },
{ value: "BALD", label: "Bald" },
{ value: "VARIOUS", label: "Various" },
{ value: "OTHER", label: "Other" },
Expand Down
1 change: 1 addition & 0 deletions graphql/schema/types/performer.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ enum HairColorEnum {
GREY
BALD
VARIOUS
WHITE
OTHER
}

Expand Down
1 change: 1 addition & 0 deletions pkg/models/generated_exec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/models/generated_models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a000fa4

Please sign in to comment.