Files
Docwell/Server/admin/src/App.vue
T
tajniak81andClaude Opus 5.5 0640004895
CI / go (Server) (push) Failing after 4m38s
CI / go (Web-App) (push) Successful in 12m18s
Docs / build (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
CI / frontend (push) Failing after 7m49s
CI / desktop (ubuntu-latest) (push) Successful in 1h25m30s
CI / mobile (push) Failing after 5m14s
CI / docker (push) Successful in 39m26s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Add database relations and rollups, full-page records, and translate the admin panel and phone app
Databases (ADR-13 follow-ups):
- Relation properties link records to another database, on the same page
  or on any page the reader can open (read live and read-only, like synced
  pages). Cells list the linked titles; clicking one opens the record.
- Rollup properties work out counts, sums, averages, medians, min/max,
  ranges, earliest/latest dates and checked counts over related records.
  Neither is stored: views compute them before drawing (linked.ts), so they
  follow both databases live, and rollups sort and filter as numbers.
- Exports (Markdown, HTML, PDF, Word) resolve them for same-page databases.
- A record opens as a full page at /p/<page>/r/<database>/<record>, with
  "Open as full page" on the side panel and "Back to the page".

Edgeless mode (ADR-14 follow-ups):
- History previews show a version's canvas and count canvas changes.
- Comments can be anchored to canvas elements (anchor {element}); elements
  with open threads show a badge that opens the thread.
- Workspaces choose how new pages open (workspaces.default_page_mode); the
  per-device choice now defaults to following the workspace.
- Phones edit the canvas once a page is opened for editing; the page note
  shows the page title.

Languages:
- The admin panel speaks English, Polish, German, French and Spanish, with
  a picker sharing the web app's setting and a key parity test.
- The phone app speaks the same five, follows the phone's language (and
  Android's per-app language setting), and has its own parity test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 17:11:47 +01:00

91 lines
3.5 KiB
Vue

<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
<script setup lang="ts">
import { DwBadge, DwButton, DwLogo, useTheme } from "@docwell/ui";
import { useRouter } from "vue-router";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import { localeNames, storedLocale, storeLocale, supportedLocales, type Locale } from "./i18n";
import { currentUser, isSuperadmin, signOut } from "./session";
useTheme();
const router = useRouter();
const { t, locale } = useI18n();
const language = ref<Locale | "">(storedLocale());
const pickLanguage = () => (locale.value = storeLocale(language.value));
// Org admins manage their own organization; instance-wide settings are for
// superadmins only.
const nav = computed(() => [
{ to: "/", label: t("nav.overview") },
{ to: "/users", label: t("nav.users") },
{ to: "/organizations", label: t(isSuperadmin.value ? "nav.organizations" : "nav.organization") },
{ to: "/security", label: t("nav.security") },
...(isSuperadmin.value
? [
{ to: "/authentication", label: t("nav.authentication") },
{ to: "/branding", label: t("nav.branding") },
{ to: "/storage", label: t("nav.storage") },
{ to: "/email", label: t("nav.email") },
{ to: "/maintenance", label: t("nav.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">{{ $t("shell.badge") }}</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
? $t("shell.superadmin")
: $t("shell.adminOf", { org: currentUser.organizationName || $t("shell.noOrganization") })
}}
</div>
<label class="mt-2 flex items-center gap-2 text-ui-sm text-ink-muted">
<span class="sr-only">{{ $t("common.language") }}</span>
<select
v-model="language"
class="dw-input h-control-sm min-w-0 flex-1"
data-testid="admin-language"
@change="pickLanguage"
>
<option value="">{{ $t("common.browserLanguage") }}</option>
<option v-for="l in supportedLocales" :key="l" :value="l">{{ localeNames[l] }}</option>
</select>
</label>
<DwButton variant="ghost" size="sm" icon="sign-out" class="mt-2 -ml-2" @click="logout">{{
$t("shell.signOut")
}}</DwButton>
</div>
</aside>
<main class="min-w-0 flex-1 bg-surface p-4 sm:p-8">
<RouterView />
</main>
</div>
</template>