Skip to content

Commit

Permalink
chore(ONYX-458): remove uknown edition as a rarity option (#9439)
Browse files Browse the repository at this point in the history
* chore: remove uknown edition as a rarity option

* refactor: rename var
  • Loading branch information
MounirDhahri authored Oct 17, 2023
1 parent 8c3a091 commit adfa7c3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type AttributionClassOptionsScreenProps = StackScreenProps<
"AttributionClassOptionsScreen"
>

export const ATTRIBUTION_CLASS_OPTIONS: FilterData[] = [
export const KNOWN_ATTRIBUTION_CLASS_OPTIONS: FilterData[] = [
{ displayText: "Unique", paramValue: "unique", paramName: FilterParamName.attributionClass },
{
displayText: "Limited Edition",
Expand All @@ -25,6 +25,10 @@ export const ATTRIBUTION_CLASS_OPTIONS: FilterData[] = [
paramValue: "open edition",
paramName: FilterParamName.attributionClass,
},
]

export const ATTRIBUTION_CLASS_OPTIONS: FilterData[] = [
...KNOWN_ATTRIBUTION_CLASS_OPTIONS,
{
displayText: "Unknown Edition",
paramValue: "unknown edition",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { OwnerType } from "@artsy/cohesion"
import { fireEvent, waitFor } from "@testing-library/react-native"
import { ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions"
import { KNOWN_ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions"
import { SavedSearchFilterRarity } from "app/Scenes/SavedSearchAlert/Components/SavedSearchFilterRarity"
import {
SavedSearchModel,
Expand All @@ -19,7 +19,7 @@ describe("SavedSearchFilterRarity", () => {
</SavedSearchStoreProvider>
)

ATTRIBUTION_CLASS_OPTIONS.forEach((option) => {
KNOWN_ATTRIBUTION_CLASS_OPTIONS.forEach((option) => {
expect(getByText(option.displayText)).toBeDefined()
expect(getByText(option.displayText)).toHaveStyle({
color: black100Hex,
Expand All @@ -39,7 +39,6 @@ describe("SavedSearchFilterRarity", () => {
expect(getByText("Unique")).not.toHaveStyle({ color: black100Hex })
expect(getByText("Limited Edition")).toHaveStyle({ color: black100Hex })
expect(getByText("Open Edition")).toHaveStyle({ color: black100Hex })
expect(getByText("Unknown Edition")).toHaveStyle({ color: black100Hex })
})

it("Updates selected filters on press", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Flex, Spacer, Text } from "@artsy/palette-mobile"
import { ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions"
import { KNOWN_ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions"
import { SearchCriteria } from "app/Components/ArtworkFilter/SavedSearch/types"
import { SavedSearchFilterPill } from "app/Scenes/SavedSearchAlert/Components/SavedSearchFilterPill"
import { SavedSearchStore } from "app/Scenes/SavedSearchAlert/SavedSearchStore"
Expand Down Expand Up @@ -46,7 +46,7 @@ export const SavedSearchFilterRarity = () => {
<Spacer y={1} />

<Flex flexDirection="row" flexWrap="wrap">
{ATTRIBUTION_CLASS_OPTIONS.map((option) => {
{KNOWN_ATTRIBUTION_CLASS_OPTIONS.map((option) => {
return (
<SavedSearchFilterPill
key={option.paramValue as string}
Expand Down
7 changes: 1 addition & 6 deletions src/app/Scenes/SavedSearchAlert/pillExtractors.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ describe("extractPillsFromCriteria", () => {

it("should correctly extract attribution pills", () => {
const attributes: SearchCriteriaAttributes = {
attributionClass: ["unique", "unknown edition"],
attributionClass: ["unique"],
}
const result = extractPillsFromCriteria({ attributes, aggregations, unit: "in" })

Expand All @@ -249,11 +249,6 @@ describe("extractPillsFromCriteria", () => {
paramName: SearchCriteria.attributionClass,
value: "unique",
},
{
label: "Unknown Edition",
paramName: SearchCriteria.attributionClass,
value: "unknown edition",
},
])
})

Expand Down
6 changes: 4 additions & 2 deletions src/app/Scenes/SavedSearchAlert/pillExtractors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
FilterParamName,
getDisplayNameForTimePeriod,
} from "app/Components/ArtworkFilter/ArtworkFilterHelpers"
import { ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions"
import { KNOWN_ATTRIBUTION_CLASS_OPTIONS } from "app/Components/ArtworkFilter/Filters/AttributionClassOptions"
import { COLORS_INDEXED_BY_VALUE } from "app/Components/ArtworkFilter/Filters/ColorsOptions"
import { getSizeOptions } from "app/Components/ArtworkFilter/Filters/SizesOptionsScreen"
import {
Expand Down Expand Up @@ -124,7 +124,9 @@ export const extractColorPills = (values: string[]): SavedSearchPill[] => {

export const extractAttributionPills = (values: string[]): SavedSearchPill[] => {
return values.map((value) => {
const colorOption = ATTRIBUTION_CLASS_OPTIONS.find((option) => option.paramValue === value)
const colorOption = KNOWN_ATTRIBUTION_CLASS_OPTIONS.find(
(option) => option.paramValue === value
)

return {
label: colorOption?.displayText ?? "",
Expand Down

0 comments on commit adfa7c3

Please sign in to comment.