<!-- SPEC: PJ2026-010405 云端控制台. -->
<script setup lang="ts">
import { computed } from "vue";
import PageCommandBar from "@/components/layout/PageCommandBar.vue";
import SettingsWorkspace from "@/components/settings/SettingsWorkspace.vue";
import { useAppStore } from "@/stores/app";
import { useAuthStore } from "@/stores/auth";

const app = useAppStore();
const auth = useAuthStore();
const reducedMotion = computed(() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches);
const identityName = computed(() => auth.user?.displayName || auth.user?.username || auth.user?.name || "HWLAB 用户");
const sidebarCollapsed = computed({ get: () => app.sidebarCollapsed, set: (value: boolean) => { app.sidebarCollapsed = value; } });
</script>

<template>
  <section class="route-stack settings-page">
    <PageCommandBar eyebrow="System" title="设置" description="管理当前控制台的显示上下文；Provider 与 Workbench 运行参数继续由各自公共入口拥有。" />
    <SettingsWorkspace v-model:sidebar-collapsed="sidebarCollapsed" :identity-name="identityName" :role="auth.user?.role || 'member'" :reduced-motion="reducedMotion" :is-admin="auth.isAdmin" />
  </section>
</template>
