feat: handling mrpack with no loaders (#5363)
* handle modpack upload with no loaders * restrict loaders for modpack * actually, dont allow modpack loaders to be editable * revert loader picker changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col gap-2.5">
|
<div class="flex flex-col gap-2.5">
|
||||||
<span class="font-semibold text-contrast">Loaders <span class="text-red">*</span></span>
|
<span class="font-semibold text-contrast">Loaders</span>
|
||||||
|
|
||||||
<Chips
|
<Chips
|
||||||
v-model="loaderGroup"
|
v-model="loaderGroup"
|
||||||
|
|||||||
@@ -77,7 +77,13 @@
|
|||||||
</TagItem>
|
</TagItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<span v-if="!draftVersion.loaders.length">No loaders selected.</span>
|
<TagItem
|
||||||
|
v-if="!draftVersionLoaders.length && projectType === 'modpack'"
|
||||||
|
class="border !border-solid border-surface-5 hover:no-underline"
|
||||||
|
>
|
||||||
|
No mod loader
|
||||||
|
</TagItem>
|
||||||
|
<span v-else-if="!draftVersionLoaders.length">No loaders selected.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -421,10 +421,6 @@ export function createManageVersionContext(
|
|||||||
inferred.loaders = ['datapack']
|
inferred.loaders = ['datapack']
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noLoaders && projectType.value === 'modpack') {
|
|
||||||
inferred.loaders = ['minecraft']
|
|
||||||
}
|
|
||||||
|
|
||||||
inferredVersionData.value = inferred
|
inferredVersionData.value = inferred
|
||||||
|
|
||||||
return inferred
|
return inferred
|
||||||
|
|||||||
@@ -10,8 +10,14 @@ export const stageConfig: StageConfigInput<ManageVersionContextValue> = {
|
|||||||
id: 'add-loaders',
|
id: 'add-loaders',
|
||||||
stageContent: markRaw(LoadersStage),
|
stageContent: markRaw(LoadersStage),
|
||||||
title: (ctx) => (ctx.editingVersion.value ? 'Edit loaders' : 'Loaders'),
|
title: (ctx) => (ctx.editingVersion.value ? 'Edit loaders' : 'Loaders'),
|
||||||
skip: (ctx) =>
|
skip: (ctx) => {
|
||||||
(ctx.inferredVersionData.value?.loaders?.length ?? 0) > 0 || ctx.editingVersion.value,
|
const inferredLoadersLength = ctx.inferredVersionData.value?.loaders?.length ?? 0
|
||||||
|
return (
|
||||||
|
inferredLoadersLength > 0 ||
|
||||||
|
ctx.editingVersion.value ||
|
||||||
|
(inferredLoadersLength === 0 && ctx.projectType.value === 'modpack')
|
||||||
|
)
|
||||||
|
},
|
||||||
hideStageInBreadcrumb: (ctx) => !ctx.primaryFile.value || ctx.handlingNewFiles.value,
|
hideStageInBreadcrumb: (ctx) => !ctx.primaryFile.value || ctx.handlingNewFiles.value,
|
||||||
cannotNavigateForward: (ctx) => ctx.draftVersion.value.loaders.length === 0,
|
cannotNavigateForward: (ctx) => ctx.draftVersion.value.loaders.length === 0,
|
||||||
leftButtonConfig: (ctx) => ({
|
leftButtonConfig: (ctx) => ({
|
||||||
@@ -36,20 +42,22 @@ export const fromDetailsStageConfig: StageConfigInput<ManageVersionContextValue>
|
|||||||
leftButtonConfig: (ctx) => ({
|
leftButtonConfig: (ctx) => ({
|
||||||
label: 'Back',
|
label: 'Back',
|
||||||
icon: LeftArrowIcon,
|
icon: LeftArrowIcon,
|
||||||
disabled: ctx.draftVersion.value.loaders.length === 0,
|
disabled: ctx.draftVersion.value.loaders.length === 0 && ctx.projectType.value !== 'modpack',
|
||||||
onClick: () => ctx.modal.value?.setStage('metadata'),
|
onClick: () => ctx.modal.value?.setStage('metadata'),
|
||||||
}),
|
}),
|
||||||
rightButtonConfig: (ctx) =>
|
rightButtonConfig: (ctx) =>
|
||||||
ctx.editingVersion.value
|
ctx.editingVersion.value
|
||||||
? {
|
? {
|
||||||
...ctx.saveButtonConfig(),
|
...ctx.saveButtonConfig(),
|
||||||
disabled: ctx.draftVersion.value.loaders.length === 0,
|
disabled:
|
||||||
|
ctx.draftVersion.value.loaders.length === 0 && ctx.projectType.value !== 'modpack',
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
label: 'Add details',
|
label: 'Add details',
|
||||||
icon: RightArrowIcon,
|
icon: RightArrowIcon,
|
||||||
iconPosition: 'after',
|
iconPosition: 'after',
|
||||||
disabled: ctx.draftVersion.value.loaders.length === 0,
|
disabled:
|
||||||
|
ctx.draftVersion.value.loaders.length === 0 && ctx.projectType.value !== 'modpack',
|
||||||
onClick: () => ctx.modal.value?.setStage('add-details'),
|
onClick: () => ctx.modal.value?.setStage('add-details'),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user