From 6057ce59e57d3040c45f0c958ea39c1a32aabe20 Mon Sep 17 00:00:00 2001 From: chengyongru <2755839590@qq.com> Date: Fri, 20 Nov 2026 22:56:34 +0800 Subject: [PATCH] refactor(webui): colocate composer palette and automation calendar styles --- webui/COMPONENTS.md | 2 +- .../settings/system/AutomationCalendar.tsx | 1 + .../settings/system/automation-calendar.css | 29 ++++++++ .../src/components/thread/ComposerPalette.tsx | 1 + .../components/thread/composer-palette.css | 49 ++++++++++++ webui/src/globals.css | 74 +------------------ 6 files changed, 82 insertions(+), 74 deletions(-) create mode 100644 webui/src/components/settings/system/automation-calendar.css create mode 100644 webui/src/components/thread/composer-palette.css diff --git a/webui/COMPONENTS.md b/webui/COMPONENTS.md index 6533c731f..283f2b263 100644 --- a/webui/COMPONENTS.md +++ b/webui/COMPONENTS.md @@ -46,7 +46,7 @@ Bundled channel marks in `public/brand/channels/` use the SVG paths and brand co | `src/components/icons/` | Product-specific icon vocabulary | `product-icons.tsx` | | `nanobot/channels//webui/` | Channel-owned screens, components, and translations | Feishu assistants, Linear setup, Weixin connection | -Supporting hooks and display-model helpers stay near the feature that owns them. Common theme tokens and reusable CSS treatments live in `src/globals.css`, `tailwind.config.js`, and the relevant `ui/` modules. The component inventory lists `.tsx` modules; pure `.ts` helpers remain discoverable through their callers and source imports. +Supporting hooks and display-model helpers stay near the feature that owns them. Keep a component’s styles, including its responsive and accessibility variants, next to the component and import them there. Reserve `src/globals.css`, `tailwind.config.js`, and the shared `ui/` modules for theme tokens, document defaults, and treatments used across features. The component inventory lists `.tsx` modules; pure `.ts` helpers remain discoverable through their callers and source imports. `NanobotClient` adapts WebSocket frames into observations for its `ClientRunLedger`. The ledger owns each chat's message delivery, run identities, clocks, and completion records, and returns effects for the client to apply to its queues and subscribers. A dropped connection makes unconfirmed delivery unknown while durable runs remain unresolved. Wire completion still permits late final messages; canonical completion records suppress matching top-level turn events. `useNanobotStream` owns message projection and render batching, while `ThreadShell` adopts canonical history and confirms completion after the messages commit. diff --git a/webui/src/components/settings/system/AutomationCalendar.tsx b/webui/src/components/settings/system/AutomationCalendar.tsx index 61276fe5b..ae7e86c5f 100644 --- a/webui/src/components/settings/system/AutomationCalendar.tsx +++ b/webui/src/components/settings/system/AutomationCalendar.tsx @@ -8,6 +8,7 @@ import { formControlFocusClassName } from "@/components/ui/form-control"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import type { SessionAutomationJob } from "@/lib/types"; import { cn } from "@/lib/utils"; +import "./automation-calendar.css"; type CalendarEntry = { id: string; diff --git a/webui/src/components/settings/system/automation-calendar.css b/webui/src/components/settings/system/automation-calendar.css new file mode 100644 index 000000000..b66cb824f --- /dev/null +++ b/webui/src/components/settings/system/automation-calendar.css @@ -0,0 +1,29 @@ +.automation-calendar-grid { display: none; } +.automation-calendar-agenda { display: block; } +@container automations (min-width: 44rem) { + .automation-calendar-grid { display: block; } + .automation-calendar-agenda { display: none; } + .automation-calendar-weekdays { + display: grid; + grid-template-columns: repeat(7, minmax(0, 1fr)); + } + .automation-calendar-weekdays > div { + padding: 8px 10px; + color: hsl(var(--muted-foreground)); + font-size: 10px; + line-height: 16px; + text-align: end; + } + .automation-calendar-month { + display: grid; + grid-template-columns: repeat(7, minmax(0, 1fr)); + } + .automation-calendar-day { + min-block-size: 112px; + min-inline-size: 0; + border-inline-end: 1px solid hsl(var(--border) / 0.55); + border-block-end: 1px solid hsl(var(--border) / 0.55); + } + .automation-calendar-day:nth-child(7n) { border-inline-end: 0; } + .automation-calendar-day:nth-last-child(-n + 7) { border-block-end: 0; } +} diff --git a/webui/src/components/thread/ComposerPalette.tsx b/webui/src/components/thread/ComposerPalette.tsx index 0d66c0d95..36ae9c045 100644 --- a/webui/src/components/thread/ComposerPalette.tsx +++ b/webui/src/components/thread/ComposerPalette.tsx @@ -21,6 +21,7 @@ import { logoFallbackUrls } from "@/lib/provider-brand"; import { sessionHandleColor } from "@/lib/session-handle"; import type { SessionMention } from "@/lib/types"; import { cn } from "@/lib/utils"; +import "./composer-palette.css"; const PALETTE_CHROME_PX = 12; diff --git a/webui/src/components/thread/composer-palette.css b/webui/src/components/thread/composer-palette.css new file mode 100644 index 000000000..3d79f7e57 --- /dev/null +++ b/webui/src/components/thread/composer-palette.css @@ -0,0 +1,49 @@ +@keyframes composer-palette-enter { + from { + opacity: 0; + transform: translateY(var(--palette-enter-y, 4px)) scale(0.985); + } + to { + opacity: 1; + transform: translateY(0) scale(1); + } +} + +@keyframes composer-palette-preview-in { + from { + opacity: 0.55; + transform: translateY(2px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +.composer-palette-surface { + --palette-enter-y: 4px; + transform-origin: bottom center; + animation: composer-palette-enter 130ms cubic-bezier(0.16, 1, 0.3, 1); +} + +.composer-palette-surface[data-placement="below"] { + --palette-enter-y: -4px; + transform-origin: top center; +} + +.composer-palette-surface[data-placement="beside"] { + --palette-enter-y: 0px; + transform-origin: left center; +} + +.composer-palette-preview-body { + animation: composer-palette-preview-in 110ms ease-out; +} + +@media (prefers-reduced-motion: reduce) { + .composer-palette-surface, .composer-palette-preview-body { animation: none; } +} + +@media (forced-colors: active) { + .composer-palette-surface { outline: 1px solid CanvasText; } +} diff --git a/webui/src/globals.css b/webui/src/globals.css index e8787f991..971744b7d 100644 --- a/webui/src/globals.css +++ b/webui/src/globals.css @@ -1489,48 +1489,6 @@ container-type: inline-size; } -@keyframes composer-palette-enter { - from { - opacity: 0; - transform: translateY(var(--palette-enter-y, 4px)) scale(0.985); - } - to { - opacity: 1; - transform: translateY(0) scale(1); - } -} - -@keyframes composer-palette-preview-in { - from { - opacity: 0.55; - transform: translateY(2px); - } - to { - opacity: 1; - transform: translateY(0); - } -} - -.composer-palette-surface { - --palette-enter-y: 4px; - transform-origin: bottom center; - animation: composer-palette-enter 130ms cubic-bezier(0.16, 1, 0.3, 1); -} - -.composer-palette-surface[data-placement="below"] { - --palette-enter-y: -4px; - transform-origin: top center; -} - -.composer-palette-surface[data-placement="beside"] { - --palette-enter-y: 0px; - transform-origin: left center; -} - -.composer-palette-preview-body { - animation: composer-palette-preview-in 110ms ease-out; -} - .dark .thread-composer-surface, .dark .context-inspector-surface, .dark .user-message-surface, @@ -1540,7 +1498,6 @@ @media (prefers-reduced-motion: reduce) { .thread-composer-surface { transition: var(--theme-paint-transition, none); } - .composer-palette-surface, .composer-palette-preview-body { animation: none; } .pending-edge-overlay[data-pending-edge-overlay="pending"] .pending-edge-layer-dashed { border-color: hsl(var(--muted-foreground) / 0.30); animation: none; @@ -1560,7 +1517,7 @@ } @media (forced-colors: active) { - .thread-composer-surface, .composer-palette-surface, .context-inspector-surface, .user-message-surface, .side-panel-surface { outline: 1px solid CanvasText; } + .thread-composer-surface, .context-inspector-surface, .user-message-surface, .side-panel-surface { outline: 1px solid CanvasText; } .user-message-surface-dashed { outline-style: dashed; } .user-message-collapsible-masked { -webkit-mask-image: none; @@ -1966,35 +1923,6 @@ } } } - .automation-calendar-grid { display: none; } - .automation-calendar-agenda { display: block; } - @container automations (min-width: 44rem) { - .automation-calendar-grid { display: block; } - .automation-calendar-agenda { display: none; } - .automation-calendar-weekdays { - display: grid; - grid-template-columns: repeat(7, minmax(0, 1fr)); - } - .automation-calendar-weekdays > div { - padding: 8px 10px; - color: hsl(var(--muted-foreground)); - font-size: 10px; - line-height: 16px; - text-align: end; - } - .automation-calendar-month { - display: grid; - grid-template-columns: repeat(7, minmax(0, 1fr)); - } - .automation-calendar-day { - min-block-size: 112px; - min-inline-size: 0; - border-inline-end: 1px solid hsl(var(--border) / 0.55); - border-block-end: 1px solid hsl(var(--border) / 0.55); - } - .automation-calendar-day:nth-child(7n) { border-inline-end: 0; } - .automation-calendar-day:nth-last-child(-n + 7) { border-block-end: 0; } - } .settings-stack > :not([hidden]) ~ :not([hidden]) { margin-block-start: var(--settings-module-gap, 20px); }