Skip to content
Open
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
1 change: 0 additions & 1 deletion apps/app-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"vite-svg-loader": "^5.1.0",
"vue": "^3.5.13",
"vue-i18n": "^10.0.0",
"vue-multiselect": "3.0.0",
"vue-router": "^4.6.0",
"vue-virtual-scroller": "v2.0.0-beta.8"
},
Expand Down
1 change: 0 additions & 1 deletion apps/app-frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1597,4 +1597,3 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
}
}
</style>
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,17 @@
<tr class="content">
<td class="data">{{ instance?.loader }} {{ instance?.game_version }}</td>
<td>
<multiselect
<Combobox
v-if="versions?.length > 1"
v-model="selectedVersion"
:options="versions"
v-model="selectedVersionId"
:options="versionOptions"
:searchable="true"
placeholder="Select version"
open-direction="top"
:show-labels="false"
:custom-label="
(version) =>
`${version?.name} (${version?.loaders
.map((name) => formatLoader(formatMessage, name))
.join(', ')} - ${version?.game_versions.join(', ')})`
"
force-direction="up"
:max-height="150"
/>
<span v-else>
<span>
{{ selectedVersion?.name }} ({{
selectedVersion?.loaders
.map((name) => formatLoader(formatMessage, name))
.join(', ')
}}
- {{ selectedVersion?.game_versions.join(', ') }})
</span>
<span>{{ selectedVersionLabel }}</span>
</span>
</td>
</tr>
Expand All @@ -59,9 +45,8 @@

<script setup>
import { DownloadIcon, XIcon } from '@modrinth/assets'
import { Button, formatLoader, injectNotificationManager, useVIntl } from '@modrinth/ui'
import { ref } from 'vue'
import Multiselect from 'vue-multiselect'
import { Button, Combobox, formatLoader, injectNotificationManager, useVIntl } from '@modrinth/ui'
import { computed, ref } from 'vue'

import ModalWrapper from '@/components/ui/modal/ModalWrapper.vue'
import { trackEvent } from '@/helpers/analytics'
Expand All @@ -79,11 +64,35 @@ const installing = ref(false)

const onInstall = ref(() => {})

const selectedVersionLabel = computed(() => {
if (!selectedVersion.value) return ''
return `${selectedVersion.value.name} (${selectedVersion.value.loaders
.map((name) => formatLoader(formatMessage, name))
.join(', ')} - ${selectedVersion.value.game_versions.join(', ')})`
})

const versionOptions = computed(() =>
(versions.value ?? []).map((version) => ({
value: version.id,
label: `${version.name} (${version.loaders
.map((name) => formatLoader(formatMessage, name))
.join(', ')} - ${version.game_versions.join(', ')})`,
})),
)

const selectedVersionId = computed({
get: () => selectedVersion.value?.id ?? null,
set: (value) => {
if (!value) return
selectedVersion.value = (versions.value ?? []).find((version) => version.id === value) ?? null
},
})

defineExpose({
show: (instanceVal, projectVal, projectVersions, selected, callback) => {
instance.value = instanceVal
versions.value = projectVersions
selectedVersion.value = selected ?? projectVersions[0]
versions.value = projectVersions ?? []
selectedVersion.value = selected ?? projectVersions?.[0] ?? null

project.value = projectVal

Expand Down Expand Up @@ -162,9 +171,5 @@ td:first-child {
display: flex;
flex-direction: column;
gap: 1rem;

:deep(.animated-dropdown .options) {
max-height: 13.375rem;
}
}
</style>
1 change: 0 additions & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"semver": "^7.5.4",
"three": "^0.172.0",
"vue-confetti-explosion": "^1.0.2",
"vue-multiselect": "3.0.0-alpha.2",
"vue-typed-virtual-list": "^1.0.10",
"vue3-ace-editor": "^2.2.4",
"vue3-apexcharts": "^1.5.2",
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/src/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1593,4 +1593,3 @@ const { cycle: changeTheme } = useTheme()
}
}
</style>
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
33 changes: 18 additions & 15 deletions apps/frontend/src/pages/[type]/[id]/settings/members.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,20 +285,16 @@
you can transfer management to one of them.
</p>
<div v-if="!organization" class="input-group">
<Multiselect
<Combobox
id="organization-picker"
v-model="selectedOrganization"
v-model="selectedOrganizationId"
class="large-multiselect"
track-by="id"
label="name"
open-direction="top"
:close-on-select="true"
:show-labels="false"
:allow-empty="false"
:options="organizations || []"
:disabled="!currentMember?.is_owner || organizations?.length === 0"
:options="organizationOptions"
:searchable="true"
force-direction="up"
:disabled="!currentMember?.is_owner || organizationOptions.length === 0"
/>
<button class="btn btn-primary" :disabled="!selectedOrganization" @click="onAddToOrg">
<button class="btn btn-primary" :disabled="!selectedOrganizationId" @click="onAddToOrg">
<CheckIcon />
Transfer management
</button>
Expand Down Expand Up @@ -545,13 +541,13 @@ import {
Badge,
Card,
Checkbox,
Combobox,
ConfirmModal,
injectNotificationManager,
injectProjectPageContext,
StyledInput,
Toggle,
} from '@modrinth/ui'
import { Multiselect } from 'vue-multiselect'

import { removeSelfFromTeam } from '~/helpers/teams.js'

Expand Down Expand Up @@ -603,14 +599,21 @@ initMembers()

const currentUsername = ref('')
const openTeamMembers = ref([])
const selectedOrganization = ref(null)
const selectedOrganizationId = ref('')

const { data: organizations } = useAsyncData('organizations', () => {
return useBaseFetch('user/' + auth.value?.user.id + '/organizations', {
apiVersion: 3,
})
})

const organizationOptions = computed(() =>
(organizations.value ?? []).map((organization) => ({
value: organization.id,
label: organization.name,
})),
)

const UPLOAD_VERSION = 1 << 0
const DELETE_VERSION = 1 << 1
const EDIT_DETAILS = 1 << 2
Expand All @@ -623,9 +626,9 @@ const VIEW_ANALYTICS = 1 << 8
const VIEW_PAYOUTS = 1 << 9

const onAddToOrg = useClientTry(async () => {
if (!selectedOrganization.value) return
if (!selectedOrganizationId.value) return

await useBaseFetch(`organization/${selectedOrganization.value.id}/projects`, {
await useBaseFetch(`organization/${selectedOrganizationId.value}/projects`, {
method: 'POST',
body: JSON.stringify({
project_id: project.value.id,
Expand Down
14 changes: 6 additions & 8 deletions apps/frontend/src/pages/[type]/[id]/settings/server.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@
>Languages <span class="font-normal text-secondary">(optional)</span></span
>
</label>
<Multiselect
<MultiSelect
id="server-language"
v-model="languages"
:options="languageOptions.map((l) => l.value)"
:custom-label="(code) => languageOptions.find((l) => l.value === code)?.label ?? code"
:multiple="true"
:searchable="true"
:show-labels="false"
:close-on-select="false"
:options="languageOptions"
searchable
include-select-all-option
:max-tag-rows="2"
placeholder="Select languages"
:disabled="!hasPermission"
/>
Expand Down Expand Up @@ -166,12 +164,12 @@ import {
injectModrinthClient,
injectNotificationManager,
injectProjectPageContext,
MultiSelect,
SERVER_LANGUAGES,
SERVER_REGIONS,
StyledInput,
UnsavedChangesPopup,
} from '@modrinth/ui'
import { Multiselect } from 'vue-multiselect'

import CompatibilityCard from '~/components/ui/project-settings/CompatibilityCard.vue'

Expand Down
41 changes: 12 additions & 29 deletions apps/frontend/src/pages/[type]/[id]/version/[version].vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,14 @@
The mod loaders you would like to package your data pack for.
</span>
</label>
<multiselect
<MultiSelect
id="package-mod-loaders"
v-model="packageLoaders"
:options="['fabric', 'forge', 'quilt', 'neoforge']"
:custom-label="(value: string) => value.charAt(0).toUpperCase() + value.slice(1)"
:multiple="true"
class="package-loader-select"
:options="packageLoaderOptions"
:searchable="false"
:show-no-results="false"
:show-labels="false"
placeholder="Choose loaders..."
open-direction="top"
force-direction="up"
/>
<div class="button-group">
<ButtonStyled>
Expand Down Expand Up @@ -436,11 +433,11 @@ import {
ENVIRONMENTS_COPY,
injectNotificationManager,
injectProjectPageContext,
MultiSelect,
StyledInput,
useFormatDateTime,
} from '@modrinth/ui'
import { formatBytes, renderHighlightedString } from '@modrinth/utils'
import { Multiselect } from 'vue-multiselect'

import Breadcrumbs from '~/components/ui/Breadcrumbs.vue'
import CreateProjectVersionModal from '~/components/ui/create-project-version/CreateProjectVersionModal.vue'
Expand Down Expand Up @@ -504,6 +501,12 @@ const newFiles = ref<File[]>([])
const deleteFiles = ref<string[]>([])
const newFileTypes = ref<Array<{ display: string; value: string } | null>>([])
const packageLoaders = ref(['forge', 'fabric', 'quilt', 'neoforge'])
const packageLoaderOptions = [
{ value: 'fabric', label: 'Fabric' },
{ value: 'forge', label: 'Forge' },
{ value: 'quilt', label: 'Quilt' },
{ value: 'neoforge', label: 'Neoforge' },
]
const showKnownErrors = ref(false)
const shouldPreventActions = ref(false)
const uploadedImageIds = ref<string[]>([])
Expand Down Expand Up @@ -1215,11 +1218,6 @@ async function resetProjectVersions() {
margin-bottom: var(--spacing-card-sm);
}

.multiselect {
width: 8rem;
flex-grow: 1;
}

input {
flex-grow: 2;
}
Expand Down Expand Up @@ -1270,14 +1268,6 @@ async function resetProjectVersions() {
font-weight: 300;
}

.raised-multiselect {
display: none;
margin: 0 0.5rem;
height: 40px;
max-height: 40px;
min-width: 235px;
}

.raised-button {
margin-left: auto;
background-color: var(--color-raised-bg);
Expand All @@ -1286,13 +1276,6 @@ async function resetProjectVersions() {
&:not(:nth-child(2)) {
margin-top: 0.5rem;
}

// TODO: Make file type editing work on mobile
@media (min-width: 600px) {
.raised-multiselect {
display: block;
}
}
}

.additional-files {
Expand Down Expand Up @@ -1357,7 +1340,7 @@ async function resetProjectVersions() {
margin-bottom: 1rem;
}

.multiselect {
.package-loader-select {
max-width: 20rem;
}
}
Expand Down
14 changes: 8 additions & 6 deletions apps/frontend/src/pages/dashboard/projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,11 @@
<div class="push-right">
<div class="labeled-control-row">
Sort by
<Multiselect
<Combobox
v-model="sortBy"
:searchable="false"
class="small-select"
:options="['Name', 'Status', 'Type']"
:close-on-select="true"
:show-labels="false"
:allow-empty="false"
:options="sortOptions"
@update:model-value="projects = updateSort(projects, sortBy, descending)"
/>
<button
Expand Down Expand Up @@ -323,6 +320,7 @@ import {
Avatar,
ButtonStyled,
Checkbox,
Combobox,
commonMessages,
CopyCode,
injectNotificationManager,
Expand All @@ -332,7 +330,6 @@ import {
useVIntl,
} from '@modrinth/ui'
import { formatProjectType } from '@modrinth/utils'
import { Multiselect } from 'vue-multiselect'

import ModalCreation from '~/components/ui/create/ProjectCreateModal.vue'
import { getProjectTypeForUrl } from '~/helpers/projects.js'
Expand All @@ -356,6 +353,11 @@ const projects = ref([])
const projectsWithMigrationWarning = ref([])
const selectedProjects = ref([])
const sortBy = ref('Name')
const sortOptions = [
{ value: 'Name', label: 'Name' },
{ value: 'Status', label: 'Status' },
{ value: 'Type', label: 'Type' },
]
const descending = ref(false)
const editLinks = reactive({
showAffected: false,
Expand Down
Loading
Loading