You've already forked AstralRinth
Improve editing project versions (#4933)
* add edit versions dropdown menu * implement improved edit version with individual edit stages * make changelog bigger * update button styles * remove hover button when hover on row * bring editing versions back to project settings * bring back gallery edit and upload in project page * fix progress value * fix admonition import * fix v3 upload for modpacks * fix modpack loader display for editing version and better open edit/create modal handling * fix currentMember prop * fix modpack loader displaying incorrectly * fix max length * fix version url after making an edit to version and fix delete * small max height fix * hide edit dependencies for modpack * pnpm run fix * fix import * add tooltip * update icons * update copy and create version button style
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { Labrinth } from '@modrinth/api-client'
|
||||
import { SaveIcon, SpinnerIcon } from '@modrinth/assets'
|
||||
import {
|
||||
createContext,
|
||||
injectModrinthClient,
|
||||
@@ -6,6 +7,7 @@ import {
|
||||
injectProjectPageContext,
|
||||
type MultiStageModal,
|
||||
resolveCtxFn,
|
||||
type StageButtonConfig,
|
||||
type StageConfigInput,
|
||||
} from '@modrinth/ui'
|
||||
import JSZip from 'jszip'
|
||||
@@ -49,9 +51,9 @@ export type VersionStage =
|
||||
| 'add-environment'
|
||||
| 'add-dependencies'
|
||||
| 'add-changelog'
|
||||
| 'edit-loaders'
|
||||
| 'edit-mc-versions'
|
||||
| 'edit-environment'
|
||||
| 'from-details-loaders'
|
||||
| 'from-details-mc-versions'
|
||||
| 'from-details-environment'
|
||||
|
||||
export interface ManageVersionContextValue {
|
||||
// State
|
||||
@@ -75,6 +77,7 @@ export interface ManageVersionContextValue {
|
||||
|
||||
// Stage helpers
|
||||
getNextLabel: (currentIndex?: number | null) => string
|
||||
saveButtonConfig: () => StageButtonConfig
|
||||
|
||||
// Version methods
|
||||
newDraftVersion: (projectId: string, version?: Labrinth.Versions.v3.DraftVersion | null) => void
|
||||
@@ -264,7 +267,7 @@ export function createManageVersionContext(
|
||||
if (noEnvironmentProject.value) version.environment = undefined
|
||||
|
||||
try {
|
||||
await labrinth.versions_v3.createVersion(version, files)
|
||||
await labrinth.versions_v3.createVersion(version, files, projectType.value ?? null)
|
||||
modal.value?.hide()
|
||||
addNotification({
|
||||
title: 'Project version created',
|
||||
@@ -380,6 +383,16 @@ export function createManageVersionContext(
|
||||
}
|
||||
}
|
||||
|
||||
const saveButtonConfig = (): StageButtonConfig => ({
|
||||
label: 'Save changes',
|
||||
icon: isSubmitting.value ? SpinnerIcon : SaveIcon,
|
||||
iconPosition: 'before',
|
||||
iconClass: isSubmitting.value ? 'animate-spin' : undefined,
|
||||
color: 'green',
|
||||
disabled: isSubmitting.value,
|
||||
onClick: () => handleSaveVersionEdits(),
|
||||
})
|
||||
|
||||
const contextValue: ManageVersionContextValue = {
|
||||
// State
|
||||
draftVersion,
|
||||
@@ -402,6 +415,7 @@ export function createManageVersionContext(
|
||||
|
||||
// Stage helpers
|
||||
getNextLabel,
|
||||
saveButtonConfig,
|
||||
|
||||
// Methods
|
||||
newDraftVersion,
|
||||
|
||||
Reference in New Issue
Block a user