diff --git a/src/app/dashboard/dashboard.tsx b/src/app/dashboard/dashboard.tsx index bc6edb4..c053436 100644 --- a/src/app/dashboard/dashboard.tsx +++ b/src/app/dashboard/dashboard.tsx @@ -33,6 +33,7 @@ export default function DashboardSidebar() { const [status, setStatus] = useState<"loading" | "ready" | "error">("loading"); const [error, setError] = useState(""); const [collapsed, setCollapsed] = useState(false); + const [accountAnchor, setAccountAnchor] = useState<"sidebar" | "floating">("sidebar"); const [query, setQuery] = useState(""); const [creating, setCreating] = useState(false); const [panel, setPanel] = useState<"settings" | "workspace" | null>(null); @@ -172,13 +173,13 @@ export default function DashboardSidebar() { return ( <> - {collapsed && ( - - toggleSidebar(false)} /> + {collapsed && toggleSidebar(false)} />} -
+
{currentWorkspace?.name || "你的工作空间"}{roleLabel}{demo ? " · 本地演示" : ""}
diff --git a/src/components/workspace/workspace.module.css b/src/components/workspace/workspace.module.css index 4117a4e..4d02d58 100644 --- a/src/components/workspace/workspace.module.css +++ b/src/components/workspace/workspace.module.css @@ -94,7 +94,8 @@ .newWorkspace { color: #2383e2; } .logout { color: #78746d; font-size: 12px; } .separator { height: 1px; margin: 6px 7px; background: #eeece8; } -.floating { position: fixed; left: 12px; top: 12px; max-width: calc(100vw - 24px); z-index: 40; } +.floating { --floating-left: 12px; position: fixed; left: var(--floating-left); top: 12px; max-width: calc(100vw - var(--floating-left) - 12px); z-index: 40; transition: left 240ms cubic-bezier(0.22, 1, 0.36, 1), max-width 240ms cubic-bezier(0.22, 1, 0.36, 1); } +.floating[data-sidebar-collapsed="false"], .accountPopup[data-sidebar-collapsed="false"] { --floating-left: calc(min(var(--sidebar-width), calc(100vw - 40px)) + 12px); } .floatingError { position: absolute; left: 0; top: 42px; width: 240px; padding: 10px; background: white; border: 1px solid #e7e2db; border-radius: 8px; color: #b14b3c; font-size: 12px; } .settingsPanel { color: #37352f; border-color: #e6e2dc; border-radius: 12px; } .settingsForm { display: flex; flex-direction: column; gap: 16px; padding-top: 4px; } @@ -119,11 +120,17 @@ .floatingAvatarButton { display: grid; place-items: center; flex: 0 0 auto; box-sizing: border-box; width: var(--toolbar-control-width, 32px); height: var(--toolbar-control-height, 32px); border-radius: 5px; } .floatingAvatarButton:hover { background: #e9e7e3; } -.accountPopup[data-floating="true"] { inset: 62px auto auto 12px; max-height: calc(100dvh - 76px); transform-origin: top left; } +.accountPopup[data-floating="true"] { inset: 62px auto auto clamp(8px, var(--floating-left, 12px), max(8px, calc(100vw - 308px))); max-height: calc(100dvh - 76px); transform-origin: top left; } .floatingAvatarButton .avatar { flex-basis: var(--toolbar-icon-size, 20px); width: var(--toolbar-icon-size, 20px); height: var(--toolbar-icon-size, 20px); font-size: 14px; } .floatingTitle { flex: 1 1 auto; min-width: 0; max-width: 240px; margin: 0; color: #37352f; font-size: 14px; line-height: var(--toolbar-control-height, 32px); font-weight: 500; overflow: visible; } @media (max-width: 700px) { .floatingTitle { max-width: 180px; } } +@media (max-width: 420px) { + .floating[data-sidebar-collapsed="false"] .logoLink, + .floating[data-sidebar-collapsed="false"] .floatingTitle, + .floating[data-sidebar-collapsed="false"] > span[aria-hidden="true"] { display: none; } +} +@media (prefers-reduced-motion: reduce) { .floating { transition: none; } } .directoryList { list-style: none; padding: 0; margin: 0; } .directoryRow { display: flex; align-items: center; min-width: 0; }