Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@
},
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
},
"css.lint.unknownAtRules": "ignore",
"scss.lint.unknownAtRules": "ignore"
}
14 changes: 7 additions & 7 deletions apps/app-frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -970,13 +970,6 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
<NavButton v-if="themeStore.featureFlags.worlds_tab" v-tooltip.right="'Worlds'" to="/worlds">
<WorldIcon />
</NavButton>
<NavButton
v-if="themeStore.featureFlags.servers_in_app"
v-tooltip.right="'Servers'"
to="/hosting/manage"
>
<ServerIcon />
</NavButton>
<NavButton
v-tooltip.right="'Discover content'"
to="/browse/modpack"
Expand All @@ -1000,6 +993,13 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
>
<LibraryIcon />
</NavButton>
<NavButton
v-if="themeStore.featureFlags.servers_in_app"
v-tooltip.right="'Servers'"
to="/hosting/manage"
>
<ServerIcon />
</NavButton>
<div class="h-px w-6 mx-auto my-2 bg-surface-5"></div>
<suspense>
<QuickInstanceSwitcher />
Expand Down
13 changes: 8 additions & 5 deletions apps/app-frontend/src/assets/stylesheets/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,8 @@ body {
}

a {
color: var(--color-link);
color: inherit;
text-decoration: none;

&:hover {
text-decoration: none;
}
}

.badge {
Expand Down Expand Up @@ -174,4 +170,11 @@ img {
}
}

button,
input[type='button'] {
cursor: pointer;
border: none;
outline: 2px solid transparent;
}

@import '@modrinth/assets/omorphia.scss';
6 changes: 3 additions & 3 deletions apps/frontend/src/assets/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions apps/frontend/src/pages/hosting/manage/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
:show-loader-label="showLoaderLabel"
:uptime-seconds="uptimeSeconds"
:linked="true"
class="server-action-buttons-anim flex min-w-0 flex-col flex-wrap items-center gap-4 text-secondary *:hidden sm:flex-row sm:*:flex"
class="server-action-buttons-anim flex min-w-0 flex-col flex-wrap items-center gap-2 text-primary *:hidden sm:flex-row sm:*:flex"
/>
</div>
</div>
Expand Down Expand Up @@ -1135,7 +1135,8 @@ const handleInstallationResult = async (data: Archon.Websocket.v0.WSInstallation
}

const updateStats = (currentStats: Stats['current']) => {
isConnected.value = true
if (!isMounted.value) return
if (!isConnected.value) isConnected.value = true
stats.value = {
current: currentStats,
past: { ...stats.value.current },
Expand Down
72 changes: 69 additions & 3 deletions packages/ui/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import '@modrinth/assets/omorphia.scss'
import 'floating-vue/dist/style.css'
import '../src/styles/tailwind.css'
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'
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 { createMemoryHistory, createRouter } from 'vue-router'

import NotificationPanel from '../src/components/nav/NotificationPanel.vue'
import PopupNotificationPanel from '../src/components/nav/PopupNotificationPanel.vue'
Expand Down Expand Up @@ -109,9 +116,68 @@ 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)

const router = createRouter({
history: createMemoryHistory(),
routes: [{ path: '/:pathMatch(.*)*', component: { render: () => null } }],
})
app.use(router)

app.component('NuxtLink', StorybookLink)
app.component('RouterLink', StorybookLink)
app.component('ClientOnly', StorybookClientOnly)

// Provide the custom I18nContext for components using injectI18n()
const i18nContext: I18nContext = {
locale: i18n.global.locale,
Expand Down
45 changes: 5 additions & 40 deletions packages/ui/src/components/base/CopyCode.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<button class="code" :class="{ copied }" :title="formatMessage(copiedMessage)" @click="copyText">
<button
class="!m-0 inline-flex w-fit select-text items-center gap-2 rounded-[10px] bg-[var(--color-button-bg)] px-2 py-1 font-mono text-sm text-primary transition-[opacity,filter,transform,outline] duration-200 ease-in-out hover:brightness-[0.85] active:scale-95 active:brightness-[0.8] motion-reduce:transition-none [&>svg]:h-[1em] [&>svg]:w-[1em]"
:title="formatMessage(copiedMessage)"
@click="copyText"
>
<span>{{ text }}</span>
<CheckIcon v-if="copied" />
<ClipboardCopyIcon v-else />
Expand Down Expand Up @@ -27,42 +31,3 @@ async function copyText() {
copied.value = true
}
</script>

<style lang="scss" scoped>
.code {
color: var(--color-text);
display: inline-flex;
grid-gap: 0.5rem;
font-family: var(--mono-font);
font-size: var(--font-size-sm);
margin: 0;
padding: 0.25rem 0.5rem;
background-color: var(--color-button-bg);
width: fit-content;
border-radius: 10px;
user-select: text;
transition:
opacity 0.5s ease-in-out,
filter 0.2s ease-in-out,
transform 0.05s ease-in-out,
outline 0.2s ease-in-out;

@media (prefers-reduced-motion) {
transition: none !important;
}

svg {
width: 1em;
height: 1em;
}

&:hover {
filter: brightness(0.85);
}

&:active {
transform: scale(0.95);
filter: brightness(0.8);
}
}
</style>
Loading
Loading