Skip to content

Commit

Permalink
fix: add correct parameters to homepage newest items view all (#2120)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo authored Jan 31, 2024
1 parent 623b102 commit 84b33a4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion webapp/src/components/HomePage/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { View } from '../../modules/ui/types'
import { AssetType } from '../../modules/asset/types'
import { HomepageView } from '../../modules/ui/asset/homepage/types'
import { Section } from '../../modules/vendor/decentraland/routing/types'
import { AssetStatusFilter } from '../../utils/filters'
import { Navigation } from '../Navigation'
import { NavigationTab } from '../Navigation/Navigation.types'
import { Navbar } from '../Navbar'
Expand Down Expand Up @@ -76,7 +77,7 @@ const HomePage = (props: Props) => {

const sort: Partial<Record<View, SortBy>> = useMemo(
() => ({
[View.HOME_NEW_ITEMS]: SortBy.RECENTLY_LISTED,
[View.HOME_NEW_ITEMS]: SortBy.NEWEST,
[View.HOME_SOLD_ITEMS]: SortBy.RECENTLY_SOLD,
[View.HOME_WEARABLES]: SortBy.RECENTLY_LISTED,
[View.HOME_LAND]: SortBy.RECENTLY_LISTED,
Expand All @@ -85,6 +86,13 @@ const HomePage = (props: Props) => {
[]
)

const status: Partial<Record<View, AssetStatusFilter>> = useMemo(
() => ({
[View.HOME_NEW_ITEMS]: AssetStatusFilter.ON_SALE
}),
[]
)

const handleViewAll = useCallback(
(view: View, fromEmptyState: boolean = false) => {
const section = sections[view]
Expand All @@ -107,6 +115,10 @@ const HomePage = (props: Props) => {
browseOptions = { section, assetType, sortBy }
}

if (status[view]) {
browseOptions.status = status[view]
}

if (trackMessage && browseOptions) {
getAnalytics().track(
fromEmptyState ? `${trackMessage} '(from empty state)'` : trackMessage
Expand Down

0 comments on commit 84b33a4

Please sign in to comment.