Skip to content

Commit

Permalink
feat: turn shipping options constants for camel case
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurFerrao committed Nov 6, 2024
1 parent d33ddb9 commit 4dcc80f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions react/FilterNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
import useFacetNavigation from './hooks/useFacetNavigation'
import FilterNavigatorTitleTag from './components/FilterNavigatorTitleTag'
import styles from './searchResult.css'
import { CATEGORIES_TITLE, SHIPPING_OPTIONS } from './utils/getFilters'
import { CATEGORIES_TITLE, shippingOptions } from './utils/getFilters'
import { newFacetPathName } from './utils/slug'
import { FACETS_RENDER_THRESHOLD } from './constants/filterConstants'

Expand Down Expand Up @@ -160,12 +160,12 @@ const FilterNavigator = ({
}
}, [filters, filtersFetchMore, truncatedFacetsFetched, loading])

const shipping = deliveries.map((delivery) => ({
const shipping = deliveries.map(delivery => ({
...delivery,
facets: delivery.facets.map((facet) => ({
facets: delivery.facets.map(facet => ({
...facet,
name: intl.formatMessage({ id: SHIPPING_OPTIONS[facet.name] }) ,
}))
name: intl.formatMessage({ id: shippingOptions[facet.name] }),
})),
}))

const selectedFilters = useMemo(() => {
Expand Down
4 changes: 2 additions & 2 deletions react/utils/compatibilityLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import { groupBy, pathOr, zipObj } from 'ramda'

import { PATH_SEPARATOR, MAP_VALUES_SEP } from '../constants'
import { SHIPPING_OPTIONS, SHIPPING_KEY } from './getFilters'
import { shippingOptions, SHIPPING_KEY } from './getFilters'

const shippingFacetDefault = {
name: SHIPPING_KEY,
type: 'DELIVERY',
hidden: false,
quantity: 0,
facets: Object.keys(SHIPPING_OPTIONS).map(option => ({
facets: Object.keys(shippingOptions).map(option => ({
id: null,
quantity: 0,
name: option,
Expand Down
4 changes: 2 additions & 2 deletions react/utils/getFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const CATEGORIES_TITLE = 'store/search.filter.title.categories'
export const BRANDS_TITLE = 'store/search.filter.title.brands'
export const PRICE_RANGES_TITLE = 'store/search.filter.title.price-ranges'

export const SHIPPING_OPTIONS = {
export const shippingOptions = {
delivery: 'store/search.filter.shipping.name.delivery',
'pickup-in-point': 'store/search.filter.shipping.name.pickup-in-point',
'pickup-nearby': 'store/search.filter.shipping.name.pickup-nearby',
Expand Down Expand Up @@ -40,7 +40,7 @@ const getFilters = ({
title: SHIPPING_TITLE,
facets: shipping.facets.map(facet => ({
...facet,
name: intl.formatMessage({ id: SHIPPING_OPTIONS[facet.name] }),
name: intl.formatMessage({ id: shippingOptions[facet.name] }),
})),
}

Expand Down

0 comments on commit 4dcc80f

Please sign in to comment.