Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
placeholder="Select project"
:options="options"
:searchable="true"
search-placeholder="Search by name, slug, or paste ID..."
search-placeholder="Search by name or paste ID..."
:no-options-message="searchLoading ? 'Loading...' : 'No results found'"
@search-input="(query) => handleSearch(query)"
:disableSearchFilter="true"
/>
</template>

Expand Down Expand Up @@ -34,10 +35,24 @@ const search = async (query: string) => {
const results = await labrinth.projects_v2.search({
query: query,
limit: 20,
facets: [['project_type:mod']],
facets: [
[
'project_type:mod',
'project_type:plugin',
'project_type:shader ',
'project_type:resourcepack',
'project_type:datapack',
],
],
})

options.value = results.hits.map((hit) => ({
const resultsByProjectId = await labrinth.projects_v2.search({
query: '',
limit: 20,
facets: [[`project_id:${query}`]],
})

options.value = [...resultsByProjectId.hits, ...results.hits].map((hit) => ({
label: hit.title,
value: hit.project_id,
icon: defineAsyncComponent(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ import {
} from '@modrinth/ui'
import type { DropdownOption } from '@modrinth/ui/src/components/base/Combobox.vue'

import ModSelect from '~/components/ui/create-project-version/components/ModSelect.vue'
import ModSelect from '~/components/ui/create-project-version/components/DependencySelect.vue'
import { injectManageVersionContext } from '~/providers/version/manage-version-modal'

import AddedDependencyRow from '../components/AddedDependencyRow.vue'
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/base/Combobox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ const props = withDefaults(
triggerClass?: string
forceDirection?: 'up' | 'down'
noOptionsMessage?: string
disableSearchFilter?: boolean
}>(),
{
placeholder: 'Select an option',
Expand Down Expand Up @@ -244,7 +245,7 @@ const optionsWithKeys = computed(() => {
})

const filteredOptions = computed(() => {
if (!searchQuery.value || !props.searchable) {
if (!searchQuery.value || !props.searchable || props.disableSearchFilter) {
return optionsWithKeys.value
}

Expand Down