fix(ui): make the shared three-part profile the canonical header
This commit is contained in:
@@ -35,7 +35,6 @@ import {
|
||||
ResizableViewport,
|
||||
SceneAnnotation,
|
||||
HeaderNavigation,
|
||||
HeaderProfile,
|
||||
HeaderWorkspace,
|
||||
Icon,
|
||||
IconButton,
|
||||
@@ -2163,7 +2162,6 @@ export function CatalogApp() {
|
||||
}
|
||||
right={
|
||||
<UserProfileMenu
|
||||
variant="header"
|
||||
triggerLabel="Профиль"
|
||||
triggerIcon="inbox"
|
||||
displayName={sessionProfile?.user?.displayName || "Профиль"}
|
||||
|
||||
@@ -15,7 +15,7 @@ export function EnvironmentCatalogDemo() {
|
||||
useEffect(() => () => urls.current.forEach(url => URL.revokeObjectURL(url)), []);
|
||||
return <>
|
||||
<div className="catalog-environment-actions">
|
||||
<UserProfileMenu displayName="DC" subtitle="Каталог компонентов" triggerLabel={null}
|
||||
<UserProfileMenu variant="default" displayName="DC" subtitle="Каталог компонентов" triggerLabel={null}
|
||||
actions={[{ id: "settings", label: "Настройки", icon: "settings", onSelect: () => setOpen(true) }]} />
|
||||
<Button variant="primary" tone="neutral" onClick={() => setOpen(true)}>Настройки окружения</Button>
|
||||
<Button variant="primary" tone="neutral" disabled>Неактивное действие</Button>
|
||||
|
||||
+10
-1
@@ -113,5 +113,14 @@ 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.
|
||||
CMS uses `UserProfileMenu`: profile label, menu icon, avatar.
|
||||
The menu opens settings; the application does not add a fourth action.
|
||||
|
||||
|
||||
Device Core and CMS share the complete `UserProfileMenu` header, not local copies.
|
||||
The reference composition is the existing rounded profile group in Launcher/Hub
|
||||
and Engine (`EnginePlatformHeader.tsx` / `TopBar.tsx`); its reusable geometry is
|
||||
already in AppHeader, HeaderProfileButton, IconButton and HeaderAvatar. The owner
|
||||
confirmed the order profile → inbox → avatar and settings inside the middle
|
||||
icon's menu on 2026-11-05. No application CSS overrides are needed.
|
||||
Device Core retains session identity, profile URL, permissions and logout actions.
|
||||
|
||||
+8
-2
@@ -228,7 +228,13 @@ Pill navigation для верхней панели и компактного п
|
||||
|
||||
## UserProfileMenu
|
||||
|
||||
Каноническая выпадашка профиля для правой группы `AppHeader`. Она использует
|
||||
Каноническая правая группа `AppHeader`: «Профиль» → inbox → аватар.
|
||||
`UserProfileMenu` владеет всей группой, включая `HeaderProfile`; приложение
|
||||
передаёт только identity и действия. Настройки находятся в меню, отдельной
|
||||
шестерёнки после аватара нет. Нельзя добавлять внешнюю обёртку или локальные
|
||||
отступы. Все три элемента открывают меню; Escape возвращает фокус на вызвавшую кнопку.
|
||||
|
||||
Она использует
|
||||
общий portal `Dropdown`, показывает identity cover с аватаром, именем и
|
||||
подписью и принимает список application-owned действий.
|
||||
|
||||
@@ -527,6 +533,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 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.
|
||||
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` 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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ButtonHTMLAttributes, ReactNode } from "react";
|
||||
import type { ButtonHTMLAttributes, ReactNode, Ref } from "react";
|
||||
|
||||
export interface AppHeaderProps {
|
||||
brand: ReactNode;
|
||||
@@ -74,10 +74,11 @@ export function HeaderNavigation<T extends string>({ label, value, items, onChan
|
||||
|
||||
export interface HeaderProfileProps {
|
||||
children: ReactNode;
|
||||
ref?: Ref<HTMLDivElement>;
|
||||
}
|
||||
|
||||
export function HeaderProfile({ children }: HeaderProfileProps) {
|
||||
return <div className="nodedc-header__profile">{children}</div>;
|
||||
export function HeaderProfile({ children, ref }: HeaderProfileProps) {
|
||||
return <div ref={ref} className="nodedc-header__profile">{children}</div>;
|
||||
}
|
||||
|
||||
export interface HeaderProfileButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "className" | "style"> {}
|
||||
|
||||
@@ -16,7 +16,7 @@ export interface UserProfileMenuAction {
|
||||
|
||||
export interface UserProfileMenuProps {
|
||||
displayName: string;
|
||||
/** Canonical profile label, independent menu icon, then avatar. Owns HeaderProfile. */
|
||||
/** Header is canonical. "default" retains the legacy compact trigger outside headers. */
|
||||
variant?: "default" | "header";
|
||||
subtitle?: string;
|
||||
avatarUrl?: string;
|
||||
@@ -29,7 +29,7 @@ export interface UserProfileMenuProps {
|
||||
|
||||
export function UserProfileMenu({
|
||||
displayName,
|
||||
variant = "default",
|
||||
variant = "header",
|
||||
subtitle,
|
||||
avatarUrl,
|
||||
coverImageUrl,
|
||||
@@ -45,19 +45,22 @@ export function UserProfileMenu({
|
||||
offset={10}
|
||||
surfaceClassName="nodedc-user-profile-menu"
|
||||
trigger={({ open, toggle, setTriggerRef, setAnchorRef, surfaceId }) => variant === "header" ? (
|
||||
<HeaderProfile>
|
||||
<HeaderProfileButton aria-haspopup="menu" aria-expanded={open} aria-controls={surfaceId} onClick={toggle}>
|
||||
<HeaderProfile ref={setAnchorRef}>
|
||||
<HeaderProfileButton aria-haspopup="menu" aria-expanded={open} aria-controls={surfaceId} onClick={(event) => { setTriggerRef(event.currentTarget); toggle(); }}>
|
||||
{triggerLabel ?? "Профиль"}
|
||||
</HeaderProfileButton>
|
||||
<IconButton
|
||||
ref={(node) => { setTriggerRef(node); setAnchorRef(node); }}
|
||||
ref={setTriggerRef}
|
||||
label={`Меню пользователя ${label}`}
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={open}
|
||||
aria-controls={surfaceId}
|
||||
onClick={toggle}
|
||||
onClick={(event) => { setTriggerRef(event.currentTarget); toggle(); }}
|
||||
><Icon name={triggerIcon ?? "inbox"} size={20} strokeWidth={1.7} /></IconButton>
|
||||
<HeaderAvatar label={label} imageUrl={avatarUrl} />
|
||||
<button type="button" className="nodedc-user-profile-menu__trigger" aria-label={`Профиль ${label}`} aria-haspopup="menu" aria-expanded={open} aria-controls={surfaceId}
|
||||
onClick={(event) => { setTriggerRef(event.currentTarget); toggle(); }}>
|
||||
<HeaderAvatar label={label} imageUrl={avatarUrl} />
|
||||
</button>
|
||||
</HeaderProfile>
|
||||
) : (
|
||||
<button
|
||||
|
||||
@@ -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.",
|
||||
"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."
|
||||
"The default 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."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user