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>
|
||||
<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
|
||||
v-model="loaderGroup"
|
||||
|
||||
@@ -77,7 +77,13 @@
|
||||
</TagItem>
|
||||
</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>
|
||||
|
||||
@@ -421,10 +421,6 @@ export function createManageVersionContext(
|
||||
inferred.loaders = ['datapack']
|
||||
}
|
||||
|
||||
if (noLoaders && projectType.value === 'modpack') {
|
||||
inferred.loaders = ['minecraft']
|
||||
}
|
||||
|
||||
inferredVersionData.value = inferred
|
||||
|
||||
return inferred
|
||||
|
||||
@@ -10,8 +10,14 @@ export const stageConfig: StageConfigInput<ManageVersionContextValue> = {
|
||||
id: 'add-loaders',
|
||||
stageContent: markRaw(LoadersStage),
|
||||
title: (ctx) => (ctx.editingVersion.value ? 'Edit loaders' : 'Loaders'),
|
||||
skip: (ctx) =>
|
||||
(ctx.inferredVersionData.value?.loaders?.length ?? 0) > 0 || ctx.editingVersion.value,
|
||||
skip: (ctx) => {
|
||||
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,
|
||||
cannotNavigateForward: (ctx) => ctx.draftVersion.value.loaders.length === 0,
|
||||
leftButtonConfig: (ctx) => ({
|
||||
@@ -36,20 +42,22 @@ export const fromDetailsStageConfig: StageConfigInput<ManageVersionContextValue>
|
||||
leftButtonConfig: (ctx) => ({
|
||||
label: 'Back',
|
||||
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'),
|
||||
}),
|
||||
rightButtonConfig: (ctx) =>
|
||||
ctx.editingVersion.value
|
||||
? {
|
||||
...ctx.saveButtonConfig(),
|
||||
disabled: ctx.draftVersion.value.loaders.length === 0,
|
||||
disabled:
|
||||
ctx.draftVersion.value.loaders.length === 0 && ctx.projectType.value !== 'modpack',
|
||||
}
|
||||
: {
|
||||
label: 'Add details',
|
||||
icon: RightArrowIcon,
|
||||
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'),
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user