Skip to content

Commit 8017b27

Browse files
fix: only smart and with credits filters toggle in mobile (#2608)
* fix: only smart and with credits filters toggle in mobile * fix: test * feat: add fail-on-error: false to coveralls ci action
1 parent 7f3ed9c commit 8017b27

8 files changed

Lines changed: 22 additions & 7 deletions

File tree

‎.github/workflows/test.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ jobs:
2121
- name: Test
2222
run: npm run test:coverage
2323
- name: report coverage
24-
uses: coverallsapp/github-action@master
24+
uses: coverallsapp/github-action@main
2525
with:
2626
github-token: ${{ secrets.GITHUB_TOKEN }}
2727
base-path: ./webapp
2828
path-to-lcov: ./webapp/coverage/lcov.info
29+
fail-on-error: false

‎webapp/src/components/AssetFilters/AssetFilters.container.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const AssetFiltersContainer: React.FC<ContainerProps> = ({ values = {}, onFilter
2424
creators: 'creators' in values ? values.creators || [] : browseOptions.creators,
2525
onlyOnSale: 'onlyOnSale' in values ? values.onlyOnSale : browseOptions.onlyOnSale,
2626
onlyOnRent: 'onlyOnRent' in values ? values.onlyOnRent : browseOptions.onlyOnRent,
27+
onlySmart: 'onlySmart' in values ? values.onlySmart : browseOptions.onlySmart,
2728
rarities: 'rarities' in values ? values.rarities || [] : browseOptions.rarities,
2829
status: 'status' in values ? values.status : (browseOptions.status as AssetStatusFilter),
2930
network: 'network' in values ? values.network : browseOptions.network,
@@ -39,11 +40,11 @@ const AssetFiltersContainer: React.FC<ContainerProps> = ({ values = {}, onFilter
3940
minPrice: 'minPrice' in values ? values.minPrice || '' : browseOptions.minPrice,
4041
maxPrice: 'maxPrice' in values ? values.maxPrice || '' : browseOptions.maxPrice,
4142
minEstateSize: 'minEstateSize' in values ? values.minEstateSize || '' : browseOptions.minEstateSize,
42-
maxEstateSize: 'maxEstateSize' in values ? values.maxEstateSize || '' : browseOptions.maxEstateSize
43+
maxEstateSize: 'maxEstateSize' in values ? values.maxEstateSize || '' : browseOptions.maxEstateSize,
44+
withCredits: 'withCredits' in values ? values.withCredits : browseOptions.withCredits
4345
}),
4446
[values, browseOptions]
4547
)
46-
4748
const landStatus = useMemo(() => {
4849
if (parameters.onlyOnRent && !parameters.onlyOnSale) {
4950
return LANDFilters.ONLY_FOR_RENT

‎webapp/src/components/AssetFilters/AssetFilters.spec.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function renderAssetFilters(props: Partial<Props> = {}) {
3131
collection=""
3232
creators={[]}
3333
rarities={[]}
34-
isOnlySmart={false}
34+
onlySmart={false}
3535
landStatus={LANDFilters.ALL_LAND}
3636
onBrowse={jest.fn()}
3737
values={{ section: Section.LAND }}

‎webapp/src/components/AssetFilters/AssetFilters.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export const AssetFilters = ({
4040
bodyShapes,
4141
onlyOnSale,
4242
emotePlayMode,
43+
onlySmart,
44+
withCredits,
4345
section,
4446
landStatus,
4547
defaultCollapsed,
@@ -234,6 +236,8 @@ export const AssetFilters = ({
234236
return (
235237
<Menu className="filters-sidebar">
236238
<SpecialFilter
239+
isOnlySmart={onlySmart}
240+
withCredits={withCredits}
237241
onSmartChange={shouldRenderFilter(AssetFilter.OnlySmart) ? handleOnlySmartChange : undefined}
238242
onWithCreditsChange={handleWithCreditsToggleChange}
239243
defaultCollapsed={!!defaultCollapsed?.[AssetFilter.Special]}

‎webapp/src/components/AssetFilters/AssetFilters.types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type Props = {
1919
network?: Network
2020
category?: NFTCategory
2121
bodyShapes?: (GenderFilterOption | WearableGender)[]
22-
isOnlySmart?: boolean
22+
onlySmart?: boolean
2323
onlyOnSale?: boolean
2424
emotePlayMode?: EmotePlayMode[]
2525
assetType?: AssetType

‎webapp/src/components/AssetFilters/SpecialFilter/SpecialFilter.container.tsx‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ import { ContainerProps } from './SpecialFilter.types'
77

88
export const SpecialFilterContainer: React.FC<ContainerProps> = props => {
99
const { onlySmart, withCredits } = useGetBrowseOptions()
10+
1011
const isCreditsEnabled = useSelector(getIsCreditsEnabled)
1112

12-
return <SpecialFilter {...props} isOnlySmart={onlySmart} withCredits={withCredits} isCreditsEnabled={isCreditsEnabled} />
13+
return (
14+
<SpecialFilter
15+
{...props}
16+
isOnlySmart={props.isOnlySmart !== undefined ? props.isOnlySmart : onlySmart} // if the isOnlySmart is undefined, use the value from the browse options
17+
withCredits={props.withCredits !== undefined ? props.withCredits : withCredits} // if the withCredits is undefined, use the value from the browse options
18+
isCreditsEnabled={isCreditsEnabled}
19+
/>
20+
)
1321
}
1422

1523
export default SpecialFilterContainer

‎webapp/src/components/AssetFilters/SpecialFilter/SpecialFilter.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const SpecialFilter = (props: SpecialFilterProps) => {
4242
{isMobileOrTablet ? (
4343
<>
4444
<span className="box-filter-name">{t('filters.special_filters')}</span>
45+
{isOnlySmart || withCredits ? ': ' : ''}
4546
<span className="box-filter-value">
4647
{isOnlySmart ? t('filters.only_smart') : ''}
4748
{isOnlySmart && withCredits ? ', ' : ''}

‎webapp/src/components/AssetFilters/SpecialFilter/SpecialFilter.types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ export type Props = {
99
defaultCollapsed?: boolean
1010
}
1111

12-
export type ContainerProps = Omit<Props, 'isOnlySmart' | 'withCredits' | 'isCreditsEnabled'>
12+
export type ContainerProps = Omit<Props, 'isCreditsEnabled'>

0 commit comments

Comments
 (0)