Files
archie/ui/src/settings/SettingsShell.vue
T
sam f156150a8b
ci/woodpecker/pr/quality Pipeline failed
Quality / check (pull_request) Canceled after 0s
fix(ui): size page layouts by container width, not viewport (#1892)
2026-11-12 23:05:31 +11:00

72 lines
2.8 KiB
Vue

<script setup lang="ts">
import { Separator } from "@/components/ui/separator";
import { computed } from "vue";
import { useRoute } from "vue-router";
import { hiddenPaths, orgNav, settingsNav } from "@/lib/nav";
import { cn } from "@/lib/utils";
import { useSessionStore } from "@/stores/session";
import RestartPendingBanner from "./RestartPendingBanner.vue";
import SettingsSaveBar from "./SettingsSaveBar.vue";
/** The configuration frame shared by the Instance and Organisation areas: the
* scope's sidebar, the restart banner, and the one save bar. */
const props = withDefaults(defineProps<{ scope?: "instance" | "org" }>(), {
scope: "instance",
});
const route = useRoute();
const session = useSessionStore();
const items = computed(() =>
props.scope === "org"
? orgNav(hiddenPaths(session.sections))
: settingsNav(hiddenPaths(session.sections)),
);
</script>
<template>
<div class="flex gap-8 @max-3xl:flex-col @max-3xl:gap-4">
<nav
id="config-sidebar"
:aria-label="props.scope === 'org' ? 'Organisation' : 'Instance'"
class="shrink-0 @3xl:w-48 @max-3xl:-mx-4 @max-3xl:w-auto @max-3xl:scroll-fade-x @max-3xl:overflow-x-auto @max-3xl:[scrollbar-width:none] @max-3xl:border-b @max-3xl:px-4"
>
<ul class="flex flex-col gap-0.5 @3xl:sticky @3xl:top-20 @max-3xl:flex-row @max-3xl:gap-1">
<li v-for="(item, index) in items" :key="item.path" class="contents">
<Separator v-if="item.dividerBefore === ''" class="my-4 @max-3xl:hidden" />
<p
v-else-if="item.dividerBefore"
:class="cn('mb-1 px-3 text-caption font-medium tracking-[0.06em] text-fg-subtle uppercase @max-3xl:hidden', index > 0 && 'mt-4')"
>
{{ item.dividerBefore }}
</p>
<RouterLink
:to="item.path"
:aria-current="route.path === item.path ? 'page' : undefined"
:class="
cn(
'flex h-8 shrink-0 items-center rounded-md px-3 text-label whitespace-nowrap text-fg-muted transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring',
route.path === item.path &&
'bg-secondary font-medium text-foreground',
)
"
>
{{ item.label }}
</RouterLink>
</li>
</ul>
</nav>
<!-- At least a screen tall, so the sticky save bar always rests at the
viewport's bottom edge rather than under the last setting. -->
<div class="mx-auto flex min-h-screen w-full min-w-0 max-w-[80ch] flex-1 flex-col">
<RestartPendingBanner />
<!-- Room below the last setting, so it can be scrolled up to eye level. -->
<div class="pb-[40vh]">
<slot />
</div>
<SettingsSaveBar />
</div>
</div>
</template>