From 7d4ce863b0b7d4326691ec1a815d24c145ec4960 Mon Sep 17 00:00:00 2001 From: tdgao Date: Tue, 17 Mar 2026 17:06:46 -0600 Subject: [PATCH 01/11] fix type errors --- .../src/components/servers/ServerListing.vue | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/packages/ui/src/components/servers/ServerListing.vue b/packages/ui/src/components/servers/ServerListing.vue index 40c460b989..668917d714 100644 --- a/packages/ui/src/components/servers/ServerListing.vue +++ b/packages/ui/src/components/servers/ServerListing.vue @@ -11,7 +11,7 @@ data-pyro-server-listing :data-pyro-server-listing-id="server_id" > - +
() -const { archon, kyros, labrinth } = injectModrinthClient() +const { kyros, labrinth } = injectModrinthClient() const showGameLabel = computed(() => !!props.game) const showLoaderLabel = computed(() => !!props.loader) @@ -207,14 +207,8 @@ const { data: image } = useQuery({ if (!props.server_id || props.status !== 'available') return null try { - const auth = await archon.servers_v0.getFilesystemAuth(props.server_id) - try { - const blob = await kyros.files_v0.downloadFile( - auth.url, - auth.token, - '/server-icon-original.png', - ) + const blob = await kyros.files_v0.downloadFile('/server-icon-original.png') return await processImageBlob(blob, 512) } catch { @@ -227,17 +221,12 @@ const { data: image } = useQuery({ const scaledBlob = await dataURLToBlob(scaledDataUrl) const scaledFile = new File([scaledBlob], 'server-icon.png', { type: 'image/png' }) - await kyros.files_v0.uploadFile(auth.url, auth.token, '/server-icon.png', scaledFile) + kyros.files_v0.uploadFile('/server-icon.png', scaledFile) const originalFile = new File([blob], 'server-icon-original.png', { type: 'image/png', }) - await kyros.files_v0.uploadFile( - auth.url, - auth.token, - '/server-icon-original.png', - originalFile, - ) + kyros.files_v0.uploadFile('/server-icon-original.png', originalFile) return scaledDataUrl } From 86dad839b4ceff4f2b8ca0c5300586783d0598cb Mon Sep 17 00:00:00 2001 From: tdgao Date: Tue, 17 Mar 2026 17:54:29 -0600 Subject: [PATCH 02/11] fix some stylesheets not imported for storybook --- .../src/assets/stylesheets/global.scss | 6 +- packages/ui/.storybook/preview.ts | 60 ++++++++++++++++++- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/apps/app-frontend/src/assets/stylesheets/global.scss b/apps/app-frontend/src/assets/stylesheets/global.scss index 346cb2abb8..01d61ca67e 100644 --- a/apps/app-frontend/src/assets/stylesheets/global.scss +++ b/apps/app-frontend/src/assets/stylesheets/global.scss @@ -77,12 +77,8 @@ body { } a { - color: var(--color-link); + color: inherit; text-decoration: none; - - &:hover { - text-decoration: none; - } } .badge { diff --git a/packages/ui/.storybook/preview.ts b/packages/ui/.storybook/preview.ts index d775c85df0..94dec3ba71 100644 --- a/packages/ui/.storybook/preview.ts +++ b/packages/ui/.storybook/preview.ts @@ -1,14 +1,16 @@ -import '@modrinth/assets/omorphia.scss' +import '@modrinth/assets' import 'floating-vue/dist/style.css' -import '../src/styles/tailwind.css' +import '../../../apps/app-frontend/src/assets/stylesheets/global.scss' // theres also a global.scss for frontend, can switch out to test +import '../../assets/styles/defaults.scss' import type { Labrinth } from '@modrinth/api-client' import { GenericModrinthClient } from '@modrinth/api-client' import { withThemeByClassName } from '@storybook/addon-themes' import type { Preview } from '@storybook/vue3-vite' import { setup } from '@storybook/vue3-vite' +import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query' import FloatingVue from 'floating-vue' -import { defineComponent, ref } from 'vue' +import { computed, defineComponent, h, ref } from 'vue' import { createI18n } from 'vue-i18n' import NotificationPanel from '../src/components/nav/NotificationPanel.vue' @@ -109,8 +111,60 @@ class StorybookPopupNotificationManager extends AbstractPopupNotificationManager } } +const StorybookLink = defineComponent({ + name: 'StorybookLink', + inheritAttrs: false, + props: { + to: { + type: [String, Object], + default: '', + }, + }, + setup(props, { attrs, slots }) { + const href = computed(() => { + if (typeof props.to === 'string') return props.to || '#' + if (props.to && typeof props.to === 'object' && 'path' in props.to) { + const path = props.to.path + return typeof path === 'string' ? path : '#' + } + return '#' + }) + + return () => + h( + 'a', + { + ...attrs, + href: href.value, + }, + slots.default?.(), + ) + }, +}) + +const StorybookClientOnly = defineComponent({ + name: 'StorybookClientOnly', + setup(_, { slots }) { + return () => slots.default?.() + }, +}) + setup((app) => { + const queryClient = new QueryClient({ + defaultOptions: { + queries: { + retry: false, + }, + mutations: { + retry: false, + }, + }, + }) + app.use(VueQueryPlugin, { queryClient }) app.use(i18n) + app.component('NuxtLink', StorybookLink) + app.component('RouterLink', StorybookLink) + app.component('ClientOnly', StorybookClientOnly) // Provide the custom I18nContext for components using injectI18n() const i18nContext: I18nContext = { From 423818523aee4e57b79492ed0463aff14bbea2a5 Mon Sep 17 00:00:00 2001 From: tdgao Date: Tue, 17 Mar 2026 17:54:37 -0600 Subject: [PATCH 03/11] add server listing stories --- .../stories/servers/ServerListing.stories.ts | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 packages/ui/src/stories/servers/ServerListing.stories.ts diff --git a/packages/ui/src/stories/servers/ServerListing.stories.ts b/packages/ui/src/stories/servers/ServerListing.stories.ts new file mode 100644 index 0000000000..2173b0a82b --- /dev/null +++ b/packages/ui/src/stories/servers/ServerListing.stories.ts @@ -0,0 +1,111 @@ +import type { Meta, StoryObj } from '@storybook/vue3-vite' + +import ServerListing from '../../components/servers/ServerListing.vue' + +const baseServer = { + server_id: 'srv_2n5x8j9k', + name: 'Survival SMP', + status: 'available', + game: 'Minecraft', + mc_version: '1.21.5', + loader: 'Fabric', + loader_version: '0.16.14', + net: { + ip: '203.0.113.42', + port: 25565, + domain: 'play.example.net', + }, +} as const + +const pendingChange = { + planSize: 'Performance 8 GB', + cpu: 4, + cpuBurst: 6, + ramGb: 8, + storageGb: 80, + date: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000).toISOString(), + verb: 'Upgrade', +} as const + +const meta = { + title: 'Servers/ServerListing', + component: ServerListing, + parameters: { + layout: 'padded', + }, + decorators: [ + (story) => ({ + components: { story }, + template: '
', + }), + ], +} satisfies Meta + +export default meta +type Story = StoryObj + +export const Default: Story = { + args: { + ...baseServer, + }, +} + +export const ConfiguringNewServer: Story = { + args: { + ...baseServer, + server_id: 'srv_new_flow', + name: 'Fresh Vanilla World', + status: 'installing', + flows: { intro: true }, + loader: 'Vanilla', + loader_version: null, + }, +} + +export const WithPendingChange: Story = { + args: { + ...baseServer, + server_id: 'srv_pending', + name: 'Competitive UHC', + pendingChange, + }, +} + +export const SuspendedUpgrading: Story = { + args: { + ...baseServer, + server_id: 'srv_suspended_upgrade', + name: 'Creative Build Team', + status: 'suspended', + suspension_reason: 'upgrading', + }, +} + +export const SuspendedCancelled: Story = { + args: { + ...baseServer, + server_id: 'srv_suspended_cancelled', + name: 'Old Event Server', + status: 'suspended', + suspension_reason: 'cancelled', + }, +} + +export const SuspendedPaymentFailed: Story = { + args: { + ...baseServer, + server_id: 'srv_suspended_reason', + name: 'Minigames Network', + status: 'suspended', + suspension_reason: 'paymentfailed', + }, +} + +export const SuspendedGeneric: Story = { + args: { + ...baseServer, + server_id: 'srv_suspended_generic', + name: 'Archive Server', + status: 'suspended', + }, +} From 957e43a0d028019e3b3d47a45e6d8dcfbbd491af Mon Sep 17 00:00:00 2001 From: tdgao Date: Tue, 17 Mar 2026 18:23:08 -0600 Subject: [PATCH 04/11] add fix for frontend stylesheet imports --- apps/frontend/src/assets/styles/global.scss | 6 +++--- packages/ui/.storybook/preview.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/frontend/src/assets/styles/global.scss b/apps/frontend/src/assets/styles/global.scss index b003bb72a9..3f9817684d 100644 --- a/apps/frontend/src/assets/styles/global.scss +++ b/apps/frontend/src/assets/styles/global.scss @@ -463,9 +463,9 @@ kbd { font-size: 0.85em !important; } -@import '~/assets/styles/layout.scss'; -@import '~/assets/styles/utils.scss'; -@import '~/assets/styles/components.scss'; +@import './layout.scss'; +@import './utils.scss'; +@import './components.scss'; // OMORPHIA FIXES .card { diff --git a/packages/ui/.storybook/preview.ts b/packages/ui/.storybook/preview.ts index 94dec3ba71..a98e2efae1 100644 --- a/packages/ui/.storybook/preview.ts +++ b/packages/ui/.storybook/preview.ts @@ -1,7 +1,11 @@ -import '@modrinth/assets' import 'floating-vue/dist/style.css' -import '../../../apps/app-frontend/src/assets/stylesheets/global.scss' // theres also a global.scss for frontend, can switch out to test import '../../assets/styles/defaults.scss' +// frontend css imports +// import '../../../apps/frontend/src/assets/styles/global.scss' +// import '../../../apps/frontend/src/assets/styles/tailwind.css' +// --- +// app-frontend css imports +import '../../../apps/app-frontend/src/assets/stylesheets/global.scss' import type { Labrinth } from '@modrinth/api-client' import { GenericModrinthClient } from '@modrinth/api-client' From 6f810619251a00506032e03b02accce956c07166 Mon Sep 17 00:00:00 2001 From: tdgao Date: Tue, 17 Mar 2026 18:23:14 -0600 Subject: [PATCH 05/11] remove props. --- packages/ui/src/components/servers/ServerListing.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/components/servers/ServerListing.vue b/packages/ui/src/components/servers/ServerListing.vue index 668917d714..93d6e417b4 100644 --- a/packages/ui/src/components/servers/ServerListing.vue +++ b/packages/ui/src/components/servers/ServerListing.vue @@ -1,6 +1,6 @@