mirror of
https://github.com/modrinth/code.git
synced 2026-08-30 19:46:33 +00:00
* feat: base of instances v2 * feat: use old profiles with compat layer * prototype: instances v2 * fix: install_from using profile * fix: skins migration fix * fix: frontend still using profile path * fix: add update proj multiselect guard * fix: cargo fmt * fix: content missing fields * feat: break up app-lib/api/instance.rs * fix: check_content_updates mismatch * fix: updater modal cleanup w/new structure * feat: better update all handling * fix: remove preview_update_all * fix: feedback on bulk update + lint * fix: rem transitions * fix: change to jsonb * feat: app db backup after update * fix: lint * fix: sqlx prepare + use sqlx macros * fix: lint * fix: bugs * feat: defuck the installing process up * fix: bug of hell * fix: shear * fix: fmt * fix: install progress spacing + change mc/content/overrides to bytes * fix: lint * fix: prepr * fix: navtabs anim not working in app * fix: worlds.vue improvements + browse page fixes * feat: optimise queries + adapter fns * fix: lint * fix: lint * feat: shared modrinth-content-management crate (#6469) * feat: disable warnings setting * feat: add instances shortcuts (#6329) * Add modrinth://launch deep link to start a profile Support external profile launching via modrinth://launch/{profile_path} for integrations such as Stream Deck. * Change route to /launch/profile/{id} for future extensibility * fix: ensure profile path is url decoded * fix: URL-decode profile path from deep link * fix: use urlencoding crate for URL decoding * feat: implement app instance shortcuts * feat: change windows shortcut creation to use windows api instead * feat: implement creating a shortcut launching world/server * format * fmt * fix multiline inline tables * pnpm prepr * feat: move create shortcut to last item * refactor: split up shortcuts.rs for individual platforms * refactor: turn profile launch url into url type * use string literal and add safety comment * pt2 * refactor: rename anything that's profile into instance * update mac shortcut --------- Co-authored-by: DJCheesusReal <134006619+DJCheesusReal@users.noreply.github.com> --------- Co-authored-by: Truman Gao <106889354+tdgao@users.noreply.github.com> Co-authored-by: DJCheesusReal <134006619+DJCheesusReal@users.noreply.github.com>
200 lines
4.4 KiB
Vue
200 lines
4.4 KiB
Vue
<script setup>
|
|
import { CheckIcon } from '@modrinth/assets'
|
|
import { Badge, ButtonStyled } from '@modrinth/ui'
|
|
import { computed, ref } from 'vue'
|
|
|
|
import { SwapIcon } from '@/assets/icons/index.js'
|
|
import ModalWrapper from '@/components/ui/modal/ModalWrapper.vue'
|
|
import { update_managed_modrinth_version } from '@/helpers/instance'
|
|
import { releaseColor } from '@/helpers/utils'
|
|
|
|
const props = defineProps({
|
|
versions: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
instance: {
|
|
type: Object,
|
|
default: null,
|
|
},
|
|
})
|
|
|
|
defineExpose({
|
|
show: () => {
|
|
modpackVersionModal.value.show()
|
|
},
|
|
})
|
|
|
|
const emit = defineEmits(['finish-install'])
|
|
|
|
const filteredVersions = computed(() => {
|
|
return props.versions
|
|
})
|
|
|
|
const modpackVersionModal = ref(null)
|
|
const installedVersion = computed(() => props.instance?.link?.version_id)
|
|
const installing = computed(() => props.instance.install_stage !== 'installed')
|
|
const inProgress = ref(false)
|
|
|
|
const switchVersion = async (versionId) => {
|
|
modpackVersionModal.value.hide()
|
|
inProgress.value = true
|
|
await update_managed_modrinth_version(props.instance.id, versionId)
|
|
inProgress.value = false
|
|
emit('finish-install')
|
|
}
|
|
|
|
const onHide = () => {
|
|
if (!inProgress.value) {
|
|
emit('finish-install')
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<ModalWrapper
|
|
ref="modpackVersionModal"
|
|
class="modpack-version-modal"
|
|
header="Change modpack version"
|
|
:on-hide="onHide"
|
|
>
|
|
<div class="modal-body">
|
|
<div v-if="instance.link" class="mod-card">
|
|
<div class="table">
|
|
<div class="table-row with-columns table-head">
|
|
<div class="table-cell table-text download-cell" />
|
|
<div class="name-cell table-cell table-text">Name</div>
|
|
<div class="table-cell table-text">Supports</div>
|
|
</div>
|
|
<div class="scrollable">
|
|
<div
|
|
v-for="version in filteredVersions"
|
|
:key="version.id"
|
|
class="table-row with-columns selectable"
|
|
@click="$router.push(`/project/${version.project_id}/version/${version.id}`)"
|
|
>
|
|
<div class="table-cell table-text">
|
|
<ButtonStyled
|
|
circular
|
|
:color="version.id === installedVersion ? 'standard' : 'brand'"
|
|
>
|
|
<button
|
|
:disabled="inProgress || installing || version.id === installedVersion"
|
|
@click.stop="() => switchVersion(version.id)"
|
|
>
|
|
<SwapIcon v-if="version.id !== installedVersion" />
|
|
<CheckIcon v-else />
|
|
</button>
|
|
</ButtonStyled>
|
|
</div>
|
|
<div class="name-cell table-cell table-text">
|
|
<div class="version-link">
|
|
{{ version.name.charAt(0).toUpperCase() + version.name.slice(1) }}
|
|
<div class="version-badge">
|
|
<div class="channel-indicator">
|
|
<Badge
|
|
:color="releaseColor(version.version_type)"
|
|
:type="
|
|
version.version_type.charAt(0).toUpperCase() +
|
|
version.version_type.slice(1)
|
|
"
|
|
/>
|
|
</div>
|
|
<div>
|
|
{{ version.version_number }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="table-cell table-text stacked-text">
|
|
<span>
|
|
{{
|
|
version.loaders
|
|
.map((str) => str.charAt(0).toUpperCase() + str.slice(1))
|
|
.join(', ')
|
|
}}
|
|
</span>
|
|
<span>
|
|
{{ version.game_versions.join(', ') }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</ModalWrapper>
|
|
</template>
|
|
|
|
<style scoped lang="scss">
|
|
.filter-header {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.with-columns {
|
|
grid-template-columns: min-content 1fr 1fr;
|
|
}
|
|
|
|
.scrollable {
|
|
overflow-y: auto;
|
|
max-height: 25rem;
|
|
}
|
|
|
|
.card-row {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
background-color: var(--color-raised-bg);
|
|
}
|
|
|
|
.mod-card {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
overflow: hidden;
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
.version-link {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
|
|
.version-badge {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
|
|
.channel-indicator {
|
|
margin-right: 0.5rem;
|
|
}
|
|
}
|
|
}
|
|
|
|
.stacked-text {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.download-cell {
|
|
width: 4rem;
|
|
padding: 1rem;
|
|
}
|
|
|
|
.modal-body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--gap-md);
|
|
}
|
|
|
|
.table {
|
|
border: 1px solid var(--color-bg);
|
|
}
|
|
</style>
|