fix(ui): compose canonical three-part profile header

This commit is contained in:
DCCONSTRUCTIONS
2026-11-05 12:51:53 +03:00
parent 8addef187b
commit fdc93a3136
5 changed files with 27 additions and 7 deletions
+1 -3
View File
@@ -2162,9 +2162,8 @@ export function CatalogApp() {
</>
}
right={
<HeaderProfile>
<IconButton label="Уведомления"><Icon name="inbox" size={20} strokeWidth={1.7} /></IconButton>
<UserProfileMenu
variant="header"
triggerLabel="Профиль"
triggerIcon="inbox"
displayName={sessionProfile?.user?.displayName || "Профиль"}
@@ -2176,7 +2175,6 @@ export function CatalogApp() {
{ id: "logout", label: "Выйти", icon: "external", href: "/auth/logout" },
]}
/>
</HeaderProfile>
}
/>
}
+3
View File
@@ -112,3 +112,6 @@ ColorField, pill-shaped split Select, and the canonical six-dot DragHandle.
UI preferences belong to browser-local storage; site content and deployment
credentials stay in the existing CMS model. Immutable npm snapshots retain
package semver and are identified by source commit plus archive SHA-256.
CMS uses `UserProfileMenu variant="header"`: profile label, menu icon, avatar.
The menu opens settings; the application does not add a fourth action.
+1 -1
View File
@@ -527,6 +527,6 @@ Window: `rect` / `onRectCommit` — восстановление и фиксац
## Flat surface profile and profile trigger
The shared theme supports `edges: "flat"` for borderless surfaces, including portal windows. Keyboard focus changes the fill and foreground instead of adding an outline. The living catalog exposes this alongside the Mission appearance switch. `UserProfileMenu.triggerIcon` accepts a canonical icon between the label and avatar; CMS uses `triggerLabel="Профиль"` and `triggerIcon="inbox"`, followed by a separate settings IconButton.
The shared theme supports `edges: "flat"` for borderless surfaces, including portal windows. Keyboard focus changes the fill and foreground instead of adding an outline. The living catalog exposes this alongside the Mission appearance switch. `UserProfileMenu variant="header"` composes the canonical profile label, independent inbox/menu button and avatar. CMS puts settings inside that menu. No additional settings button or HeaderProfile wrapper is needed; spacing comes from existing HeaderProfileButton and IconButton geometry.
`Select variant="split" shape="pill"` aligns a compact workspace/site selector with adjacent round actions, preserving the shared dimensions and keyboard behavior.
+21 -2
View File
@@ -1,6 +1,7 @@
import type { ReactNode } from "react";
import { Dropdown } from "./Dropdown.js";
import { HeaderAvatar } from "./AppHeader.js";
import { HeaderAvatar, HeaderProfile, HeaderProfileButton } from "./AppHeader.js";
import { IconButton } from "./Button.js";
import { Icon, type IconName } from "./Icon.js";
export interface UserProfileMenuAction {
@@ -15,6 +16,8 @@ export interface UserProfileMenuAction {
export interface UserProfileMenuProps {
displayName: string;
/** Canonical profile label, independent menu icon, then avatar. Owns HeaderProfile. */
variant?: "default" | "header";
subtitle?: string;
avatarUrl?: string;
coverImageUrl?: string;
@@ -26,6 +29,7 @@ export interface UserProfileMenuProps {
export function UserProfileMenu({
displayName,
variant = "default",
subtitle,
avatarUrl,
coverImageUrl,
@@ -40,7 +44,22 @@ export function UserProfileMenu({
width={296}
offset={10}
surfaceClassName="nodedc-user-profile-menu"
trigger={({ open, toggle, setTriggerRef, surfaceId }) => (
trigger={({ open, toggle, setTriggerRef, setAnchorRef, surfaceId }) => variant === "header" ? (
<HeaderProfile>
<HeaderProfileButton aria-haspopup="menu" aria-expanded={open} aria-controls={surfaceId} onClick={toggle}>
{triggerLabel ?? "Профиль"}
</HeaderProfileButton>
<IconButton
ref={(node) => { setTriggerRef(node); setAnchorRef(node); }}
label={`Меню пользователя ${label}`}
aria-haspopup="menu"
aria-expanded={open}
aria-controls={surfaceId}
onClick={toggle}
><Icon name={triggerIcon ?? "inbox"} size={20} strokeWidth={1.7} /></IconButton>
<HeaderAvatar label={label} imageUrl={avatarUrl} />
</HeaderProfile>
) : (
<button
ref={setTriggerRef}
type="button"
+1 -1
View File
@@ -670,7 +670,7 @@
"The component owns menu geometry and profile presentation; the application owns settings, profile and logout actions.",
"Use the existing Dropdown engine so the menu is never clipped by the fixed application header.",
"Do not embed product permissions or sharing rules in the visual menu.",
"Optional triggerIcon places a shared glyph between triggerLabel and the session avatar; adjacent application settings stay a separate IconButton."
"variant=header composes HeaderProfileButton, an independent menu IconButton and HeaderAvatar using the existing header geometry. Application settings belong inside this menu; do not add an adjacent settings button or another HeaderProfile wrapper."
]
},
{