Skip to content

Commit

Permalink
Sort homepage and categories by trending
Browse files Browse the repository at this point in the history
  • Loading branch information
razzeee committed Feb 7, 2025
1 parent 6efd9a1 commit 41425e1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions frontend/pages/apps/category/[category]/[page].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
} from "src/meilisearch"
import Link from "next/link"
import Tile from "src/components/Tile"
import { SortBy } from "src/codegen"

const ApplicationCategory = ({
applications,
Expand Down Expand Up @@ -114,6 +115,8 @@ export const getStaticProps: GetStaticProps = async ({ locale, params }) => {
locale,
params.page as unknown as number,
30,
[],
SortBy.trending,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
MeilisearchResponse,
mapAppsIndexToAppstreamListItem,
} from "src/meilisearch"
import { MainCategory } from "src/codegen"
import { MainCategory, SortBy } from "src/codegen"

const ApplicationCategory = ({
applications,
Expand Down Expand Up @@ -114,6 +114,7 @@ export const getStaticProps: GetStaticProps = async ({ locale, params }) => {
params.page as unknown as number,
30,
mainCategory === "game" ? gameCategoryFilter : [],
SortBy.trending,
)
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { useRouter } from "next/router"
import { Button } from "@/components/ui/button"
import Link from "next/link"
import { MobileDevicesLogo } from "src/components/MobileDevicesLogo"
import { MainCategory } from "src/codegen"
import { MainCategory, SortBy } from "src/codegen"
import { ApplicationSectionGradient } from "src/components/application/ApplicationSectionGradient"
import { GameControllersLogo } from "src/components/GameControllersLogo"
import { ApplicationSectionGradientMultiToggle } from "src/components/application/ApplicationSectionGradientMultiToggle"
Expand Down Expand Up @@ -432,7 +432,7 @@ export const getStaticProps: GetStaticProps = async ({
.map(async (category: MainCategory) => {
return {
category,
apps: await fetchCategory(category, locale, 1, 6),
apps: await fetchCategory(category, locale, 1, 6, [], SortBy.trending),
}
})

Expand Down
4 changes: 4 additions & 0 deletions frontend/src/fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export async function fetchGameCategory(
page,
per_page,
gameCategoryFilter,
SortBy.trending,
)
}

Expand All @@ -217,6 +218,7 @@ export async function fetchGameEmulatorCategory(
page,
per_page,
[],
SortBy.trending,
)
}

Expand All @@ -232,6 +234,7 @@ export async function fetchGamePackageManagerCategory(
page,
per_page,
[],
SortBy.trending,
)
}

Expand All @@ -247,6 +250,7 @@ export async function fetchGameUtilityCategory(
page,
per_page,
[],
SortBy.trending,
)
}

Expand Down

0 comments on commit 41425e1

Please sign in to comment.