mirror of
https://github.com/modrinth/code.git
synced 2026-09-04 22:10:15 +00:00
fix: console sizing issues (#6540)
fix: console sizing issues (for good)
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="h-full w-full pt-6">
|
<div
|
||||||
|
class="h-full w-full pt-6"
|
||||||
|
:class="isContainedServerRoute ? 'box-border min-h-0 overflow-hidden' : ''"
|
||||||
|
>
|
||||||
<ServersManageRootLayout
|
<ServersManageRootLayout
|
||||||
:server-id="serverId"
|
:server-id="serverId"
|
||||||
|
:layout-mode="isContainedServerRoute ? 'contained' : 'page'"
|
||||||
:reload-page="() => router.go(0)"
|
:reload-page="() => router.go(0)"
|
||||||
:resolve-viewer="resolveViewer"
|
:resolve-viewer="resolveViewer"
|
||||||
:show-copy-id-action="themeStore.devMode"
|
:show-copy-id-action="themeStore.devMode"
|
||||||
@@ -63,6 +67,8 @@ const queryClient = useQueryClient()
|
|||||||
const themeStore = useTheming()
|
const themeStore = useTheming()
|
||||||
const breadcrumbs = useBreadcrumbs()
|
const breadcrumbs = useBreadcrumbs()
|
||||||
|
|
||||||
|
const isContainedServerRoute = computed(() => route.name === 'ServerManageOverview')
|
||||||
|
|
||||||
const serverId = computed(() => {
|
const serverId = computed(() => {
|
||||||
const rawId = route.params.id
|
const rawId = route.params.id
|
||||||
return Array.isArray(rawId) ? rawId[0] : (rawId ?? '')
|
return Array.isArray(rawId) ? rawId[0] : (rawId ?? '')
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ import { ServersManageOverviewPage } from '@modrinth/ui'
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ServersManageOverviewPage />
|
<ServersManageOverviewPage contained-console />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ export default new createRouter({
|
|||||||
name: 'Logs',
|
name: 'Logs',
|
||||||
component: Instance.Logs,
|
component: Instance.Logs,
|
||||||
meta: {
|
meta: {
|
||||||
|
renderMode: 'fixed',
|
||||||
useRootContext: true,
|
useRootContext: true,
|
||||||
breadcrumb: [{ name: '?Instance', link: '/instance/{id}/' }, { name: 'Logs' }],
|
breadcrumb: [{ name: '?Instance', link: '/instance/{id}/' }, { name: 'Logs' }],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -189,14 +189,31 @@ function handleDocumentPointerDown(event: PointerEvent) {
|
|||||||
terminal.value.clearSelection()
|
terminal.value.clearSelection()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDocumentKeyDown(event: KeyboardEvent) {
|
||||||
|
if (!event.metaKey || event.key.toLowerCase() !== 'a') return
|
||||||
|
const target = event.target as Node | null
|
||||||
|
const active = document.activeElement
|
||||||
|
if (
|
||||||
|
!(target && containerRef.value?.contains(target)) &&
|
||||||
|
!(active && containerRef.value?.contains(active))
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault()
|
||||||
|
terminal.value?.selectAll()
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener('resize', handleWindowResize)
|
window.addEventListener('resize', handleWindowResize)
|
||||||
document.addEventListener('pointerdown', handleDocumentPointerDown)
|
document.addEventListener('pointerdown', handleDocumentPointerDown)
|
||||||
|
document.addEventListener('keydown', handleDocumentKeyDown, true)
|
||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
window.removeEventListener('resize', handleWindowResize)
|
window.removeEventListener('resize', handleWindowResize)
|
||||||
document.removeEventListener('pointerdown', handleDocumentPointerDown)
|
document.removeEventListener('pointerdown', handleDocumentPointerDown)
|
||||||
|
document.removeEventListener('keydown', handleDocumentKeyDown, true)
|
||||||
if (resizeDebounce) clearTimeout(resizeDebounce)
|
if (resizeDebounce) clearTimeout(resizeDebounce)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const baseId = useId()
|
|||||||
<template #popper>
|
<template #popper>
|
||||||
<div class="flex flex-col max-w-[22rem] leading-tight gap-0.5">
|
<div class="flex flex-col max-w-[22rem] leading-tight gap-0.5">
|
||||||
<span class="text-contrast mb-1">{{ formatMessage(name, values) }}</span>
|
<span class="text-contrast mb-1">{{ formatMessage(name, values) }}</span>
|
||||||
<span v-for="message of about" :key="message.id" class="text-primary">
|
<span v-for="message in about" :key="message.id" class="text-primary">
|
||||||
{{ formatMessage(message, values) }}
|
{{ formatMessage(message, values) }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="link" class="text-secondary text-xs opacity-80">
|
<span v-if="link" class="text-secondary text-xs opacity-80">
|
||||||
|
|||||||
@@ -198,7 +198,12 @@ export function useTerminal(options: UseTerminalOptions): UseTerminalReturn {
|
|||||||
const mod = e.ctrlKey || e.metaKey
|
const mod = e.ctrlKey || e.metaKey
|
||||||
if (!mod) return true
|
if (!mod) return true
|
||||||
const key = e.key.toLowerCase()
|
const key = e.key.toLowerCase()
|
||||||
if (key === 'c' || key === 'insert' || key === 'a') {
|
if (key === 'a') {
|
||||||
|
e.preventDefault()
|
||||||
|
term.selectAll()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (key === 'c' || key === 'insert') {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -1,13 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="relative flex select-none flex-col gap-6" data-pyro-server-manager-root>
|
<div
|
||||||
<div class="flex flex-col gap-4">
|
class="relative flex select-none flex-col gap-6"
|
||||||
|
:class="containedConsole ? 'h-full min-h-0 overflow-hidden' : ''"
|
||||||
|
data-pyro-server-manager-root
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="flex flex-col gap-4"
|
||||||
|
:class="containedConsole ? 'min-h-0 flex-1 overflow-hidden' : ''"
|
||||||
|
>
|
||||||
<ServerManageStats
|
<ServerManageStats
|
||||||
|
class="shrink-0"
|
||||||
:data="!isWsAuthIncorrect ? stats : undefined"
|
:data="!isWsAuthIncorrect ? stats : undefined"
|
||||||
:loading="isWsAuthIncorrect"
|
:loading="isWsAuthIncorrect"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="flex min-h-[700px] flex-col gap-2">
|
<div
|
||||||
<span class="text-2xl font-semibold text-contrast">Console</span>
|
class="flex flex-col gap-2"
|
||||||
|
:class="containedConsole ? 'min-h-0 flex-1 overflow-hidden' : 'min-h-[700px]'"
|
||||||
|
>
|
||||||
|
<span class="shrink-0 text-2xl font-semibold text-contrast">Console</span>
|
||||||
|
|
||||||
<ConsolePageLayout />
|
<ConsolePageLayout />
|
||||||
</div>
|
</div>
|
||||||
@@ -48,9 +59,11 @@ import { injectModrinthClient, injectModrinthServerContext } from '#ui/providers
|
|||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
showAdvancedDebugInfo?: boolean
|
showAdvancedDebugInfo?: boolean
|
||||||
|
containedConsole?: boolean
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
showAdvancedDebugInfo: false,
|
showAdvancedDebugInfo: false,
|
||||||
|
containedConsole: false,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -107,13 +107,17 @@
|
|||||||
}"
|
}"
|
||||||
:class="[
|
:class="[
|
||||||
'server-panel-' + revealState,
|
'server-panel-' + revealState,
|
||||||
constrainWidth ? 'min-h-[100svh] max-w-[1280px] pb-16' : 'min-h-[calc(100svh-100px)] pb-6',
|
containedLayout
|
||||||
|
? 'h-full min-h-0 overflow-hidden pb-6'
|
||||||
|
: constrainWidth
|
||||||
|
? 'min-h-[100svh] max-w-[1280px] pb-16'
|
||||||
|
: 'min-h-[calc(100svh-100px)] pb-6',
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<template v-if="revealState !== 'pending' || isOnboarding">
|
<template v-if="revealState !== 'pending' || isOnboarding">
|
||||||
<ServerManageHeader
|
<ServerManageHeader
|
||||||
v-if="!isOnboarding"
|
v-if="!isOnboarding"
|
||||||
class="server-stagger-item"
|
:class="['server-stagger-item', containedLayout ? 'shrink-0' : '']"
|
||||||
:style="{ '--si': 0 }"
|
:style="{ '--si': 0 }"
|
||||||
:server="serverData"
|
:server="serverData"
|
||||||
:server-image="serverImage"
|
:server-image="serverImage"
|
||||||
@@ -180,6 +184,7 @@
|
|||||||
<div
|
<div
|
||||||
data-pyro-navigation
|
data-pyro-navigation
|
||||||
class="server-stagger-item isolate flex w-full select-none flex-col justify-between gap-4 overflow-auto md:flex-row md:items-center"
|
class="server-stagger-item isolate flex w-full select-none flex-col justify-between gap-4 overflow-auto md:flex-row md:items-center"
|
||||||
|
:class="containedLayout ? 'shrink-0' : ''"
|
||||||
:style="{ '--si': 1 }"
|
:style="{ '--si': 1 }"
|
||||||
>
|
>
|
||||||
<NavTabs :links="navLinks" replace />
|
<NavTabs :links="navLinks" replace />
|
||||||
@@ -187,7 +192,8 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
data-pyro-mount
|
data-pyro-mount
|
||||||
class="server-stagger-item h-full w-full flex-1"
|
class="server-stagger-item w-full flex-1"
|
||||||
|
:class="containedLayout ? 'flex min-h-0 flex-col overflow-hidden' : 'h-full'"
|
||||||
:style="{ '--si': 2 }"
|
:style="{ '--si': 2 }"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -308,7 +314,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ServerPanelAdmonitions
|
<ServerPanelAdmonitions
|
||||||
class="mb-4"
|
class="mb-4 shrink-0"
|
||||||
:sync-progress="syncProgress"
|
:sync-progress="syncProgress"
|
||||||
:content-error="contentError"
|
:content-error="contentError"
|
||||||
@content-retry="handleContentRetry"
|
@content-retry="handleContentRetry"
|
||||||
@@ -447,6 +453,7 @@ const props = withDefaults(
|
|||||||
type: 'mod' | 'plugin' | 'datapack'
|
type: 'mod' | 'plugin' | 'datapack'
|
||||||
}) => void | Promise<void>
|
}) => void | Promise<void>
|
||||||
constrainWidth?: boolean
|
constrainWidth?: boolean
|
||||||
|
layoutMode?: 'page' | 'contained'
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
showCopyIdAction: false,
|
showCopyIdAction: false,
|
||||||
@@ -462,6 +469,7 @@ const props = withDefaults(
|
|||||||
browseModpacks: undefined,
|
browseModpacks: undefined,
|
||||||
browseContent: undefined,
|
browseContent: undefined,
|
||||||
constrainWidth: false,
|
constrainWidth: false,
|
||||||
|
layoutMode: 'page',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -499,6 +507,7 @@ const DISABLE_LOADING_ANIM = true
|
|||||||
const { addNotification } = injectNotificationManager()
|
const { addNotification } = injectNotificationManager()
|
||||||
const client = injectModrinthClient()
|
const client = injectModrinthClient()
|
||||||
const constrainWidth = computed(() => props.constrainWidth)
|
const constrainWidth = computed(() => props.constrainWidth)
|
||||||
|
const containedLayout = computed(() => props.layoutMode === 'contained')
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|||||||
Reference in New Issue
Block a user