From 82201e23e023d0ac5816cca58c59d2f3f1e6660e Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Thu, 2 Apr 2020 08:25:39 +1100 Subject: [PATCH] Make ethnicity freetext and fix freeones ethnicity panic (#431) * Make ethnicity free text * Fix panic in freeones scraper for other ethnicity --- pkg/scraper/freeones.go | 4 +++- .../Performers/PerformerDetails/PerformerDetailsPanel.tsx | 6 +++--- .../performers/PerformerDetails/PerformerDetailsPanel.tsx | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/scraper/freeones.go b/pkg/scraper/freeones.go index 94bde0e19..db797b496 100644 --- a/pkg/scraper/freeones.go +++ b/pkg/scraper/freeones.go @@ -278,7 +278,9 @@ func getEthnicity(ethnicity string) string { case "Asian": return "asian" default: - panic("unknown ethnicity") + // #367 - unknown ethnicity shouldn't cause the entire operation to + // fail. Just return the original string instead + return ethnicity } } diff --git a/ui/v2.5/src/components/Performers/PerformerDetails/PerformerDetailsPanel.tsx b/ui/v2.5/src/components/Performers/PerformerDetails/PerformerDetailsPanel.tsx index a031860e2..753128324 100644 --- a/ui/v2.5/src/components/Performers/PerformerDetails/PerformerDetailsPanel.tsx +++ b/ui/v2.5/src/components/Performers/PerformerDetails/PerformerDetailsPanel.tsx @@ -221,12 +221,12 @@ export const PerformerDetailsPanel: React.FC = ({ } function renderEthnicity() { - return TableUtils.renderHtmlSelect({ + return TableUtils.renderInputGroup({ title: "Ethnicity", value: ethnicity, isEditing: !!isEditing, - onChange: (value: string) => setEthnicity(value), - selectOptions: ["white", "black", "asian", "hispanic"] + placeholder: "Ethnicity", + onChange: setEthnicity }); } diff --git a/ui/v2/src/components/performers/PerformerDetails/PerformerDetailsPanel.tsx b/ui/v2/src/components/performers/PerformerDetails/PerformerDetailsPanel.tsx index 261256995..c8d6438d4 100644 --- a/ui/v2/src/components/performers/PerformerDetails/PerformerDetailsPanel.tsx +++ b/ui/v2/src/components/performers/PerformerDetails/PerformerDetailsPanel.tsx @@ -228,12 +228,12 @@ export const PerformerDetailsPanel: FunctionComponent = } function renderEthnicity() { - return TableUtils.renderHtmlSelect({ + return TableUtils.renderInputGroup({ title: "Ethnicity", value: ethnicity, isEditing: !!props.isEditing, - onChange: (value: string) => setEthnicity(value), - selectOptions: ["white", "black", "asian", "hispanic"], + placeholder: "Ethnicity", + onChange: setEthnicity }); }