The Access area mixed organisation, instance and personal settings under one name. Split them: /org is the organisation's own area (members, identities, connections, models, schedules, playbooks), /settings is instance administration only, and personal security stays in the account menu. Setup checklist steps now link to the page that fixes them.
71 lines
2.7 KiB
Vue
71 lines
2.7 KiB
Vue
<script setup lang="ts">
|
|
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-lg:flex-col max-lg:gap-4">
|
|
<nav
|
|
id="config-sidebar"
|
|
:aria-label="props.scope === 'org' ? 'Organisation' : 'Instance'"
|
|
class="shrink-0 lg:w-48 max-lg:-mx-4 max-lg:w-auto max-lg:scroll-fade-x max-lg:overflow-x-auto max-lg:[scrollbar-width:none] max-lg:border-b max-lg:px-4"
|
|
>
|
|
<ul class="flex flex-col gap-0.5 lg:sticky lg:top-20 max-lg:flex-row max-lg:gap-1">
|
|
<li v-for="(item, index) in items" :key="item.path" class="contents">
|
|
<hr v-if="item.dividerBefore === ''" class="my-4 border-border max-lg:hidden" />
|
|
<p
|
|
v-else-if="item.dividerBefore"
|
|
:class="cn('mb-1 px-3 text-[11px] font-medium tracking-[0.06em] text-fg-subtle uppercase max-lg: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 items-center rounded-md px-3 text-[13px] whitespace-nowrap text-muted-foreground 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>
|