diff --git a/packages/ui/src/components/project/ProjectCombobox.vue b/packages/ui/src/components/project/ProjectCombobox.vue index 15cc1a9b73..fca01c813f 100644 --- a/packages/ui/src/components/project/ProjectCombobox.vue +++ b/packages/ui/src/components/project/ProjectCombobox.vue @@ -84,6 +84,10 @@ const searchResultsCache = ref>(new Map()) const { labrinth } = injectModrinthClient() +function isAllowedProjectType(projectType: string): boolean { + return !props.projectTypes || props.projectTypes.includes(projectType as ProjectType) +} + const userProjectHits = ref([]) const userProjectsFuse = ref | null>(null) @@ -164,7 +168,7 @@ watch( } else { try { const project = await labrinth.projects_v2.get(newId) - if (project) { + if (project && isAllowedProjectType(project.project_type)) { hit = { project_id: project.id, title: project.title, @@ -179,6 +183,9 @@ watch( return } } + if (hit && !isAllowedProjectType(hit.project_type)) { + hit = null + } selectedProject.value = hit if (hit && !options.value.some((o) => o.value === hit!.project_id)) { @@ -221,7 +228,11 @@ const search = async (query: string) => { const uniqueHits: SearchHit[] = [] for (const hit of allHits) { - if (!seenIds.has(hit.project_id) && !excludeSet.has(hit.project_id)) { + if ( + isAllowedProjectType(hit.project_type) && + !seenIds.has(hit.project_id) && + !excludeSet.has(hit.project_id) + ) { seenIds.add(hit.project_id) uniqueHits.push(hit) searchResultsCache.value.set(hit.project_id, hit) diff --git a/packages/ui/src/components/search/SearchDependsOnFilter.vue b/packages/ui/src/components/search/SearchDependsOnFilter.vue new file mode 100644 index 0000000000..e0db00726a --- /dev/null +++ b/packages/ui/src/components/search/SearchDependsOnFilter.vue @@ -0,0 +1,310 @@ + + + diff --git a/packages/ui/src/components/search/SearchSidebarFilter.vue b/packages/ui/src/components/search/SearchSidebarFilter.vue index 1e1b3b1863..4b027d9535 100644 --- a/packages/ui/src/components/search/SearchSidebarFilter.vue +++ b/packages/ui/src/components/search/SearchSidebarFilter.vue @@ -71,48 +71,14 @@