From 6fb7e383c4e44a894599ea8b504964f28f8ea2b1 Mon Sep 17 00:00:00 2001 From: "Calum H. (IMB11)" Date: Mon, 26 Oct 2026 15:06:21 +0000 Subject: [PATCH] feat(ui): ui changes in prep for server play --- packages/assets/generated-icons.ts | 6 + packages/assets/icons/anvil.svg | 19 +++ packages/assets/icons/volume-2.svg | 17 +++ packages/assets/icons/volume-x.svg | 17 +++ .../ui/src/components/base/IntlFormatted.vue | 14 +- .../src/components/base/MultiStageModal.vue | 89 +++++++++++-- packages/ui/src/components/base/NavTabs.vue | 13 +- packages/ui/src/components/base/Toggle.vue | 30 +++-- .../ui/src/components/base/inputs/Input.vue | 75 ++++++----- packages/ui/src/components/modal/NewModal.vue | 121 ++++++++++++++++-- .../ui/src/components/modal/TabbedModal.vue | 19 ++- .../ui/src/stories/base/Toggle.stories.ts | 16 ++- 12 files changed, 361 insertions(+), 75 deletions(-) create mode 100644 packages/assets/icons/anvil.svg create mode 100644 packages/assets/icons/volume-2.svg create mode 100644 packages/assets/icons/volume-x.svg diff --git a/packages/assets/generated-icons.ts b/packages/assets/generated-icons.ts index 24d0569cfb4..ccba8797b8b 100644 --- a/packages/assets/generated-icons.ts +++ b/packages/assets/generated-icons.ts @@ -7,6 +7,7 @@ export type IconComponent = FunctionalComponent import _AffiliateIcon from './icons/affiliate.svg?component' import _AlignLeftIcon from './icons/align-left.svg?component' +import _AnvilIcon from './icons/anvil.svg?component' import _ArchiveIcon from './icons/archive.svg?component' import _ArrowBigRightDashIcon from './icons/arrow-big-right-dash.svg?component' import _ArrowBigUpIcon from './icons/arrow-big-up.svg?component' @@ -479,6 +480,8 @@ import _UserXIcon from './icons/user-x.svg?component' import _UsersIcon from './icons/users.svg?component' import _VersionIcon from './icons/version.svg?component' import _VideoIcon from './icons/video.svg?component' +import _Volume2Icon from './icons/volume-2.svg?component' +import _VolumeXIcon from './icons/volume-x.svg?component' import _WikiIcon from './icons/wiki.svg?component' import _WindowIcon from './icons/window.svg?component' import _WorldIcon from './icons/world.svg?component' @@ -491,6 +494,7 @@ import _ZoomOutIcon from './icons/zoom-out.svg?component' export const AffiliateIcon = _AffiliateIcon export const AlignLeftIcon = _AlignLeftIcon +export const AnvilIcon = _AnvilIcon export const ArchiveIcon = _ArchiveIcon export const ArrowBigRightDashIcon = _ArrowBigRightDashIcon export const ArrowBigUpIcon = _ArrowBigUpIcon @@ -963,6 +967,8 @@ export const UserXIcon = _UserXIcon export const UsersIcon = _UsersIcon export const VersionIcon = _VersionIcon export const VideoIcon = _VideoIcon +export const Volume2Icon = _Volume2Icon +export const VolumeXIcon = _VolumeXIcon export const WikiIcon = _WikiIcon export const WindowIcon = _WindowIcon export const WorldIcon = _WorldIcon diff --git a/packages/assets/icons/anvil.svg b/packages/assets/icons/anvil.svg new file mode 100644 index 00000000000..1cb352b8ff1 --- /dev/null +++ b/packages/assets/icons/anvil.svg @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/packages/assets/icons/volume-2.svg b/packages/assets/icons/volume-2.svg new file mode 100644 index 00000000000..0f92ec06208 --- /dev/null +++ b/packages/assets/icons/volume-2.svg @@ -0,0 +1,17 @@ + + + + + + diff --git a/packages/assets/icons/volume-x.svg b/packages/assets/icons/volume-x.svg new file mode 100644 index 00000000000..2d0c706300d --- /dev/null +++ b/packages/assets/icons/volume-x.svg @@ -0,0 +1,17 @@ + + + + + + diff --git a/packages/ui/src/components/base/IntlFormatted.vue b/packages/ui/src/components/base/IntlFormatted.vue index 7edebb2064c..a6a944bcb27 100644 --- a/packages/ui/src/components/base/IntlFormatted.vue +++ b/packages/ui/src/components/base/IntlFormatted.vue @@ -55,7 +55,9 @@ const formattedParts = computed(() => { for (const slotName of slotNames) { const normalizedName = slotName.startsWith('~') ? slotName.slice(1) : slotName - slotHandlers[normalizedName] = (chunks) => { + let handlerName = `intlSlot${Object.keys(slotHandlers).length}` + while (Object.prototype.hasOwnProperty.call(props.values ?? {}, handlerName)) handlerName += '_' + slotHandlers[handlerName] = (chunks) => { const slot = slots[slotName] if (slot) { const nodes = slot({ @@ -69,10 +71,12 @@ const formattedParts = computed(() => { return markRaw(chunks) as VNode[] } - msg = msg.replace( - new RegExp(`\\{${normalizedName}\\}`, 'g'), - `<${normalizedName}>`, - ) + msg = msg + .replaceAll(`<${normalizedName}>`, `<${handlerName}>`) + .replaceAll(``, ``) + if (!Object.prototype.hasOwnProperty.call(props.values ?? {}, normalizedName)) { + msg = msg.replaceAll(`{${normalizedName}}`, `<${handlerName}>`) + } } try { diff --git a/packages/ui/src/components/base/MultiStageModal.vue b/packages/ui/src/components/base/MultiStageModal.vue index d54ee59e696..69659e5863d 100644 --- a/packages/ui/src/components/base/MultiStageModal.vue +++ b/packages/ui/src/components/base/MultiStageModal.vue @@ -1,14 +1,20 @@