mirror of
https://github.com/modrinth/code.git
synced 2026-08-27 18:14:49 +00:00
fix: make search use v3 everywhere (#6840)
This commit is contained in:
@@ -670,7 +670,7 @@ async function getInstallProjectVersions(projectId: string) {
|
||||
}
|
||||
|
||||
async function chooseInstanceInstallVersion(
|
||||
project: Labrinth.Search.v2.ResultSearchProject & Labrinth.Search.v3.ResultSearchProject,
|
||||
project: Labrinth.Search.v3.ResultSearchProject,
|
||||
projectTypeValue: string,
|
||||
) {
|
||||
const targetInstance = instance.value
|
||||
@@ -697,16 +697,14 @@ async function chooseInstanceInstallVersion(
|
||||
}
|
||||
|
||||
function getCardActions(
|
||||
result: Labrinth.Search.v2.ResultSearchProject | Labrinth.Search.v3.ResultSearchProject,
|
||||
result: Labrinth.Search.v3.ResultSearchProject,
|
||||
currentProjectType: string,
|
||||
): CardAction[] {
|
||||
if (currentProjectType === 'server') {
|
||||
return getServerCardActions(result as Labrinth.Search.v3.ResultSearchProject)
|
||||
return getServerCardActions(result)
|
||||
}
|
||||
|
||||
// Non-server project actions
|
||||
const projectResult = result as (Labrinth.Search.v2.ResultSearchProject &
|
||||
Labrinth.Search.v3.ResultSearchProject) & {
|
||||
const projectResult = result as Labrinth.Search.v3.ResultSearchProject & {
|
||||
installed?: boolean
|
||||
installing?: boolean
|
||||
}
|
||||
@@ -917,11 +915,9 @@ async function search(requestParams: string) {
|
||||
}
|
||||
|
||||
const hits = rawResults.result.hits.map((hit) => {
|
||||
const mapped = {
|
||||
const mapped: Labrinth.Search.v3.ResultSearchProject & { installed?: boolean } = {
|
||||
...hit,
|
||||
title: hit.name,
|
||||
description: hit.summary,
|
||||
} as unknown as Labrinth.Search.v2.ResultSearchProject & { installed?: boolean }
|
||||
}
|
||||
|
||||
if (instance.value || isServerContext.value) {
|
||||
const installedIds = instance.value
|
||||
@@ -1068,7 +1064,7 @@ provideBrowseManager({
|
||||
projectType,
|
||||
...searchState,
|
||||
advancedFiltersCollapsed,
|
||||
getProjectLink: (result: Labrinth.Search.v2.ResultSearchProject) => ({
|
||||
getProjectLink: (result: Labrinth.Search.v3.ResultSearchProject) => ({
|
||||
path: `/project/${result.project_id ?? result.slug}`,
|
||||
query: getProjectBrowseQuery(),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user