You've already forked AstralRinth
forked from didirus/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:
@@ -477,6 +477,7 @@ export namespace Labrinth {
|
||||
downloads: number
|
||||
files: VersionFile[]
|
||||
environment?: Labrinth.Projects.v3.Environment
|
||||
mrpack_loaders?: string[]
|
||||
}
|
||||
|
||||
export interface DraftVersionFile {
|
||||
@@ -514,6 +515,7 @@ export namespace Labrinth {
|
||||
primary_file?: string
|
||||
file_types?: Record<string, Labrinth.Versions.v3.FileType | null>
|
||||
environment?: Labrinth.Projects.v3.Environment
|
||||
mrpack_loaders?: string[]
|
||||
}
|
||||
|
||||
export type ModifyVersionRequest = Partial<
|
||||
|
||||
@@ -139,6 +139,7 @@ export class LabrinthVersionsV3Module extends AbstractModule {
|
||||
public async createVersion(
|
||||
draftVersion: Labrinth.Versions.v3.DraftVersion,
|
||||
versionFiles: Labrinth.Versions.v3.DraftVersionFile[],
|
||||
projectType: Labrinth.Projects.v2.ProjectType | null = null,
|
||||
): Promise<Labrinth.Versions.v3.Version> {
|
||||
const formData = new FormData()
|
||||
|
||||
@@ -164,13 +165,18 @@ export class LabrinthVersionsV3Module extends AbstractModule {
|
||||
changelog: draftVersion.changelog,
|
||||
dependencies: draftVersion.dependencies || [],
|
||||
game_versions: draftVersion.game_versions,
|
||||
loaders: draftVersion.loaders,
|
||||
version_type: draftVersion.version_type,
|
||||
featured: !!draftVersion.featured,
|
||||
file_parts: fileParts,
|
||||
file_types: fileTypeMap,
|
||||
primary_file: fileParts[0],
|
||||
environment: draftVersion.environment,
|
||||
loaders: draftVersion.loaders,
|
||||
}
|
||||
|
||||
if (projectType === 'modpack') {
|
||||
data.mrpack_loaders = draftVersion.loaders
|
||||
data.loaders = ['mrpack']
|
||||
}
|
||||
|
||||
formData.append('data', JSON.stringify(data))
|
||||
@@ -181,7 +187,7 @@ export class LabrinthVersionsV3Module extends AbstractModule {
|
||||
|
||||
const newVersion = await this.client.request<Labrinth.Versions.v3.Version>(`/version`, {
|
||||
api: 'labrinth',
|
||||
version: 2,
|
||||
version: 3,
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
timeout: 120000,
|
||||
@@ -190,10 +196,6 @@ export class LabrinthVersionsV3Module extends AbstractModule {
|
||||
},
|
||||
})
|
||||
|
||||
await this.modifyVersion(newVersion.id, {
|
||||
environment: draftVersion.environment,
|
||||
})
|
||||
|
||||
return newVersion
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user