fix(ui): make the shared three-part profile the canonical header
This commit is contained in:
@@ -35,7 +35,6 @@ import {
|
|||||||
ResizableViewport,
|
ResizableViewport,
|
||||||
SceneAnnotation,
|
SceneAnnotation,
|
||||||
HeaderNavigation,
|
HeaderNavigation,
|
||||||
HeaderProfile,
|
|
||||||
HeaderWorkspace,
|
HeaderWorkspace,
|
||||||
Icon,
|
Icon,
|
||||||
IconButton,
|
IconButton,
|
||||||
@@ -2163,7 +2162,6 @@ export function CatalogApp() {
|
|||||||
}
|
}
|
||||||
right={
|
right={
|
||||||
<UserProfileMenu
|
<UserProfileMenu
|
||||||
variant="header"
|
|
||||||
triggerLabel="Профиль"
|
triggerLabel="Профиль"
|
||||||
triggerIcon="inbox"
|
triggerIcon="inbox"
|
||||||
displayName={sessionProfile?.user?.displayName || "Профиль"}
|
displayName={sessionProfile?.user?.displayName || "Профиль"}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export function EnvironmentCatalogDemo() {
|
|||||||
useEffect(() => () => urls.current.forEach(url => URL.revokeObjectURL(url)), []);
|
useEffect(() => () => urls.current.forEach(url => URL.revokeObjectURL(url)), []);
|
||||||
return <>
|
return <>
|
||||||
<div className="catalog-environment-actions">
|
<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) }]} />
|
actions={[{ id: "settings", label: "Настройки", icon: "settings", onSelect: () => setOpen(true) }]} />
|
||||||
<Button variant="primary" tone="neutral" onClick={() => setOpen(true)}>Настройки окружения</Button>
|
<Button variant="primary" tone="neutral" onClick={() => setOpen(true)}>Настройки окружения</Button>
|
||||||
<Button variant="primary" tone="neutral" disabled>Неактивное действие</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
|
credentials stay in the existing CMS model. Immutable npm snapshots retain
|
||||||
package semver and are identified by source commit plus archive SHA-256.
|
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.
|
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
|
## UserProfileMenu
|
||||||
|
|
||||||
Каноническая выпадашка профиля для правой группы `AppHeader`. Она использует
|
Каноническая правая группа `AppHeader`: «Профиль» → inbox → аватар.
|
||||||
|
`UserProfileMenu` владеет всей группой, включая `HeaderProfile`; приложение
|
||||||
|
передаёт только identity и действия. Настройки находятся в меню, отдельной
|
||||||
|
шестерёнки после аватара нет. Нельзя добавлять внешнюю обёртку или локальные
|
||||||
|
отступы. Все три элемента открывают меню; Escape возвращает фокус на вызвавшую кнопку.
|
||||||
|
|
||||||
|
Она использует
|
||||||
общий portal `Dropdown`, показывает identity cover с аватаром, именем и
|
общий portal `Dropdown`, показывает identity cover с аватаром, именем и
|
||||||
подписью и принимает список application-owned действий.
|
подписью и принимает список application-owned действий.
|
||||||
|
|
||||||
@@ -527,6 +533,6 @@ Window: `rect` / `onRectCommit` — восстановление и фиксац
|
|||||||
|
|
||||||
## Flat surface profile and profile trigger
|
## 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.
|
`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 {
|
export interface AppHeaderProps {
|
||||||
brand: ReactNode;
|
brand: ReactNode;
|
||||||
@@ -74,10 +74,11 @@ export function HeaderNavigation<T extends string>({ label, value, items, onChan
|
|||||||
|
|
||||||
export interface HeaderProfileProps {
|
export interface HeaderProfileProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
|
ref?: Ref<HTMLDivElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function HeaderProfile({ children }: HeaderProfileProps) {
|
export function HeaderProfile({ children, ref }: HeaderProfileProps) {
|
||||||
return <div className="nodedc-header__profile">{children}</div>;
|
return <div ref={ref} className="nodedc-header__profile">{children}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HeaderProfileButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "className" | "style"> {}
|
export interface HeaderProfileButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "className" | "style"> {}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export interface UserProfileMenuAction {
|
|||||||
|
|
||||||
export interface UserProfileMenuProps {
|
export interface UserProfileMenuProps {
|
||||||
displayName: string;
|
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";
|
variant?: "default" | "header";
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
avatarUrl?: string;
|
avatarUrl?: string;
|
||||||
@@ -29,7 +29,7 @@ export interface UserProfileMenuProps {
|
|||||||
|
|
||||||
export function UserProfileMenu({
|
export function UserProfileMenu({
|
||||||
displayName,
|
displayName,
|
||||||
variant = "default",
|
variant = "header",
|
||||||
subtitle,
|
subtitle,
|
||||||
avatarUrl,
|
avatarUrl,
|
||||||
coverImageUrl,
|
coverImageUrl,
|
||||||
@@ -45,19 +45,22 @@ export function UserProfileMenu({
|
|||||||
offset={10}
|
offset={10}
|
||||||
surfaceClassName="nodedc-user-profile-menu"
|
surfaceClassName="nodedc-user-profile-menu"
|
||||||
trigger={({ open, toggle, setTriggerRef, setAnchorRef, surfaceId }) => variant === "header" ? (
|
trigger={({ open, toggle, setTriggerRef, setAnchorRef, surfaceId }) => variant === "header" ? (
|
||||||
<HeaderProfile>
|
<HeaderProfile ref={setAnchorRef}>
|
||||||
<HeaderProfileButton aria-haspopup="menu" aria-expanded={open} aria-controls={surfaceId} onClick={toggle}>
|
<HeaderProfileButton aria-haspopup="menu" aria-expanded={open} aria-controls={surfaceId} onClick={(event) => { setTriggerRef(event.currentTarget); toggle(); }}>
|
||||||
{triggerLabel ?? "Профиль"}
|
{triggerLabel ?? "Профиль"}
|
||||||
</HeaderProfileButton>
|
</HeaderProfileButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
ref={(node) => { setTriggerRef(node); setAnchorRef(node); }}
|
ref={setTriggerRef}
|
||||||
label={`Меню пользователя ${label}`}
|
label={`Меню пользователя ${label}`}
|
||||||
aria-haspopup="menu"
|
aria-haspopup="menu"
|
||||||
aria-expanded={open}
|
aria-expanded={open}
|
||||||
aria-controls={surfaceId}
|
aria-controls={surfaceId}
|
||||||
onClick={toggle}
|
onClick={(event) => { setTriggerRef(event.currentTarget); toggle(); }}
|
||||||
><Icon name={triggerIcon ?? "inbox"} size={20} strokeWidth={1.7} /></IconButton>
|
><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>
|
</HeaderProfile>
|
||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -670,7 +670,7 @@
|
|||||||
"The component owns menu geometry and profile presentation; the application owns settings, profile and logout actions.",
|
"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.",
|
"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.",
|
"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