refactor: align files tab with content tab design (#5621)
* fix: files.vue bugs before styling changes * feat: move files tab to shared layout structure * fix: qa * fix: qa * fix: bugs * fix: lint * fix: admonition cleanup with progress + actions * fix: cleanup * fix: modals * fix: admon title * fix: i18n standard * fix: lint + i18n pass * fix: remove transition * fix: type errors * feat: files tab in app * fix: qa * fix: backup item minmax * fix: use ContentPageHeader for server panel * fix: lint * fix: lint * fix: lint * feat: page leave safety * fix: lint * fix: cargo fmt fix * fix: blank in prod * fix: content card table stuff * Revert "fix: blank in prod" This reverts commit 74758fe185cf85a4a20355857f889cb091b97ace. * fix: import * feat: browse worlds/servers flow * fix: worlds tab parity with content tab * fix: perf bug + shader filter pill copy * feat: singleplayer filter * fix: ordering * fix: breadcrumbs * fix: lint * fix: qa * feat: store server proj id when adding to a non-linked instance * fix: lint * fix: i18n + qa * fix: conflict * qa: already installed modal + placeholders not server-specific * fix: qa * fix: add + edit server modals * fix: qa * fix: security * fix: devin flags * fix: lint * chore: change file to break build cache * fix: admon * fix: import path stuff * feat: qa * fix: fmt fmt idiot --------- Signed-off-by: Calum H. <calum@modrinth.com>
This commit is contained in:
@@ -133,6 +133,8 @@ export function createContentInstall(opts: {
|
||||
title: string
|
||||
icon_url?: string | null
|
||||
project_type?: string
|
||||
organization?: string | null
|
||||
team?: string
|
||||
},
|
||||
version?: Labrinth.Versions.v2.Version,
|
||||
) {
|
||||
@@ -164,6 +166,60 @@ export function createContentInstall(opts: {
|
||||
if (items.some((i) => i.file_name === placeholder.file_name)) return
|
||||
next.set(instancePath, [...items, placeholder])
|
||||
installingItems.value = next
|
||||
|
||||
if (project.organization) {
|
||||
get_organization(project.organization)
|
||||
.then((org: { id: string; slug: string; name: string; icon_url?: string }) => {
|
||||
updateInstallingItem(instancePath, placeholder.file_name, {
|
||||
owner: {
|
||||
id: org.id,
|
||||
name: org.name,
|
||||
avatar_url: org.icon_url,
|
||||
type: 'organization',
|
||||
},
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
} else if (project.team) {
|
||||
get_team(project.team)
|
||||
.then(
|
||||
(
|
||||
members: {
|
||||
user: { id: string; username: string; avatar_url?: string }
|
||||
is_owner: boolean
|
||||
}[],
|
||||
) => {
|
||||
const owner = members.find((m) => m.is_owner)
|
||||
if (owner) {
|
||||
updateInstallingItem(instancePath, placeholder.file_name, {
|
||||
owner: {
|
||||
id: owner.user.id,
|
||||
name: owner.user.username,
|
||||
avatar_url: owner.user.avatar_url,
|
||||
type: 'user',
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
.catch(() => {})
|
||||
}
|
||||
}
|
||||
|
||||
function updateInstallingItem(
|
||||
instancePath: string,
|
||||
fileName: string,
|
||||
updates: Partial<ContentItem>,
|
||||
) {
|
||||
const next = new Map(installingItems.value)
|
||||
const items = next.get(instancePath)
|
||||
if (!items) return
|
||||
const index = items.findIndex((i) => i.file_name === fileName)
|
||||
if (index === -1) return
|
||||
const updated = [...items]
|
||||
updated[index] = { ...updated[index], ...updates }
|
||||
next.set(instancePath, updated)
|
||||
installingItems.value = next
|
||||
}
|
||||
|
||||
function removeInstallingItems(instancePath: string, projectIds: string[]) {
|
||||
|
||||
Reference in New Issue
Block a user