From 0b958135d1017ab5873e106ed0a3ba99f5745ab5 Mon Sep 17 00:00:00 2001 From: Bob Lee Date: Tue, 3 Nov 2026 11:26:09 +0800 Subject: [PATCH 1/4] feat(web-ui): redesign the device overview popover The popover had a fixed golden-ratio height, so the hero artwork was cropped, the connected-device list was cut off, and a scrollbar appeared whose gutter differs between macOS, Windows and Linux. The card now sizes to its content and only the device list scrolls. The whole card is lit by the displayed device's state (local, available, in use, incompatible) and cross-fades between devices. Titles and status words are drawn instead of written: the system mark before the name, a pulsing dot for in use, a house mark for this device, and a round icon action whose words move to the tooltip and accessible name. The info row has a fixed height so browsing devices never resizes the anchored popover, which previously repositioned a frame late and jumped. The heading mark shares the device rows' icon column so marks and names line up. The device silhouettes no longer bake in 20% opacity, so CSS controls their tone in light and dark themes. --- .../src/app/components/NavPanel/NavPanel.scss | 417 +++++++++++------- .../app/components/NavPanel/assets/device.svg | 2 +- .../components/NavPanel/assets/harmonyos.svg | 4 +- .../app/components/NavPanel/assets/linux.svg | 4 +- .../app/components/NavPanel/assets/macos.svg | 4 +- .../app/components/NavPanel/assets/server.svg | 2 +- .../components/NavPanel/assets/windows.svg | 4 +- .../components/DeviceStatusControl.test.tsx | 74 ++-- .../components/DeviceStatusControl.tsx | 108 +++-- 9 files changed, 381 insertions(+), 238 deletions(-) diff --git a/src/web-ui/src/app/components/NavPanel/NavPanel.scss b/src/web-ui/src/app/components/NavPanel/NavPanel.scss index 510cfe2903..7fdf4d6a1c 100644 --- a/src/web-ui/src/app/components/NavPanel/NavPanel.scss +++ b/src/web-ui/src/app/components/NavPanel/NavPanel.scss @@ -1561,29 +1561,69 @@ $_section-header-height: 22px; // Device overview — one compact model, local and connected states // ────────────────────────────────────────────── +// The light that fills the card is the displayed device's state; registering it +// lets the whole surface cross-fade between devices instead of snapping. +@property --_device-overview-light { + syntax: ''; + inherits: true; + initial-value: transparent; +} + .openbitfun-device-overview { - --_device-overview-inline-size: min(360px, calc(100vw - 16px), calc((100vh - 16px) * 1.618)); - // Keep the management circle concentric with the card's outer corner. - --_device-overview-header-icon-size: calc(var(--openbitfun-control-icon-size-md) + var(--openbitfun-space-1)); - --_device-overview-management-inset: max(var(--openbitfun-space-1), calc(var(--openbitfun-layout-card-radius-lg) - var(--openbitfun-border-width-default) - var(--openbitfun-control-height-sm) / 2)); - --_device-overview-edge-fade-extent: calc(var(--_device-overview-management-inset) + (var(--openbitfun-control-height-sm) - var(--_device-overview-header-icon-size)) / 2); + // The card sizes to its content, so the artwork, name, action and device list + // always render whole. Only the device list scrolls, and only when the window + // is too short; the same box therefore lays out identically whether the host + // draws overlay (macOS) or gutter (Windows, Linux) scrollbars. + --_device-overview-inline-size: min(312px, calc(100vw - 16px)); + --_device-overview-stage-size: 120px; + --_device-overview-inset: var(--openbitfun-space-4); + --_device-overview-light: var(--openbitfun-color-accent-default); + --_device-overview-light-strength: 16%; position: fixed; z-index: var(--openbitfun-layer-popover); width: var(--_device-overview-inline-size); - height: calc(var(--_device-overview-inline-size) / 1.618); min-height: 0; max-height: calc(100vh - 16px); display: flex; flex-direction: column; box-sizing: border-box; + background: + radial-gradient( + 120% 78% at 50% 0%, + color-mix(in srgb, var(--_device-overview-light) var(--_device-overview-light-strength), transparent), + transparent 74% + ), + radial-gradient( + 90% 55% at 100% 100%, + color-mix(in srgb, var(--_device-overview-light) calc(var(--_device-overview-light-strength) / 3), transparent), + transparent 70% + ), + var(--openbitfun-color-surface-raised); + transition: --_device-overview-light var(--openbitfun-motion-duration-slow) var(--openbitfun-motion-easing-standard); animation: openbitfun-nav-popover-in 150ms cubic-bezier(0.23, 1, 0.32, 1) both; + + :where([data-color-scheme='dark']) & { + --_device-overview-light-strength: 26%; + } + + &[data-control-state='local'] { + --_device-overview-light: var(--openbitfun-color-accent-secondary); + } + + &[data-control-state='active'] { + --_device-overview-light: var(--openbitfun-color-status-success-content); + } + + &[data-control-state='incompatible'] { + --_device-overview-light: var(--openbitfun-color-status-warning-content); + } } .openbitfun-device-overview__scroll { - // Keep the hero stable while additional controllers and task hosts scroll. display: block; min-height: 0; - flex: 1 1 0; + max-height: calc(var(--openbitfun-control-height-md) * 5); + flex: 1 1 auto; } .openbitfun-device-overview__current { @@ -1709,83 +1749,76 @@ $_section-header-height: 22px; color: var(--openbitfun-color-status-warning-content); } -.openbitfun-device-overview__notice { - position: absolute; - inset-block-start: var(--openbitfun-space-1); - inset-inline-start: var(--openbitfun-space-5); - z-index: 2; -} - @keyframes openbitfun-device-overview-spin { to { transform: rotate(360deg); } } +// No title: the header is only the corner tools, floating over the stage. .openbitfun-device-overview__header { - flex-shrink: 0; - padding: var(--_device-overview-management-inset) var(--_device-overview-management-inset) var(--openbitfun-space-1); + position: absolute; + inset-block-start: var(--openbitfun-space-2); + inset-inline-end: var(--openbitfun-space-2); + z-index: 2; + padding: 0; - > [data-openbitfun-part='header-content'] { flex: 1 1 0; } + > [data-openbitfun-part='header-content'] { display: none; } > [data-openbitfun-part='actions'] { flex: 0 0 auto; } } -.openbitfun-device-overview__device-details { - position: relative; - display: flex; - align-items: center; - justify-content: center; - gap: var(--openbitfun-space-2); - min-width: 0; - width: 100%; - box-sizing: border-box; - // Reserve equal, fixed-width navigation slots so names never move on hover. - padding-inline: calc(var(--openbitfun-space-5) + var(--openbitfun-control-height-sm) + var(--openbitfun-space-2)); -} - .openbitfun-device-overview__header-actions { display: flex; align-items: center; justify-content: flex-end; - gap: var(--openbitfun-space-2); + gap: var(--openbitfun-space-1); min-width: 0; - width: 100%; } -.openbitfun-device-overview__manage-devices > [data-openbitfun-part='icon'] { - inline-size: var(--_device-overview-header-icon-size); - block-size: var(--_device-overview-header-icon-size); +.openbitfun-device-overview__manage-devices { + color: var(--openbitfun-color-content-secondary); + + &:is(:hover, :focus-visible) { + color: var(--openbitfun-color-content-primary); + } } .openbitfun-device-overview__body { min-width: 0; - height: 100%; + min-height: 0; + flex: 1 1 auto; padding: 0; display: flex; flex-direction: column; } +// The hero is the artwork with its arrows and page dots on the lit card, then +// one information row: system mark, name and state mark, then the action. .openbitfun-device-overview__summary { position: relative; display: grid; - grid-template-rows: minmax(0, 1fr) auto auto; - gap: var(--openbitfun-space-2); + grid-template-columns: minmax(0, 1fr) auto; + // Both rows are fixed: every device, with or without an action, yields the + // same card height, so browsing never resizes the anchored popover (a resize + // repositions it a frame late, which reads as a jump). + grid-template-rows: var(--_device-overview-stage-size) var(--openbitfun-control-height-md); + align-items: center; + column-gap: var(--openbitfun-space-3); + row-gap: var(--openbitfun-space-3); flex-shrink: 0; min-width: 0; - height: 100%; - padding-block-end: var(--openbitfun-space-4); + padding: var(--openbitfun-space-3) var(--openbitfun-space-3) var(--_device-overview-inset); box-sizing: border-box; - // Fill the remaining height without shrinking when extra devices are listed. - margin-block: auto; text-align: start; } .openbitfun-device-overview__carousel-viewport { - grid-area: 1 / 1; + grid-column: 1 / -1; position: relative; min-width: 0; overflow: hidden; width: 100%; + height: var(--_device-overview-stage-size); } .openbitfun-device-overview__device-scene { @@ -1795,10 +1828,48 @@ $_section-header-height: 22px; height: 100%; } +.openbitfun-device-overview__page-dots { + position: absolute; + inset-block-end: var(--openbitfun-space-2); + inset-inline: 0; + display: flex; + justify-content: center; + align-items: center; + gap: var(--openbitfun-space-1); + pointer-events: none; +} + +.openbitfun-device-overview__page-dot { + inline-size: 5px; + block-size: 5px; + border-radius: var(--openbitfun-radius-pill); + background: color-mix(in srgb, var(--openbitfun-color-content-primary) 22%, transparent); + transition: + inline-size var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard), + background-color var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard); + + &[data-active='true'] { + inline-size: 14px; + background: var(--openbitfun-color-content-secondary); + } +} + +.openbitfun-device-overview__device-details { + grid-column: 1; + display: flex; + flex-direction: column; + align-items: flex-start; + min-width: 0; + width: 100%; + box-sizing: border-box; +} + +// The arrows sit inside the stage tile's edges, so the name keeps its width. .openbitfun-device-overview__carousel-controls { position: absolute; - inset-block: 0; - inset-inline: var(--openbitfun-space-5); + inset-block-start: var(--openbitfun-space-3); + inset-inline: var(--openbitfun-space-3); + block-size: var(--_device-overview-stage-size); display: flex; align-items: center; justify-content: space-between; @@ -1809,14 +1880,20 @@ $_section-header-height: 22px; flex: 0 0 var(--openbitfun-control-height-sm); pointer-events: auto; color: var(--openbitfun-color-content-secondary); + background: color-mix(in srgb, var(--openbitfun-color-surface-raised) 58%, transparent); + box-shadow: inset 0 0 0 var(--openbitfun-border-width-default) var(--openbitfun-color-border-subtle); + transition: + color var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard), + background-color var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard); > [data-openbitfun-part='icon'] { - inline-size: var(--openbitfun-control-icon-size-md); - block-size: var(--openbitfun-control-icon-size-md); + inline-size: var(--openbitfun-control-icon-size-sm); + block-size: var(--openbitfun-control-icon-size-sm); } &:is(:hover, :focus-visible):not(:disabled) { color: var(--openbitfun-color-content-primary); + background: var(--openbitfun-color-surface-raised); } &:disabled { @@ -1824,107 +1901,64 @@ $_section-header-height: 22px; } } -@media (hover: hover) and (pointer: fine) { - .openbitfun-device-overview__carousel-controls { - opacity: 0; - } - - .openbitfun-device-overview__carousel-button { - pointer-events: none; - } - - .openbitfun-device-overview:hover, - .openbitfun-device-overview:has(.openbitfun-device-overview__carousel-button:focus-visible) { - .openbitfun-device-overview__carousel-controls { - opacity: 1; - } - - .openbitfun-device-overview__carousel-button { - pointer-events: auto; - } - } -} - .openbitfun-device-overview__pagination-index { display: inline-block; text-align: end; } +// The page dots draw position; the numeric pager stays for assistive tech. .openbitfun-device-overview__pagination { - flex: 0 0 auto; - min-width: 4ch; - color: var(--openbitfun-color-content-secondary); - font-family: var(--openbitfun-type-label-lg-font-family); - font-size: var(--openbitfun-type-label-lg-font-size); - font-weight: var(--openbitfun-type-label-lg-font-weight); - line-height: var(--openbitfun-type-label-lg-line-height); - letter-spacing: var(--openbitfun-type-label-lg-letter-spacing); + position: absolute; + inline-size: 1px; + block-size: 1px; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; font-variant-numeric: tabular-nums; - text-align: center; } .openbitfun-device-overview__artwork { - // Align the fade start with the header management glyph's right edge. - // Using the card width also accounts for a native scrollbar in the body. - --_device-overview-artwork-mask: linear-gradient( - to right, - var(--openbitfun-color-content-on-light) 0, - var(--openbitfun-color-content-on-light) calc(var(--_device-overview-inline-size) - var(--openbitfun-border-width-default) * 2 - var(--_device-overview-edge-fade-extent)), - transparent 100% - ); display: grid; position: absolute; - // The artwork row ends above the device details and action rows. - inset-block-start: var(--openbitfun-space-2); - inset-block-end: 0; - inset-inline-start: 0; + inset: 0; width: 100%; overflow: hidden; place-items: center; background: transparent; - isolation: isolate; - -webkit-mask-image: var(--_device-overview-artwork-mask); - mask-image: var(--_device-overview-artwork-mask); - mask-mode: alpha; - -webkit-mask-repeat: no-repeat; - mask-repeat: no-repeat; > img { position: absolute; - z-index: 1; - inset-block-start: 50%; + inset-block-start: 46%; inset-inline-start: 50%; width: auto; - height: 100%; + height: 78%; max-width: none; object-fit: contain; transform: translate(-50%, -50%); } } -@media (forced-colors: active) { - .openbitfun-device-overview__artwork { - -webkit-mask-image: none; - mask-image: none; - } -} - +// A soft top-lit fill reads as a material rather than a flat cut-out. .openbitfun-device-overview__artwork-glyph { position: relative; - z-index: 1; justify-self: center; width: auto; - height: 100%; + height: 56%; + margin-block-end: var(--openbitfun-space-2); aspect-ratio: 140 / 78; - background: var(--openbitfun-color-content-primary); + background: linear-gradient( + to bottom, + color-mix(in srgb, var(--openbitfun-color-content-primary) 72%, transparent), + color-mix(in srgb, var(--openbitfun-color-content-primary) 42%, transparent) + ); mask: url('./assets/device.svg') center / contain no-repeat; } // A headless host is drawn, not a system: the row mark's three rack units, which // are a tall stack where every other artwork here is a landscape laptop. It takes -// less of the width and more of the height instead, so it carries the same weight -// in the compact artwork as the silhouettes beside it. +// more of the stage height instead, so it carries the same weight as the laptops. .openbitfun-device-overview__artwork[data-artwork='server'] .openbitfun-device-overview__artwork-glyph { + height: 60%; aspect-ratio: 24 / 29.4629; mask-image: url('./assets/server.svg'); } @@ -1949,23 +1983,60 @@ $_section-header-height: 22px; .openbitfun-device-overview__device-heading { display: flex; - flex: 0 1 auto; align-items: center; - min-height: var(--openbitfun-control-height-sm); + max-width: 100%; min-width: 0; - gap: var(--openbitfun-space-1); + min-height: var(--openbitfun-control-height-sm); + gap: var(--openbitfun-space-2); } -.openbitfun-device-overview__device-actions { - padding-inline: var(--openbitfun-space-5); - display: flex; +// The heading mark shares the device rows' icon column (box, glyph size and +// gap) so marks and names line up down the whole card. +.openbitfun-device-overview__device-mark { + display: inline-flex; + flex: 0 0 auto; align-items: center; justify-content: center; - gap: var(--openbitfun-space-2); - min-height: var(--openbitfun-control-height-sm); - min-width: 0; - box-sizing: border-box; - text-align: center; + inline-size: 24px; + block-size: 24px; + color: var(--openbitfun-color-content-primary); +} + +// In use is drawn as a live signal: a dot with a ring that breathes out. +.openbitfun-device-overview__usage-badge { + position: relative; + flex: 0 0 auto; + inline-size: var(--openbitfun-space-2); + block-size: var(--openbitfun-space-2); + border-radius: var(--openbitfun-radius-pill); + background: var(--openbitfun-color-status-success-content); + + &::after { + content: ''; + position: absolute; + inset: 0; + border-radius: inherit; + background: inherit; + animation: openbitfun-device-overview-live 1.8s var(--openbitfun-motion-easing-decelerate) infinite; + } +} + +@keyframes openbitfun-device-overview-live { + from { + opacity: 0.6; + transform: scale(1); + } + + to { + opacity: 0; + transform: scale(2.6); + } +} + +.openbitfun-device-overview__local-mark { + display: inline-flex; + flex: 0 0 auto; + color: var(--openbitfun-color-content-muted); } .openbitfun-device-overview__device-name { @@ -1973,59 +2044,82 @@ $_section-header-height: 22px; max-width: 100%; min-width: 0; color: var(--openbitfun-color-content-primary); - font-family: var(--openbitfun-type-body-md-font-family); - font-size: var(--openbitfun-type-body-md-font-size); - font-weight: var(--openbitfun-type-body-md-font-weight); - line-height: var(--openbitfun-type-body-md-line-height); - letter-spacing: var(--openbitfun-type-body-md-letter-spacing); + font-family: var(--openbitfun-type-heading-card-font-family); + font-size: var(--openbitfun-type-heading-card-font-size); + font-weight: var(--openbitfun-type-heading-card-font-weight); + line-height: var(--openbitfun-type-heading-card-line-height); + letter-spacing: var(--openbitfun-type-heading-card-letter-spacing); } -.openbitfun-device-overview__device-status { +.openbitfun-device-overview__device-actions { + grid-column: 2; display: flex; - flex: 0 1 auto; align-items: center; + justify-content: flex-end; gap: var(--openbitfun-space-2); min-height: var(--openbitfun-control-height-sm); min-width: 0; - color: var(--openbitfun-color-content-muted); - font-family: var(--openbitfun-type-meta-font-family); - font-size: var(--openbitfun-type-meta-font-size); - line-height: var(--openbitfun-type-meta-line-height); + max-width: 168px; + box-sizing: border-box; } -.openbitfun-device-overview__connection-status { +.openbitfun-device-overview__device-status { + display: flex; + flex: 0 1 auto; + align-items: center; + min-width: 0; max-width: 100%; } -.openbitfun-device-overview__usage-badge { +// The action is one round button lit by the same state light as the card: a +// tinted glass disc with a ring. Disconnecting is neutral rather than wearing +// the green of the link it ends. +.openbitfun-device-overview__connection-status { + --_device-overview-action-tone: var(--_device-overview-light); + --_icon-button-size: var(--openbitfun-control-height-md); + --_icon-button-icon-size: 16px; + --_icon-button-content: color-mix(in srgb, var(--_device-overview-action-tone) 72%, var(--openbitfun-color-content-primary)); + --_icon-button-background: color-mix(in srgb, var(--_device-overview-action-tone) 16%, transparent); + --_icon-button-background-hover: color-mix(in srgb, var(--_device-overview-action-tone) 26%, transparent); + --_icon-button-background-active: color-mix(in srgb, var(--_device-overview-action-tone) 32%, transparent); flex: 0 0 auto; -} + border-radius: var(--openbitfun-radius-pill); + box-shadow: inset 0 0 0 var(--openbitfun-border-width-default) color-mix(in srgb, var(--_device-overview-action-tone) 30%, transparent); + transition: box-shadow var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard); -.openbitfun-device-overview__device-group { - margin: var(--openbitfun-space-3) var(--openbitfun-space-4) 0; + &:is(:hover, :focus-visible):not(:disabled) { + box-shadow: inset 0 0 0 var(--openbitfun-border-width-default) color-mix(in srgb, var(--_device-overview-action-tone) 48%, transparent); + } - h3 { - margin: 0 6px 7px; - color: var(--openbitfun-color-content-muted); - font-size: var(--openbitfun-type-micro-font-size); - font-weight: var(--openbitfun-type-label-selected-font-weight); - line-height: var(--openbitfun-type-meta-line-height); + [data-control-state='active'] > & { + --_device-overview-action-tone: var(--openbitfun-color-content-secondary); } } +.openbitfun-device-overview__device-group { + display: flex; + flex-direction: column; + min-height: 0; + flex: 1 1 auto; + // Group inset plus row inset equals the summary inset, so row icons and the + // heading mark share one column. + padding: var(--openbitfun-space-2) var(--openbitfun-space-1); + border-top: var(--openbitfun-border-width-default) solid var(--openbitfun-color-border-subtle); +} + .openbitfun-device-overview__device-rows { display: flex; flex-direction: column; - gap: var(--openbitfun-space-2); + gap: 0; } .openbitfun-device-overview__device-row { display: grid; - grid-template-columns: 28px minmax(0, 1fr) auto; + grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; column-gap: var(--openbitfun-space-2); - min-height: 32px; - padding: var(--openbitfun-space-1) 0; + min-height: var(--openbitfun-control-height-md); + padding-inline: var(--openbitfun-space-2); border-radius: var(--openbitfun-radius-sm); &[data-openbitfun-device-kind='message-app'] .openbitfun-device-overview__device-icon { @@ -2038,15 +2132,22 @@ $_section-header-height: 22px; overflow: hidden; color: var(--openbitfun-color-content-primary); font-size: var(--openbitfun-type-label-md-font-size); - font-weight: var(--openbitfun-type-label-selected-font-weight); + font-weight: var(--openbitfun-type-label-sm-font-weight); white-space: nowrap; } } .openbitfun-device-overview__task-count { - color: var(--openbitfun-color-content-muted); + min-width: var(--openbitfun-space-4); + padding-inline: var(--openbitfun-space-1); + border-radius: var(--openbitfun-radius-pill); + background: var(--openbitfun-color-action-quiet-hover); + color: var(--openbitfun-color-content-secondary); font-size: var(--openbitfun-type-meta-font-size); + line-height: var(--openbitfun-type-meta-line-height); + font-variant-numeric: tabular-nums; + text-align: center; } .openbitfun-device-overview__device-row[data-openbitfun-activities~='controlling'] .openbitfun-device-overview__device-icon::after { @@ -2063,13 +2164,13 @@ $_section-header-height: 22px; .openbitfun-device-overview__device-icon { position: relative; - width: 28px; - height: 28px; + width: 24px; + height: 24px; display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; - color: var(--openbitfun-color-content-primary); + color: var(--openbitfun-color-content-secondary); svg { flex-shrink: 0; @@ -2847,11 +2948,17 @@ $_section-header-height: 22px; animation: none; } - .openbitfun-device-overview__backup.is-syncing svg { + .openbitfun-device-overview__backup.is-syncing svg, + .openbitfun-device-overview__usage-badge::after { animation: none; } - .openbitfun-nav-panel__top-action-sublist { + .openbitfun-device-overview { + transition: none; + } + + .openbitfun-nav-panel__top-action-sublist, + .openbitfun-device-overview__page-dot { transition: none; } } diff --git a/src/web-ui/src/app/components/NavPanel/assets/device.svg b/src/web-ui/src/app/components/NavPanel/assets/device.svg index 457aa2975d..46653de439 100644 --- a/src/web-ui/src/app/components/NavPanel/assets/device.svg +++ b/src/web-ui/src/app/components/NavPanel/assets/device.svg @@ -1,3 +1,3 @@ - + diff --git a/src/web-ui/src/app/components/NavPanel/assets/harmonyos.svg b/src/web-ui/src/app/components/NavPanel/assets/harmonyos.svg index a739a00e1a..d976115f98 100644 --- a/src/web-ui/src/app/components/NavPanel/assets/harmonyos.svg +++ b/src/web-ui/src/app/components/NavPanel/assets/harmonyos.svg @@ -1,6 +1,6 @@ - - + + diff --git a/src/web-ui/src/app/components/NavPanel/assets/linux.svg b/src/web-ui/src/app/components/NavPanel/assets/linux.svg index 149cd454df..551bab3665 100644 --- a/src/web-ui/src/app/components/NavPanel/assets/linux.svg +++ b/src/web-ui/src/app/components/NavPanel/assets/linux.svg @@ -2,6 +2,6 @@ - - + + diff --git a/src/web-ui/src/app/components/NavPanel/assets/macos.svg b/src/web-ui/src/app/components/NavPanel/assets/macos.svg index e8c03338a5..29fb9727ec 100644 --- a/src/web-ui/src/app/components/NavPanel/assets/macos.svg +++ b/src/web-ui/src/app/components/NavPanel/assets/macos.svg @@ -1,6 +1,6 @@ - - + + diff --git a/src/web-ui/src/app/components/NavPanel/assets/server.svg b/src/web-ui/src/app/components/NavPanel/assets/server.svg index de7a617ecf..b6e87552be 100644 --- a/src/web-ui/src/app/components/NavPanel/assets/server.svg +++ b/src/web-ui/src/app/components/NavPanel/assets/server.svg @@ -3,5 +3,5 @@ the same three rack units, with their status lights punched out, that the row mark draws. Drawn on a 24-unit grid and centred in a box one mark-height taller, so the mask scales to the slot without moving the ink. --> - + diff --git a/src/web-ui/src/app/components/NavPanel/assets/windows.svg b/src/web-ui/src/app/components/NavPanel/assets/windows.svg index a1f1473c1b..595eaf4cbb 100644 --- a/src/web-ui/src/app/components/NavPanel/assets/windows.svg +++ b/src/web-ui/src/app/components/NavPanel/assets/windows.svg @@ -1,6 +1,6 @@ - - + + diff --git a/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.test.tsx b/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.test.tsx index 81f619d656..deb4b7459c 100644 --- a/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.test.tsx +++ b/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.test.tsx @@ -227,10 +227,17 @@ describe('device status card', () => { expect(element('nav-device-status-manage').getAttribute('aria-label')).toBe('deviceOverview.devicesAndConnections'); expect(element('nav-device-status-manage').querySelector('.lucide-monitor-smartphone')).not.toBeNull(); expect(card.querySelector('[data-testid="nav-device-status-pagination"]')).toBeNull(); - expect(element('nav-device-status-local').textContent).toBe('deviceOverview.localDevice'); - expect(element('nav-device-status-local').dataset.openbitfunComponent).toBe('status-pill'); - expect(element('nav-device-status-local').dataset.tone).toBe('neutral'); - expect(element('nav-device-status-local').closest('.openbitfun-device-overview__device-actions')).not.toBeNull(); + // Titles and status words are drawn, not written: no header title, and this + // machine is a quiet mark after its name rather than a text pill. + expect(header?.querySelector('[data-openbitfun-part="title"]')).toBeNull(); + expect(card.textContent).not.toContain('deviceOverview.title'); + expect(card.dataset.controlState).toBe('local'); + expect(element('nav-device-status-local').textContent).toBe(''); + expect(element('nav-device-status-local').getAttribute('role')).toBe('img'); + expect(element('nav-device-status-local').getAttribute('aria-label')).toBe('deviceOverview.localDevice'); + expect(element('nav-device-status-local').querySelector('.lucide-house')).not.toBeNull(); + expect(element('nav-device-status-local').closest('.openbitfun-device-overview__device-heading')).not.toBeNull(); + expect(card.querySelector('[data-openbitfun-component="status-pill"]')).toBeNull(); expect(card.querySelector('.openbitfun-device-overview__carousel-controls')).toBeNull(); expect(card.querySelector('[data-openbitfun-part="footer"]')).toBeNull(); expect(card.querySelector('[data-testid="nav-device-status-connected-devices"]')).toBeNull(); @@ -507,12 +514,15 @@ describe('device status card', () => { expect(state.switchToDevice).not.toHaveBeenCalled(); expect(element('nav-device-status-connect').closest('.openbitfun-device-overview__device-status')).not.toBeNull(); expect(element('nav-device-status-connect').closest('.openbitfun-device-overview__device-actions')).not.toBeNull(); - expect(element('nav-device-status-connect').dataset.openbitfunComponent).toBe('button'); + expect(element('nav-device-status-connect').dataset.openbitfunComponent).toBe('icon-button'); + expect(element('nav-device-status-connect').dataset.openbitfunShape).toBe('circle'); expect(element('nav-device-status-connect').dataset.openbitfunVariant).toBe('primary'); - expect(element('nav-device-status-connect').textContent).toBe('deviceOverview.connectAndUse'); + expect(element('nav-device-status-connect').getAttribute('aria-label')).toMatch(/ · deviceOverview\.connectAndUse$/); + expect(element('nav-device-status-connect').textContent).toBe(''); state.attachedHostKinds = { 'peer-2': 'cli' }; render(); - expect(element('nav-device-status-connect').textContent).toBe('deviceOverview.switchUse'); + expect(element('nav-device-status-connect').getAttribute('aria-label')).toMatch(/ · deviceOverview\.switchUse$/); + expect(element('nav-device-status-connect').textContent).toBe(''); expect(element('nav-device-status-popover').querySelector('[data-openbitfun-part="footer"]')).toBeNull(); expect(document.querySelector('[data-testid="nav-device-status-disconnect"]')).toBeNull(); await act(async () => { element('nav-device-status-connect').click(); }); @@ -522,13 +532,14 @@ describe('device status card', () => { await act(async () => { previous.click(); }); expect(element('nav-device-status-disconnect').closest('[data-control-state="active"]')).not.toBeNull(); await act(async () => { previous.click(); }); - expect(element('nav-device-status-return-local').textContent).toBe('deviceOverview.returnLocalAction'); + expect(element('nav-device-status-return-local').getAttribute('aria-label')).toMatch(/ · deviceOverview\.returnLocalAction$/); + expect(element('nav-device-status-return-local').textContent).toBe(''); await act(async () => { element('nav-device-status-return-local').click(); }); expect(state.switchToLocal).toHaveBeenCalledWith('manual'); expect(state.disconnectDevice).not.toHaveBeenCalled(); }); - it('marks only the current remote name with an in-use pill and keeps the artwork clear', () => { + it('marks only the current remote name with an in-use signal and keeps the artwork clear', () => { state.overview = overview({ localDeviceName: 'This computer' }); render(); const summary = element('nav-device-status-summary'); @@ -536,7 +547,7 @@ describe('device status card', () => { expect(summary.querySelector('[data-control-state="local"]')?.getAttribute('aria-label')).toContain('deviceOverview.currentLocalDevice'); expect(header?.querySelector('.openbitfun-device-overview__device-status')).toBeNull(); expect(summary.querySelector('.openbitfun-device-overview__usage-badge')).toBeNull(); - expect(summary.querySelector('[data-openbitfun-component="status-pill"]')).toBe(element('nav-device-status-local')); + expect(summary.querySelector('[role="img"][aria-label="deviceOverview.localDevice"]')).toBe(element('nav-device-status-local')); expect(summary.querySelector('.openbitfun-device-overview__connection-control')).toBeNull(); // The active peer carries its status after the name, and keeps its bottom disconnect action. @@ -546,40 +557,32 @@ describe('device status card', () => { }); render(); expect(summary.querySelector('[data-control-state="active"]')?.getAttribute('aria-label')).toContain('deviceOverview.currentUse · deviceOverview.controlling'); - expect(summary.textContent).toContain('deviceOverview.inUse'); + expect(summary.textContent).not.toContain('deviceOverview.inUse'); + expect(element('nav-device-status-popover').dataset.controlState).toBe('active'); const usageControl = element('nav-device-usage-status'); expect(usageControl.tagName).toBe('SPAN'); - expect(usageControl.dataset.openbitfunComponent).toBe('status-pill'); - expect(usageControl.dataset.tone).toBe('success'); - expect(usageControl.dataset.shape).toBe('pill'); + expect(usageControl.getAttribute('role')).toBe('img'); + expect(usageControl.getAttribute('aria-label')).toBe('deviceOverview.inUse'); + expect(usageControl.getAttribute('title')).toBe('deviceOverview.inUse'); + expect(usageControl.textContent).toBe(''); expect(usageControl.closest('.openbitfun-device-overview__device-heading')).not.toBeNull(); expect(element('nav-device-status-name').nextElementSibling).toBe(usageControl); expect(summary.querySelector('[data-testid="nav-device-usage-status"]')).toBe(usageControl); - expect(usageControl.textContent).toBe('deviceOverview.inUse'); - expect(usageControl.getAttribute('role')).not.toBe('button'); expect(usageControl.getAttribute('tabindex')).toBeNull(); - expect(usageControl.querySelector('svg')).toBeNull(); - expect(usageControl.getAttribute('title')).toBeNull(); - act(() => usageControl.dispatchEvent(new MouseEvent('mouseover', { bubbles: true }))); - expect(usageControl.textContent).toBe('deviceOverview.inUse'); - expect(usageControl.querySelector('svg')).toBeNull(); expect(usageControl.querySelector('.lucide-unplug')).toBeNull(); - act(() => usageControl.focus()); - act(() => usageControl.dispatchEvent(new MouseEvent('mouseout', { bubbles: true, relatedTarget: container }))); - expect(usageControl.textContent).toBe('deviceOverview.inUse'); - act(() => element('nav-device-status-manage').focus()); - expect(usageControl.textContent).toBe('deviceOverview.inUse'); expect(usageControl.closest('[aria-hidden="true"]')).toBeNull(); expect(summary.querySelector('.openbitfun-device-overview__device-heading .openbitfun-device-overview__usage-badge')).toBe(usageControl); expect(header?.contains(element('nav-device-status-disconnect'))).toBe(false); expect(summary.contains(element('nav-device-status-disconnect'))).toBe(true); expect(element('nav-device-status-disconnect').closest('.openbitfun-device-overview__device-actions')).not.toBeNull(); expect(element('nav-device-status-disconnect').closest('.openbitfun-device-overview__device-status')).not.toBeNull(); - expect(element('nav-device-status-disconnect').textContent).toBe('deviceOverview.disconnectAction'); - expect(element('nav-device-status-disconnect').dataset.openbitfunComponent).toBe('button'); + expect(element('nav-device-status-disconnect').getAttribute('aria-label')).toMatch(/ · deviceOverview\.disconnectAction$/); + expect(element('nav-device-status-disconnect').textContent).toBe(''); + expect(element('nav-device-status-disconnect').dataset.openbitfunComponent).toBe('icon-button'); + expect(element('nav-device-status-disconnect').dataset.openbitfunShape).toBe('circle'); expect(element('nav-device-status-disconnect').dataset.openbitfunVariant).toBe('primary'); expect(summary.querySelector('.openbitfun-device-overview__connection-control')).toBeNull(); - expect(summary.querySelector('[data-openbitfun-component="status-pill"]')).toBe(usageControl); + expect(summary.querySelector('[data-openbitfun-component="status-pill"]')).toBeNull(); expect(document.querySelector('[data-testid="nav-device-status-connected-devices"]')).toBeNull(); expect(element('nav-device-status-disconnect').closest('[data-control-state="active"]')).not.toBeNull(); expect(element('nav-device-status-popover').querySelector('[data-openbitfun-part="footer"]')).toBeNull(); @@ -624,12 +627,14 @@ describe('device status card', () => { let finishDisconnect!: () => void; state.disconnectDevice.mockImplementationOnce(() => new Promise(resolve => { finishDisconnect = resolve; })); act(() => element('nav-device-status-disconnect').click()); - expect(element('nav-device-status-disconnect').textContent).toBe('deviceOverview.disconnectingAction'); + expect(element('nav-device-status-disconnect').getAttribute('aria-label')).toMatch(/ · deviceOverview\.disconnectingAction$/); + expect(element('nav-device-status-disconnect').textContent).toBe(''); expect((element('nav-device-status-disconnect') as HTMLButtonElement).disabled).toBe(true); act(() => element('nav-device-status-disconnect').click()); expect(state.disconnectDevice).toHaveBeenCalledTimes(1); await act(async () => { finishDisconnect(); }); - expect(element('nav-device-status-disconnect').textContent).toBe('deviceOverview.disconnectAction'); + expect(element('nav-device-status-disconnect').getAttribute('aria-label')).toMatch(/ · deviceOverview\.disconnectAction$/); + expect(element('nav-device-status-disconnect').textContent).toBe(''); expect(state.disconnectDevice).toHaveBeenCalledWith('peer-1', 'manual'); expect(state.switchToLocal).not.toHaveBeenCalled(); expect(onOpenChange).not.toHaveBeenCalled(); @@ -644,10 +649,10 @@ describe('device status card', () => { const usageControl = element('nav-device-usage-status'); act(() => usageControl.click()); expect(state.disconnectDevice).not.toHaveBeenCalled(); - expect(usageControl.textContent).toBe('deviceOverview.inUse'); + expect(usageControl.getAttribute('aria-label')).toBe('deviceOverview.inUse'); act(() => element('nav-device-status-disconnect').click()); expect(state.disconnectDevice).toHaveBeenCalledWith('peer-1', 'manual'); - expect(usageControl.textContent).toBe('deviceOverview.inUse'); + expect(usageControl.getAttribute('aria-label')).toBe('deviceOverview.inUse'); expect((element('nav-device-status-disconnect') as HTMLButtonElement).disabled).toBe(true); expect((element('nav-footer-cancel-remote') as HTMLButtonElement).disabled).toBe(true); act(() => { usageControl.click(); element('nav-footer-cancel-remote').click(); }); @@ -850,7 +855,8 @@ describe('device status card', () => { expect((notice as HTMLButtonElement).disabled).toBe(true); expect(notice?.closest('[data-control-state="incompatible"]')).not.toBeNull(); expect(notice?.getAttribute('title')).toContain('deviceOverview.deviceClientIncompatibleWithVersion'); - expect(notice?.textContent).toBe('deviceOverview.unavailableAction'); + expect(notice?.getAttribute('aria-label')).toMatch(/ · deviceOverview\.unavailableAction$/); + expect(notice?.textContent).toBe(''); expect(document.querySelector('.openbitfun-device-overview__device-name')?.textContent).toBeDefined(); expect(Array.from(document.querySelectorAll('button')).some( button => button.textContent === 'deviceOverview.connectDevice', diff --git a/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.tsx b/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.tsx index a0733e4ae7..da48dc647f 100644 --- a/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.tsx +++ b/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.tsx @@ -1,7 +1,7 @@ import { useDeviceDirectory, resolveDeviceName, isDeviceControllable, deviceClientVersion } from '@/infrastructure/account/deviceDirectory'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { subscribeOverlayInteraction, createOverlayPortal, OverflowText, Button, Card, CardBody, CardHeader, Icon, IconButton, ScrollArea, StatusPill, type IconSize } from '@openbitfun/ui'; -import { ChevronLeft, ChevronRight, CircleAlert, MessageCircle, Monitor, MonitorSmartphone, Smartphone, Undo2, Unplug } from 'lucide-react'; +import { subscribeOverlayInteraction, createOverlayPortal, OverflowText, Button, Card, CardBody, CardHeader, Icon, IconButton, ScrollArea, type IconSize } from '@openbitfun/ui'; +import { ArrowRightLeft, ChevronLeft, ChevronRight, CircleAlert, House, MessageCircle, Monitor, MonitorSmartphone, Smartphone, Undo2, Unplug } from 'lucide-react'; import { useI18n } from '@/infrastructure/i18n/hooks/useI18n'; import { getAppearanceOverlayHost } from '@/infrastructure/appearance/runtime/AppearanceOverlayHost'; import { useAnchoredPopoverPosition } from '@/shared/utils/useAnchoredPopoverPosition'; @@ -364,6 +364,8 @@ const DeviceStatusControl: React.FC = ({ )) ?? false; const displayedIncompatible = previewIncompatible && !displayedActive; const displayedHasAction = displayedActive || isPreviewing || displayedIncompatible; + const displayedControlState = displayedIncompatible ? 'incompatible' + : displayedActive ? 'active' : displayedDevice.local ? 'local' : 'available'; const displayedActionLabel = displayedIncompatible ? previewIncompatibleNotice : displayedActive ? t('deviceOverview.disconnectActionHint') @@ -446,6 +448,7 @@ const DeviceStatusControl: React.FC = ({ data-openbitfun-product-part="root" data-openbitfun-state={overview.mode} data-openbitfun-placement={popoverLayout?.placement ?? 'top'} + data-control-state={displayedControlState} style={{ top: `${popoverLayout?.top ?? 0}px`, left: `${popoverLayout?.left ?? 0}px`, @@ -458,6 +461,18 @@ const DeviceStatusControl: React.FC = ({ contentAlign="start" actions={(
+ {overview.topologyUnavailable && ( + } + className="openbitfun-device-overview__notice" + aria-label={t('deviceOverview.statusUnavailable')} + title={t('deviceOverview.statusUnavailable')} + onClick={() => { void refresh(); }} + /> + )} = ({
)} /> -
@@ -480,9 +494,20 @@ const DeviceStatusControl: React.FC = ({ ref={artworkRef} role="group" aria-label={[displayedDevice.name, deviceActivity(displayedDevice)].join(' · ')} - data-control-state={displayedIncompatible ? 'incompatible' : displayedActive ? 'active' : displayedDevice.local ? 'local' : 'available'}> + data-control-state={displayedControlState}>
+ {previewDevices.length > 1 && ( +
{carouselDeviceIds.length > 1 && ( @@ -518,42 +543,55 @@ const DeviceStatusControl: React.FC = ({ )}
+ {/* The system is drawn, not written: the same mark the trigger and + the device rows use. State is drawn after the name. */} + {displayedDevice.name} {displayedActive && ( - + )} + {!displayedHasAction && displayedDevice.local && ( + - {t('deviceOverview.inUse')} - + + )}
- {!displayedHasAction && displayedDevice.local && ( - - {t('deviceOverview.localDevice')} - - )} {displayedHasAction && (
- + />
)}
- {overview.topologyUnavailable && ( - } - className="openbitfun-device-overview__notice" - aria-label={t('deviceOverview.statusUnavailable')} - title={t('deviceOverview.statusUnavailable')} - onClick={() => { void refresh(); }} - /> - )} {listedDevices.length > 0 && (
+
{listedDevices.map(device => (
= ({
))}
+
)}
-
, From f5a7688585af943724674dcf34b943adc7c51cb8 Mon Sep 17 00:00:00 2001 From: Bob Lee Date: Tue, 3 Nov 2026 11:26:09 +0800 Subject: [PATCH 2/4] feat(web-ui): restyle the agent companion pet bubbles Bring the floating pet's session bubbles in line with the device overview: borderless bubbles lit from the title corner by the task state, a soft tinted shadow instead of a hard black one, and the tail corner toward the pet. The status line becomes a state glyph before the title; the words stay in the tooltip and for assistive tech. The reply affordance is a borderless glass disc, and the inline composer is a single pill field with cancel and send set inside it, sized to fit the default pet height. A session that finished in the background may only have metadata in the main window, so it has no reply text yet. The single bubble now stays compact instead of reserving an empty output block. The reduced-motion rules also targeted class names that no longer exist; they now cover the state glyph and attention pulse. --- .../AgentCompanionDesktopPet.scss | 271 ++++++++++++------ .../AgentCompanionDesktopPet.tsx | 61 +++- .../AgentCompanionDesktopPetStyles.test.ts | 7 +- 3 files changed, 242 insertions(+), 97 deletions(-) diff --git a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.scss b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.scss index ecc2793d64..7f2666be86 100644 --- a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.scss +++ b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.scss @@ -93,35 +93,35 @@ } } - /* Input bar shown inside the bubble the user replied from. */ + /* Input bar shown inside the bubble the user replied from: one pill field + with its two actions set inside it, in the bubble's own light. */ &__bubble-composer { + position: relative; flex: 0 0 auto; align-self: stretch; width: 100%; - margin-top: 5px; - display: flex; - flex-direction: row; - align-items: center; - gap: 4px; + margin-top: 6px; } &__bubble-composer-input { appearance: none; -webkit-appearance: none; - flex: 1 1 auto; - min-width: 0; - height: 21px; + display: block; + width: 100%; + height: 24px; box-sizing: border-box; - padding: 2px 5px; - border: 1px solid var(--openbitfun-color-field-border); - border-radius: 5px; + padding: 0 46px 0 10px; + border: none; + border-radius: 999px; background: var(--openbitfun-color-field-background); color: var(--openbitfun-color-content-primary); + box-shadow: inset 0 0 0 1px var(--openbitfun-color-border-subtle); font: inherit; font-size: var(--openbitfun-type-micro-font-size); line-height: var(--openbitfun-type-modifier-leading-snug-line-height); user-select: text; -webkit-user-select: text; + transition: box-shadow var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard); &::placeholder { color: var(--openbitfun-color-content-muted); @@ -131,37 +131,58 @@ &:focus-visible { outline: none; outline-offset: 0; - box-shadow: none; + box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_bubble-light) 55%, transparent); } } &__bubble-composer-send, &__bubble-composer-cancel { appearance: none; - flex-shrink: 0; - width: 21px; - height: 21px; + position: absolute; + top: 50%; + width: 18px; + height: 18px; padding: 0; display: grid; place-items: center; - border: 1px solid var(--openbitfun-color-action-neutral-border); - border-radius: 5px; - background: var(--openbitfun-color-action-neutral-surface); - color: var(--openbitfun-color-action-neutral-content); + border: none; + border-radius: 50%; + transform: translateY(-50%); cursor: pointer; + transition: + background-color var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard), + color var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard), + opacity var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard); - &:hover:not(:disabled) { + &:focus-visible { + outline: 2px solid color-mix(in srgb, var(--openbitfun-color-accent-hover) 70%, transparent); + outline-offset: 1px; + } + } + + &__bubble-composer-cancel { + right: 24px; + background: transparent; + color: var(--openbitfun-color-content-muted); + + &:hover { background: var(--openbitfun-color-action-neutral-surface-hover); + color: var(--openbitfun-color-content-primary); } + } - &:disabled { - opacity: 0.45; - cursor: default; + &__bubble-composer-send { + right: 3px; + background: var(--openbitfun-color-action-primary-background); + color: var(--openbitfun-color-action-primary-content); + + &:hover:not(:disabled) { + background: var(--openbitfun-color-action-primary-hover); } - &:focus-visible { - outline: 2px solid color-mix(in srgb, var(--openbitfun-color-accent-hover) 70%, transparent); - outline-offset: 1px; + &:disabled { + opacity: 0.35; + cursor: default; } } @@ -253,33 +274,48 @@ &--single { height: min(var(--openbitfun-agent-companion-pet-height), 100vh); } + + /* No reply text yet: the bubble keeps its natural height, centred on the pet. */ + &--compact { + display: flex; + flex-direction: column; + justify-content: center; + } } + /* The reply affordance: a small borderless glass disc in the bubble's + corner, revealed on hover. */ &__bubble-compose { appearance: none; position: absolute; z-index: 2; - right: 5px; - bottom: 5px; - width: 18px; - height: 18px; + right: 7px; + bottom: 7px; + width: 22px; + height: 22px; padding: 0; display: grid; place-items: center; - border: 1px solid var(--openbitfun-color-border-default); + border: none; border-radius: 50%; - background: var(--openbitfun-color-surface-raised); - color: var(--openbitfun-color-content-primary); + background: color-mix(in srgb, var(--openbitfun-color-surface-raised) 82%, transparent); + color: var(--openbitfun-color-content-secondary); + box-shadow: + var(--openbitfun-shadow-inner-highlight), + 0 2px 8px -3px color-mix(in srgb, var(--openbitfun-color-content-primary) 30%, transparent); + backdrop-filter: blur(8px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 120ms ease, + color 120ms ease, visibility 0s linear 120ms; cursor: pointer; &:hover { - background: var(--openbitfun-color-surface-tertiary); + color: var(--openbitfun-color-content-primary); + background: var(--openbitfun-color-surface-raised); } &:focus-visible { @@ -303,15 +339,33 @@ width: 180px; max-width: 100%; box-sizing: border-box; - padding: 7px 10px; - border: 1px solid var(--openbitfun-color-border-default); - border-radius: 10px 10px 2px 10px; + /* Same language as the device overview: the opaque themed surface lit + from the corner nearest the title by the task state, a faint ring in + that light, and the tail corner pointing at the pet. */ + --_bubble-light: var(--openbitfun-color-accent-default); + --_bubble-glow: radial-gradient( + 130% 150% at 0% 0%, + color-mix(in srgb, var(--_bubble-light) 20%, transparent), + transparent 68% + ); + /* No border: the bubble is defined by its surface, the state light, the + theme's top highlight and a soft tinted drop shadow. Everything stays + inside the bubble column, which clips sideways. */ + --_bubble-edge: + var(--openbitfun-shadow-inner-highlight), + 0 10px 20px -12px color-mix(in srgb, var(--_bubble-light) 34%, transparent); + padding: 9px 12px; + border: none; + border-radius: 14px 14px 4px 14px; background-color: var(--openbitfun-color-surface-raised); + background-image: var(--_bubble-glow); color: var(--openbitfun-color-content-primary); + box-shadow: var(--_bubble-edge); backdrop-filter: blur(10px); cursor: pointer; position: relative; z-index: 0; + transition: transform var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard); &:hover { transform: translateY(-1px); @@ -329,6 +383,10 @@ overflow: hidden; } + &--compact { + height: auto; + } + /* Replying turns the bubble into its own composer, so it must not react to hover like a clickable bubble any more. */ &--composing { @@ -341,10 +399,9 @@ transform: none; } - /* Only the output yields space to the input row; letting the title and - status shrink too would clip their glyphs. */ - .openbitfun-agent-companion-window__bubble-title, - .openbitfun-agent-companion-window__bubble-status { + /* Only the output yields space to the input row; letting the title row + shrink too would clip its glyphs. */ + .openbitfun-agent-companion-window__bubble-head { flex: 0 0 auto; } @@ -357,28 +414,50 @@ } } - &__bubble-title, - &__bubble-status { - display: block; - overflow: hidden; - white-space: nowrap; + /* The state is drawn, not written: a glyph before the title. */ + &__bubble-head { + display: flex; + align-items: center; + gap: 6px; + min-width: 0; + max-width: 100%; + box-sizing: border-box; + padding-right: 8px; + } + + &__bubble-state { + flex: 0 0 auto; + color: var(--_bubble-light); + } + + &__bubble--running &__bubble-state { + animation: openbitfun-agent-companion-state-spin 1.1s linear infinite; + } + + &__bubble--attention &__bubble-state { + animation: openbitfun-agent-companion-state-breathe 1.5s ease-in-out infinite; } &__bubble-title { - box-sizing: border-box; - max-width: 100%; - padding-right: 8px; - font-size: var(--openbitfun-type-meta-font-size); + display: block; + overflow: hidden; + white-space: nowrap; + flex: 1 1 auto; + min-width: 0; + font-size: var(--openbitfun-type-label-sm-font-size); line-height: var(--openbitfun-type-modifier-leading-dense-line-height); font-weight: var(--openbitfun-type-label-selected-font-weight); - min-width: 0; } + /* The words behind the glyph stay for assistive tech; sighted users get + them in the bubble's tooltip. */ &__bubble-status { - margin-top: 2px; - font-size: var(--openbitfun-type-micro-font-size); - line-height: var(--openbitfun-type-modifier-leading-dense-line-height); - color: var(--openbitfun-color-content-secondary); + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; } &__bubble-output { @@ -413,51 +492,47 @@ } } + /* Each state sets the light and lays its status tint over the opaque themed + surface, fading away from the lit corner so the bubble stays calm. */ &__bubble--attention { - border-color: var(--openbitfun-color-status-warning-border); + --_bubble-light: var(--openbitfun-color-status-warning-content); background-image: linear-gradient( + 135deg, var(--openbitfun-color-status-warning-surface), - var(--openbitfun-color-status-warning-surface) - ); - box-shadow: 0 0 0 0 color-mix(in srgb, var(--openbitfun-color-status-warning-content) 50%, transparent); + transparent 72% + ), var(--_bubble-glow); + box-shadow: + var(--_bubble-edge), + 0 0 0 0 color-mix(in srgb, var(--openbitfun-color-status-warning-content) 50%, transparent); animation: openbitfun-agent-companion-attention-pulse 1.5s ease-in-out infinite !important; - - &::after { - content: ""; - position: absolute; - top: 6px; - right: 6px; - width: 6px; - height: 6px; - border-radius: 50%; - background: var(--openbitfun-color-status-warning-content); - animation: openbitfun-agent-companion-attention-dot 1.5s ease-in-out infinite; - } } &__bubble--waiting { - border-color: var(--openbitfun-color-status-warning-border); + --_bubble-light: var(--openbitfun-color-status-warning-content); background-image: linear-gradient( + 135deg, var(--openbitfun-color-status-warning-surface), - var(--openbitfun-color-status-warning-surface) - ); + transparent 72% + ), var(--_bubble-glow); } &__bubble--completed { - border-color: var(--openbitfun-color-status-success-border); + --_bubble-light: var(--openbitfun-color-status-success-content); background-image: linear-gradient( + 135deg, var(--openbitfun-color-status-success-surface), - var(--openbitfun-color-status-success-surface) - ); + transparent 72% + ), var(--_bubble-glow); } &__bubble--error, &__bubble--interrupted { - border-color: var(--openbitfun-color-status-danger-border); + --_bubble-light: var(--openbitfun-color-status-danger-content); background-image: linear-gradient( + 135deg, var(--openbitfun-color-status-danger-surface), - var(--openbitfun-color-status-danger-surface) - ); + transparent 72% + ), var(--_bubble-glow); } .openbitfun-agent-companion-pet { @@ -484,13 +559,36 @@ @keyframes openbitfun-agent-companion-attention-pulse { 0%, 100% { - box-shadow: 0 0 0 0 color-mix(in srgb, var(--openbitfun-color-status-warning-content) 50%, transparent); + box-shadow: + var(--_bubble-edge), + 0 0 0 0 color-mix(in srgb, var(--openbitfun-color-status-warning-content) 40%, transparent); transform: translateY(0); } 50% { - box-shadow: 0 0 0 8px transparent; - transform: translateY(-2px); + box-shadow: + var(--_bubble-edge), + 0 0 0 6px transparent; + transform: translateY(-1px); + } +} + +@keyframes openbitfun-agent-companion-state-spin { + to { + transform: rotate(360deg); + } +} + +@keyframes openbitfun-agent-companion-state-breathe { + 0%, + 100% { + transform: scale(1); + opacity: 1; + } + + 50% { + transform: scale(1.15); + opacity: 0.7; } } @@ -528,4 +626,9 @@ animation: none !important; transform: none; } + + .openbitfun-agent-companion-window__bubble--attention, + .openbitfun-agent-companion-window__bubble-state { + animation: none !important; + } } diff --git a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx index d6613d6975..077e0a9d09 100644 --- a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx +++ b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx @@ -1,4 +1,15 @@ -import { ArrowUp as LucideArrowUp, PencilLine as LucidePencilLine, X as LucideX } from 'lucide-react'; +import { + ArrowUp as LucideArrowUp, + CircleAlert as LucideCircleAlert, + CircleCheck as LucideCircleCheck, + CirclePause as LucideCirclePause, + CircleX as LucideCircleX, + Hourglass as LucideHourglass, + LoaderCircle as LucideLoaderCircle, + PencilLine as LucidePencilLine, + X as LucideX, + type LucideIcon, +} from 'lucide-react'; import { OverflowText, Menu, MenuItem, ScrollArea } from '@openbitfun/ui'; import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -103,6 +114,16 @@ function menuAnchorFromEvent(event: React.MouseEvent): MenuAnchor { }; } +/** A bubble states its task with a glyph; the words stay for tooltips and assistive tech. */ +const TASK_STATE_GLYPHS: Record = { + running: LucideLoaderCircle, + waiting: LucideHourglass, + attention: LucideCircleAlert, + completed: LucideCircleCheck, + error: LucideCircleX, + interrupted: LucideCirclePause, +}; + function bubbleDismissBucket(state: AgentCompanionTaskState): BubbleDismissBucket { return state === 'running' || state === 'waiting' ? 'active' : 'notice'; } @@ -1082,15 +1103,30 @@ export const AgentCompanionDesktopPet: React.FC = () => { const isComposingTask = overlay?.kind === 'composer' && overlay.sessionId === task.sessionId; const isHoveredTask = hoveredBubbleSessionId === task.sessionId; - const bubbleClassName = `openbitfun-agent-companion-window__bubble openbitfun-agent-companion-window__bubble--${task.state}${isSingleTask ? ' openbitfun-agent-companion-window__bubble--single' : ''}${isComposingTask ? ' openbitfun-agent-companion-window__bubble--composing' : ''}`; + // A session that finished in the background may only have metadata + // here, so there is no reply text yet: keep the single bubble + // compact instead of reserving an empty output block. + const isCompactSingle = isSingleTask && !task.latestOutput && !isComposingTask; + const bubbleClassName = `openbitfun-agent-companion-window__bubble openbitfun-agent-companion-window__bubble--${task.state}${isSingleTask ? ' openbitfun-agent-companion-window__bubble--single' : ''}${isCompactSingle ? ' openbitfun-agent-companion-window__bubble--compact' : ''}${isComposingTask ? ' openbitfun-agent-companion-window__bubble--composing' : ''}`; + const statusLabel = t(task.labelKey, { defaultValue: task.defaultLabel }); + const StateGlyph = TASK_STATE_GLYPHS[task.state] ?? LucideLoaderCircle; const bubbleBody = ( <> - - {task.title} - - - {t(task.labelKey, { defaultValue: task.defaultLabel })} - + + + + {statusLabel} + {isSingleTask && task.latestOutput && (() => { const typedOutput = typedOutputBySessionId[task.sessionId]; const visibleOutput = typedOutput?.visible ?? seedTypewriterOutput(task.latestOutput); @@ -1120,7 +1156,7 @@ export const AgentCompanionDesktopPet: React.FC = () => {
onBubbleContextMenu(event, task.sessionId)} > {isComposingTask ? ( @@ -1152,7 +1188,7 @@ export const AgentCompanionDesktopPet: React.FC = () => { aria-label={t('agentCompanion.composer.cancel')} onClick={cancelBubbleComposer} > -
@@ -1170,6 +1206,7 @@ export const AgentCompanionDesktopPet: React.FC = () => { )} diff --git a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPetStyles.test.ts b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPetStyles.test.ts index 0b120dd043..496d56400d 100644 --- a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPetStyles.test.ts +++ b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPetStyles.test.ts @@ -44,7 +44,12 @@ describe('AgentCompanionDesktopPet styles', () => { expect(bubble).toContain('background-color: var(--openbitfun-color-surface-raised);'); expect(bubble).toContain('color: var(--openbitfun-color-content-primary);'); - expect(status).toContain('color: var(--openbitfun-color-content-secondary);'); + // Status words are drawn as a glyph; the text stays for assistive tech only. + expect(status).toContain('clip-path: inset(50%);'); + expect(extractBlock(stylesheet, '&__bubble-state')).toContain('color: var(--_bubble-light);'); + for (const state of ['running', 'waiting', 'attention', 'completed', 'error', 'interrupted']) { + expect(readSource()).toMatch(new RegExp(`\\n ${state}: Lucide\\w+,`)); + } expect(output).toContain('color: var(--openbitfun-color-content-secondary);'); expect(composerInput).toContain('background: var(--openbitfun-color-field-background);'); expect(composerInput).toContain('color: var(--openbitfun-color-content-primary);'); From a7b0e9b54942d6bb6ec17a8a7ab57370998c501b Mon Sep 17 00:00:00 2001 From: Bob Lee Date: Tue, 3 Nov 2026 11:43:04 +0800 Subject: [PATCH 3/4] fix(web-ui): pin the device overview to its trigger and settle its action states Opening upward, the popover is now positioned by the bottom edge that useAnchoredPopoverPosition already reports, so a height change grows away from the trigger in the same frame instead of being repositioned a frame late. The round action no longer keeps its tinted look while disabled: the state tint only applies to an enabled button, and the variant's opaque base is cleared so the tint sits on the lit card. An incompatible device is aria-disabled rather than disabled, so it stays focusable and its version notice remains reachable, and its warning mark stays legible. Connecting now uses a link glyph, keeping the swap arrows for switching to an attached device. --- .../src/app/components/NavPanel/NavPanel.scss | 33 +++++++++++++++---- .../components/DeviceStatusControl.test.tsx | 33 +++++++++++++++++-- .../components/DeviceStatusControl.tsx | 16 ++++++--- 3 files changed, 70 insertions(+), 12 deletions(-) diff --git a/src/web-ui/src/app/components/NavPanel/NavPanel.scss b/src/web-ui/src/app/components/NavPanel/NavPanel.scss index 7fdf4d6a1c..7aa6cd8f34 100644 --- a/src/web-ui/src/app/components/NavPanel/NavPanel.scss +++ b/src/web-ui/src/app/components/NavPanel/NavPanel.scss @@ -2078,19 +2078,40 @@ $_section-header-height: 22px; --_device-overview-action-tone: var(--_device-overview-light); --_icon-button-size: var(--openbitfun-control-height-md); --_icon-button-icon-size: 16px; - --_icon-button-content: color-mix(in srgb, var(--_device-overview-action-tone) 72%, var(--openbitfun-color-content-primary)); - --_icon-button-background: color-mix(in srgb, var(--_device-overview-action-tone) 16%, transparent); - --_icon-button-background-hover: color-mix(in srgb, var(--_device-overview-action-tone) 26%, transparent); - --_icon-button-background-active: color-mix(in srgb, var(--_device-overview-action-tone) 32%, transparent); flex: 0 0 auto; border-radius: var(--openbitfun-radius-pill); - box-shadow: inset 0 0 0 var(--openbitfun-border-width-default) color-mix(in srgb, var(--_device-overview-action-tone) 30%, transparent); + // The primary and fill variants paint an opaque base under their tint; the + // glass tint must sit on the lit card instead. + background: transparent; transition: box-shadow var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-standard); - &:is(:hover, :focus-visible):not(:disabled) { + &:not(:disabled, [aria-disabled='true']) { + --_icon-button-content: color-mix(in srgb, var(--_device-overview-action-tone) 72%, var(--openbitfun-color-content-primary)); + --_icon-button-background: color-mix(in srgb, var(--_device-overview-action-tone) 16%, transparent); + --_icon-button-background-hover: color-mix(in srgb, var(--_device-overview-action-tone) 26%, transparent); + --_icon-button-background-active: color-mix(in srgb, var(--_device-overview-action-tone) 32%, transparent); + box-shadow: inset 0 0 0 var(--openbitfun-border-width-default) color-mix(in srgb, var(--_device-overview-action-tone) 30%, transparent); + } + + &:not(:disabled, [aria-disabled='true']):is(:hover, :focus-visible) { box-shadow: inset 0 0 0 var(--openbitfun-border-width-default) color-mix(in srgb, var(--_device-overview-action-tone) 48%, transparent); } + // Unavailable reads as unavailable: a quiet neutral disc, no state light. + &:is(:disabled, [aria-disabled='true']) { + --_icon-button-content: var(--openbitfun-color-action-neutral-content-disabled); + --_icon-button-background: color-mix(in srgb, var(--openbitfun-color-content-primary) 5%, transparent); + --_icon-button-background-hover: var(--_icon-button-background); + --_icon-button-background-active: var(--_icon-button-background); + box-shadow: inset 0 0 0 var(--openbitfun-border-width-default) var(--openbitfun-color-border-subtle); + cursor: not-allowed; + } + + // An incompatible device keeps its warning mark legible. + [data-control-state='incompatible'] > &[aria-disabled='true'] { + --_icon-button-content: var(--openbitfun-color-status-warning-content); + } + [data-control-state='active'] > & { --_device-overview-action-tone: var(--openbitfun-color-content-secondary); } diff --git a/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.test.tsx b/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.test.tsx index deb4b7459c..0350c6ebe7 100644 --- a/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.test.tsx +++ b/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.test.tsx @@ -204,6 +204,29 @@ afterEach(() => { }); describe('device status card', () => { + it('pins an upward card by its bottom edge so height changes never reposition it', () => { + render(false); + const rect = (top: number, height: number, width: number) => ({ + top, bottom: top + height, left: 16, right: 16 + width, width, height, x: 16, y: top, + toJSON: () => ({}), + }) as DOMRect; + const measure = vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect') + .mockImplementation(function (this: HTMLElement) { + if (this.dataset.testid === 'nav-footer-device-status') return rect(700, 32, 160); + if (this.dataset.testid === 'nav-device-status-popover') return rect(0, 200, 312); + return rect(0, 0, 0); + }); + try { + render(true); + const card = element('nav-device-status-popover'); + expect(card.dataset.openbitfunPlacement).toBe('top'); + expect(card.style.top).toBe(''); + expect(card.style.bottom).toBe(`${window.innerHeight - 700 + 8}px`); + } finally { + measure.mockRestore(); + } + }); + it('shows the device management icon in the header without an account display', () => { render(); const card = element('nav-device-status-popover'); @@ -518,10 +541,13 @@ describe('device status card', () => { expect(element('nav-device-status-connect').dataset.openbitfunShape).toBe('circle'); expect(element('nav-device-status-connect').dataset.openbitfunVariant).toBe('primary'); expect(element('nav-device-status-connect').getAttribute('aria-label')).toMatch(/ · deviceOverview\.connectAndUse$/); + // Connecting and switching to an attached device are told apart by glyph. + expect(element('nav-device-status-connect').querySelector('.lucide-link')).not.toBeNull(); expect(element('nav-device-status-connect').textContent).toBe(''); state.attachedHostKinds = { 'peer-2': 'cli' }; render(); expect(element('nav-device-status-connect').getAttribute('aria-label')).toMatch(/ · deviceOverview\.switchUse$/); + expect(element('nav-device-status-connect').querySelector('.lucide-arrow-right-left')).not.toBeNull(); expect(element('nav-device-status-connect').textContent).toBe(''); expect(element('nav-device-status-popover').querySelector('[data-openbitfun-part="footer"]')).toBeNull(); expect(document.querySelector('[data-testid="nav-device-status-disconnect"]')).toBeNull(); @@ -848,11 +874,14 @@ describe('device status card', () => { expect(next).not.toBeNull(); await act(async () => { next!.click(); }); - // The unavailable connection is disabled and explains the version in its tooltip. + // The unavailable connection has no action and explains the version in its tooltip. const notice = document.querySelector('[data-testid="nav-device-status-incompatible"]'); expect(notice).not.toBeNull(); expect(notice?.tagName).toBe('BUTTON'); - expect((notice as HTMLButtonElement).disabled).toBe(true); + // Not natively disabled: it stays focusable so its version tooltip is reachable. + expect((notice as HTMLButtonElement).disabled).toBe(false); + expect(notice?.getAttribute('aria-disabled')).toBe('true'); + await act(async () => { (notice as HTMLButtonElement).click(); }); expect(notice?.closest('[data-control-state="incompatible"]')).not.toBeNull(); expect(notice?.getAttribute('title')).toContain('deviceOverview.deviceClientIncompatibleWithVersion'); expect(notice?.getAttribute('aria-label')).toMatch(/ · deviceOverview\.unavailableAction$/); diff --git a/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.tsx b/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.tsx index da48dc647f..2d60d8ae67 100644 --- a/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.tsx +++ b/src/web-ui/src/app/components/NavPanel/components/DeviceStatusControl.tsx @@ -1,7 +1,7 @@ import { useDeviceDirectory, resolveDeviceName, isDeviceControllable, deviceClientVersion } from '@/infrastructure/account/deviceDirectory'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { subscribeOverlayInteraction, createOverlayPortal, OverflowText, Button, Card, CardBody, CardHeader, Icon, IconButton, ScrollArea, type IconSize } from '@openbitfun/ui'; -import { ArrowRightLeft, ChevronLeft, ChevronRight, CircleAlert, House, MessageCircle, Monitor, MonitorSmartphone, Smartphone, Undo2, Unplug } from 'lucide-react'; +import { ArrowRightLeft, ChevronLeft, ChevronRight, CircleAlert, House, Link, MessageCircle, Monitor, MonitorSmartphone, Smartphone, Undo2, Unplug } from 'lucide-react'; import { useI18n } from '@/infrastructure/i18n/hooks/useI18n'; import { getAppearanceOverlayHost } from '@/infrastructure/appearance/runtime/AppearanceOverlayHost'; import { useAnchoredPopoverPosition } from '@/shared/utils/useAnchoredPopoverPosition'; @@ -450,7 +450,11 @@ const DeviceStatusControl: React.FC = ({ data-openbitfun-placement={popoverLayout?.placement ?? 'top'} data-control-state={displayedControlState} style={{ - top: `${popoverLayout?.top ?? 0}px`, + // Opening upward, the card is pinned by its bottom edge so any + // height change grows away from the trigger in the same frame + // instead of being repositioned a frame late. + top: popoverLayout?.bottom === undefined ? `${popoverLayout?.top ?? 0}px` : undefined, + bottom: popoverLayout?.bottom === undefined ? undefined : `${popoverLayout.bottom}px`, left: `${popoverLayout?.left ?? 0}px`, visibility: popoverLayout ? 'visible' : 'hidden', }} @@ -589,10 +593,14 @@ const DeviceStatusControl: React.FC = ({ icon={displayedIncompatible ? : displayedActive ? - : displayedDevice.local ? : } + : displayedDevice.local ? + : displayedConnected ? : } aria-label={`${displayedDevice.name} · ${displayedActionText}`} title={switchingDevice ? displayedActionText : displayedActionLabel} - disabled={displayedIncompatible || (!displayedActive && !isPreviewing) || !peerContext || switchingDevice || previewMotion.isTransitioning} + // An incompatible device stays focusable so its version notice + // (the tooltip) is reachable; it simply has no action. + disabled={!displayedIncompatible && ((!displayedActive && !isPreviewing) || !peerContext || switchingDevice || previewMotion.isTransitioning)} + aria-disabled={displayedIncompatible || undefined} loading={switchingDevice} data-testid={displayedIncompatible ? 'nav-device-status-incompatible' : displayedActive ? 'nav-device-status-disconnect' From 75c9b86ff12e7d4410f3ae908a24d9677960c6e2 Mon Sep 17 00:00:00 2001 From: Bob Lee Date: Tue, 3 Nov 2026 11:43:04 +0800 Subject: [PATCH 4/4] fix(web-ui): keep pet bubble titles legible under the reply disc On one-line bubbles the hover reply disc is centred on the title row, and the title end fades out beneath it instead of being covered. The title no longer shows its own truncation tooltip, so the bubble's tooltip with both title and status is the one that appears. Drop the attention-dot keyframes that nothing uses any more. --- .../AgentCompanionDesktopPet.scss | 31 +++++++++++-------- .../AgentCompanionDesktopPet.tsx | 5 +-- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.scss b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.scss index 7f2666be86..f04f849c0e 100644 --- a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.scss +++ b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.scss @@ -324,6 +324,24 @@ } } + /* One-line bubbles centre the disc on the title row instead of tucking it + into a corner it would half cover. */ + &__bubble-shell:not(.openbitfun-agent-companion-window__bubble-shell--single) &__bubble-compose, + &__bubble-shell--compact &__bubble-compose { + top: 50%; + bottom: auto; + transform: translateY(-50%); + } + + /* While the disc shows, the title end fades out beneath it instead of + reflowing, so the disc never sits on legible text. A mask only reads + alpha, so any opaque token works as the ink. */ + &--native-hover &__bubble-shell--replyable:hover &__bubble-title, + &__bubble-shell--replyable.openbitfun-agent-companion-window__bubble-shell--hovered &__bubble-title { + -webkit-mask-image: linear-gradient(to right, var(--openbitfun-color-surface-raised) calc(100% - 26px), transparent calc(100% - 6px)); + mask-image: linear-gradient(to right, var(--openbitfun-color-surface-raised) calc(100% - 26px), transparent calc(100% - 6px)); + } + &--native-hover &__bubble-shell:hover &__bubble-compose, &__bubble-shell--hovered &__bubble-compose { opacity: 1; @@ -592,19 +610,6 @@ } } -@keyframes openbitfun-agent-companion-attention-dot { - 0%, - 100% { - transform: scale(1); - opacity: 1; - } - - 50% { - transform: scale(1.5); - opacity: 0.65; - } -} - @keyframes openbitfun-agent-companion-pet-attention-glow { 0%, 100% { diff --git a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx index 077e0a9d09..ccbcc53906 100644 --- a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx +++ b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx @@ -1120,7 +1120,8 @@ export const AgentCompanionDesktopPet: React.FC = () => { strokeWidth={2.25} aria-hidden="true" /> - + {/* The bubble's own tooltip carries title and status together. */} + {task.title} @@ -1156,7 +1157,7 @@ export const AgentCompanionDesktopPet: React.FC = () => {
onBubbleContextMenu(event, task.sessionId)} > {isComposingTask ? (