Files
Docwell/Server/admin/src/App.vue
T
tajniak81andClaude Opus 5.5 a96c6ad3ce Add spaces, the page tree and the Docwell design system
Spaces and pages:
- Spaces inside workspaces, open or private, with admin/editor/commenter/viewer
  roles that cascade from the workspace role (rules in internal/access)
- Page tree per space with fractional position keys, move with cycle checks,
  trash that hides whole subtrees, restore and permanent delete
- OpenAPI, TypeScript client, and web app sidebar tree with drag-and-drop,
  page, space, trash and space settings views (EN + PL)

Design system:
- Tokens, type scale, radii and shadows from the design kit in
  @docwell/ui/theme.css; Inter, Source Serif 4 and JetBrains Mono bundled
- Vue ports of Button, TextField, Badge, Callout, Icon, Breadcrumbs,
  SlashMenu and PageTreeItem, plus Logo; favicons and web manifest
- Web app and admin panel restyled on the new tokens, in light and dark

Also: fix the Vite dev server crashing on /config.json, and stop tracking
the local Design/ and docs/ folders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:14:31 +01:00

65 lines
2.3 KiB
Vue

<script setup lang="ts">
import { DwBadge, DwButton, DwLogo, useTheme } from "@docwell/ui";
import { useRouter } from "vue-router";
import { computed } from "vue";
import { currentUser, isSuperadmin, signOut } from "./session";
useTheme();
const router = useRouter();
// Org admins manage their own organization; instance-wide settings are for
// superadmins only.
const nav = computed(() => [
{ to: "/", label: "Overview" },
{ to: "/users", label: "Users" },
{ to: "/organizations", label: isSuperadmin.value ? "Organizations" : "Organization" },
...(isSuperadmin.value
? [
{ to: "/authentication", label: "Authentication" },
{ to: "/storage", label: "Storage" },
{ to: "/email", label: "Email" },
{ to: "/maintenance", label: "Maintenance" },
]
: []),
]);
function logout() {
signOut();
router.replace({ name: "login" });
}
</script>
<template>
<RouterView v-if="!currentUser" />
<div v-else class="flex min-h-dvh flex-col md:flex-row">
<aside class="flex flex-col border-b border-line bg-surface-sunken md:w-56 md:border-r md:border-b-0">
<div class="flex h-12 items-center gap-2 px-4">
<DwLogo class="h-6" />
<DwBadge tone="accent">Admin</DwBadge>
</div>
<nav class="flex gap-px overflow-x-auto px-2 pb-2 md:flex-1 md:flex-col">
<RouterLink
v-for="item in nav"
:key="item.to"
:to="item.to"
class="flex h-control-sm items-center rounded-sm px-3 whitespace-nowrap text-ink-muted hover:bg-surface-hover hover:text-ink"
exact-active-class="!bg-accent-soft font-semibold !text-accent"
>
{{ item.label }}
</RouterLink>
</nav>
<div class="hidden border-t border-line p-3 md:block">
<div class="truncate font-medium text-ink">{{ currentUser.name }}</div>
<div class="truncate text-ui-sm text-ink-muted">{{ currentUser.email }}</div>
<div class="mt-1 text-ui-sm text-ink-muted" data-testid="role">
{{ isSuperadmin ? "Superadmin" : `Admin · ${currentUser.organizationName || "no organization"}` }}
</div>
<DwButton variant="ghost" size="sm" icon="sign-out" class="mt-2 -ml-2" @click="logout">Sign out</DwButton>
</div>
</aside>
<main class="min-w-0 flex-1 bg-surface p-4 sm:p-8">
<RouterView />
</main>
</div>
</template>