Versions environments updates (#4949)

* add environment to version page metadata card

* remove environment migration warnings

* show settings/environments in nav only for staff

* use v2 versions route due to regressions

* add modpack incorrect loaders migration

* remove modpack migration step

* remove unused var

* run pnpm intl:extract

* componentize environment migration page

* rename environment selector

* rename environment selector pt2

* add migration modal to admonition

* hide environments in settings and show message

* show environment in project versions table

* pnpm fix

* pnpm fix on ui package

* intl:extract

* fix: .value

* lower case file

* add icon to environment tags and use i18n

* Update apps/frontend/src/pages/[type]/[id].vue

Co-authored-by: Calum H. <contact@cal.engineer>
Signed-off-by: Truman Gao <106889354+tdgao@users.noreply.github.com>

* open migration modal from warning icon in project dashboard

* fix settings side nav icon

* use useRoute composable

* pnpm fix

* intl:extract

* fix import

* fix import again

* run pnpm prepr

* fix designMessage import

* fix environment fetch

* fix environment fetch properly without key conflict

* fix environment refetching

* fix not using current versions in table to check different environments

* fix download tooltip

---------

Signed-off-by: Truman Gao <106889354+tdgao@users.noreply.github.com>
Co-authored-by: Calum H. (IMB11) <contact@cal.engineer>
This commit is contained in:
Truman Gao
2025-12-29 13:58:17 -08:00
committed by GitHub
parent 9924faab84
commit 91b08e7380
16 changed files with 671 additions and 286 deletions

View File

@@ -0,0 +1,129 @@
import type { Labrinth } from '@modrinth/api-client'
import { ClientIcon, MonitorSmartphoneIcon, ServerIcon, UserIcon } from '@modrinth/assets'
import type { Component } from 'vue'
import { defineMessage, type MessageDescriptor } from '../../../../composables/i18n'
export const ENVIRONMENTS_COPY: Record<
Labrinth.Projects.v3.Environment,
{ title: MessageDescriptor; description: MessageDescriptor; icon?: Component }
> = {
client_only: {
title: defineMessage({
id: 'project.environment.client-only.title',
defaultMessage: 'Client-side only',
}),
description: defineMessage({
id: 'project.environment.client-only.description',
defaultMessage:
'All functionality is done client-side and is compatible with vanilla servers.',
}),
icon: ClientIcon,
},
server_only: {
title: defineMessage({
id: 'project.environment.server-only.title',
defaultMessage: 'Server-side only',
}),
description: defineMessage({
id: 'project.environment.server-only.description',
defaultMessage:
'All functionality is done server-side and is compatible with vanilla clients.',
}),
icon: ServerIcon,
},
singleplayer_only: {
title: defineMessage({
id: 'project.environment.singleplayer-only.title',
defaultMessage: 'Singleplayer only',
}),
description: defineMessage({
id: 'project.environment.singleplayer-only.description',
defaultMessage:
'Only functions in Singleplayer or when not connected to a Multiplayer server.',
}),
icon: UserIcon,
},
dedicated_server_only: {
title: defineMessage({
id: 'project.environment.dedicated-server-only.title',
defaultMessage: 'Server-side only',
}),
description: defineMessage({
id: 'project.environment.dedicated-server-only.description',
defaultMessage:
'All functionality is done server-side and is compatible with vanilla clients.',
}),
icon: ServerIcon,
},
client_and_server: {
title: defineMessage({
id: 'project.environment.client-and-server.title',
defaultMessage: 'Client and server',
}),
description: defineMessage({
id: 'project.environment.client-and-server.description',
defaultMessage:
'Has some functionality on both the client and server, even if only partially.',
}),
icon: MonitorSmartphoneIcon,
},
client_only_server_optional: {
title: defineMessage({
id: 'project.environment.client-only-server-optional.title',
defaultMessage: 'Client and server',
}),
description: defineMessage({
id: 'project.environment.client-only-server-optional.description',
defaultMessage:
'Has some functionality on both the client and server, even if only partially.',
}),
icon: MonitorSmartphoneIcon,
},
server_only_client_optional: {
title: defineMessage({
id: 'project.environment.server-only-client-optional.title',
defaultMessage: 'Client and server',
}),
description: defineMessage({
id: 'project.environment.server-only-client-optional.description',
defaultMessage:
'Has some functionality on both the client and server, even if only partially.',
}),
icon: MonitorSmartphoneIcon,
},
client_or_server: {
title: defineMessage({
id: 'project.environment.client-or-server.title',
defaultMessage: 'Client and server',
}),
description: defineMessage({
id: 'project.environment.client-or-server.description',
defaultMessage:
'Has some functionality on both the client and server, even if only partially.',
}),
icon: MonitorSmartphoneIcon,
},
client_or_server_prefers_both: {
title: defineMessage({
id: 'project.environment.client-or-server-prefers-both.title',
defaultMessage: 'Client and server',
}),
description: defineMessage({
id: 'project.environment.client-or-server-prefers-both.description',
defaultMessage:
'Has some functionality on both the client and server, even if only partially.',
}),
icon: MonitorSmartphoneIcon,
},
unknown: {
title: defineMessage({
id: 'project.environment.unknown.title',
defaultMessage: 'Unknown environment',
}),
description: defineMessage({
id: 'project.environment.unknown.description',
defaultMessage: 'The environment for this version could not be determined.',
}),
},
}