Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 feat(chat): redesign message multi-select & forward (#16560)

René Wang0cc52030b2ee
diff --git a/.agents/skills/react/SKILL.md b/.agents/skills/react/SKILL.md
index 9d0632f2921..547dd05c230 100644
--- a/.agents/skills/react/SKILL.md
+++ b/.agents/skills/react/SKILL.md
@@ -56,8 +56,7 @@ For Modal specifically, see the dedicated **modal** skill — use the imperative
## Loading indicators
**Do NOT use antd `Spin` / `<Spin />`.** Use a project loader
-(`NeuralNetworkLoading`, `DotsLoading`, …) — see the **ux** skill ("Loading
-visuals") for the component table and when to use each.
+(`NeuralNetworkLoading`, `DotsLoading`, …) instead.
## State
@@ -118,7 +117,7 @@ errorElement: <ErrorBoundary />;
| ------------------------------------------------------------------ | --------------------------------------------------------------------------- |
| Using `next/link` in SPA | Use `react-router-dom` `Link` |
| Using antd directly | Use `@lobehub/ui/base-ui` first, then `@lobehub/ui` |
-| antd `Spin` / `<Spin />` for loading | Use `NeuralNetworkLoading` / project loaders (see the **ux** skill) |
+| antd `Spin` / `<Spin />` for loading | Use `NeuralNetworkLoading` / project loaders |
| `import { Select } from '@lobehub/ui'` | `import { Select } from '@lobehub/ui/base-ui'` |
| `import { Modal } from '@lobehub/ui'` + `<Modal open>` declarative | `createModal` / `confirmModal` from `@lobehub/ui/base-ui` (see modal skill) |
| `import { DropdownMenu/Popover/Switch } from '@lobehub/ui'` | Import same name from `@lobehub/ui/base-ui` instead |
diff --git a/.agents/skills/ux/SKILL.md b/.agents/skills/ux/SKILL.md
deleted file mode 100644
index c49fab567e4..00000000000
--- a/.agents/skills/ux/SKILL.md
+++ /dev/null
@@ -1,366 +0,0 @@
----
-name: ux
-description: 'LobeHub product design values / principles / checklists. Load this skill whenever the work touches user-interface features or implementation — designing or building any user-facing flow — to get better UX results.'
-user-invocable: false
----
-
-# UX — Design Values & Execution Checklists
-
-How LobeHub products should feel, and concrete rules to get there. Use this when
-**building or reviewing** any user-facing flow. For component/styling choices see
-**react**, for wording see **DESIGN.md** (Voice & Content), for imperative modal
-wiring see **modal**.
-
-## Design values
-
-LobeHub follows four product design values — **Natural・Meaningful・Certainty・
-Growth**. Read them before designing:
-**[references/design-values.md](references/design-values.md)** (definitions +
-conflict priority).
-
-> The checklists below are the execution layer. Each item is tagged with the
-> value(s) it serves; for what those values mean, see the file above.
-
-## Interaction principles
-
-Use these principles before the execution checklists when a flow has multiple
-plausible interaction patterns.
-
-### Preserve the surface contract・Meaningful・Natural
-
-Every surface carries a task promise: chat keeps the user in a working
-conversation, a document page supports focused reading / editing, a settings page
-supports configuration, and so on. Default interactions should continue that
-promise instead of unexpectedly moving the user into another mode. Prefer
-in-context surfaces (portal / panel / drawer) for reference and auxiliary work;
-reserve full-page navigation for committed focus or explicit mode switches.
-
-### Consistency is semantic, not mechanical・Certainty・Meaningful
-
-Consistency means the same user intent behaves the same way in the same surface.
-It does not mean the same component must do the same thing everywhere. When a
-component is reused across surfaces, let the parent surface provide the
-interaction strategy so behavior follows intent rather than implementation
-convenience.
-
-### Layout communicates role・Natural・Certainty
-
-Element placement is part of the interface language. Identity and location
-(breadcrumbs, titles, object labels) should read separately from state and
-actions (save status, sharing, panel toggles, overflow menus). When these roles
-are mixed, users have to infer whether an element describes the current object or
-acts on it.
-
-## How this is organized
-
-The checklists are grouped by **interaction type** — the kind of thing the user
-is doing. Jump to the module that matches the surface you're building (reading a
-list, editing content, running an action, …); each module collects the rules
-specific to that interaction. The same surface often spans several modules (an
-editable list is Read + Edit + Act) — walk each that applies.
-
----
-
-## 1. Read — viewing data & lists
-
-Any surface that **displays** records, lists, or detail. Covers the states a data
-view can be in, behavior at scale, and keeping the user's place visible.
-
-### 1.1 Data states: empty / loading / error・Meaningful・Certainty
-
-Every data surface has **four** states — design all of them, not just "has data".
-
-- [ ] **Empty state is a purpose-built page, not a blank screen.** It explains what
- this is, why it's empty, and gives a clear next action (CTA + value props).
- ✅ Devices: an empty "Connect your first device" page with primary/secondary
- connect paths and "what you can do once connected" cards — ❌ not a bare title
- over skeleton rows or a blank body. _(Meaningful)_
-- [ ] **Distinguish the empty variants** — "no data yet" (onboarding CTA) vs
- "no match for filters" (clear-filters affordance) are different screens. _(Certainty)_
-- [ ] **Always-rendered chrome still needs a body empty state.** When a surface
- keeps its toolbar / header mounted even with no data (so a create / `+`
- affordance stays reachable), the **body** below it must still render an empty
- placeholder — persistent chrome is not an excuse to leave the content area
- blank. ✅ The agent **Documents** tab keeps its new-folder / new-doc toolbar
- and renders an `Empty` below it when there are no documents — ❌ not a toolbar
- over dead space. _(Meaningful)_
-- [ ] **Loading state** designed (skeleton / NeuralNetworkLoading), not a flash of
- blank or layout shift. _(Natural)_
-- [ ] **Error state** designed — surface the reason and a retry/back path. _(Meaningful)_
-
-### 1.2 Lists at scale・Certainty・Natural
-
-A list/data page must be designed for its **whole range of sizes**, not just the
-demo data.
-
-- [ ] **Walk the scale: 1 / 2 / 5 / 20 / 100 / 1k–10k rows.** Pick the right
- mechanism per range — plain render → load-more / pagination → virtual scroll;
- add batch-select / bulk actions once counts get large. _(Certainty)_
-- [ ] **Co-design empty / loading / error with the data state** (see §1.1). A list
- isn't done until all four render well. _(Natural)_
-
-### 1.3 Selection visibility in scrolled lists・Certainty・Natural
-
-A capped / scrollable / virtualized list mounts at `scrollTop = 0`. If the
-active item sits below the fold, the user lands on a valid selection that is
-**off-screen** — and reads it as "nothing is selected" or a broken page. Any
-list that can open with a pre-selected item must **scroll that item into view**.
-This is an easy case to miss: it only shows up once the list is long enough and
-the selection is restored rather than freshly clicked.
-
-- [ ] **Scroll the active item into view on mount / restore.** When the selection
- is restored from a URL query, deep link, or persisted state (not a fresh
- click), bring it into view — the container starts at the top otherwise. ✅
- The nested thread list is capped to \~9 rows; a thread restored from
- `?thread=` below the fold is scrolled into view on mount. _(Certainty)_
-- [ ] **Hardest when the selection has no other anchor.** If the parent/container
- row isn't highlighted while a child is active (no breadcrumb, no header
- echo), an off-screen active row means **zero** visible feedback — design
- for exactly this case. _(Meaningful)_
-- [ ] **Use `block: 'nearest'` (or equivalent).** Only scroll when the row is
- actually off-screen; an already-visible selection must not jump. _(Natural)_
-- [ ] **Re-run once async rows mount.** The active id is usually known before the
- list finishes loading; key the scroll off a list-ready signal (e.g. row
- count), not only off the id, so a restored selection still lands when the
- data arrives. _(Certainty)_
-- [ ] **Mirror it across duplicated list variants** so the behavior can't regress
- in just one (e.g. parallel agent / group lists). _(Certainty)_
-
-### 1.4 Option visibility in pickers・Certainty・Meaningful
-
-- [ ] **Pickers list every valid target.** Watch for options dropped by backend
- list queries (pagination, `virtual` flags, scope filters) and add them back.
- ✅ The default "LobeAI" (inbox) agent is `virtual` and excluded from the
- sidebar list, so the move picker re-adds it. An empty picker must mean
- "genuinely none", never "we filtered out the only option". _(Meaningful)_
-
-### 1.5 Default view reflects entry intent & data state・Certainty・Meaningful
-
-A surface with multiple tabs / views / panels has a **landing** selection. Don't
-hardcode it to "the first tab" — derive it from **(a) how the user got here** (the
-intent their navigation carried) and **(b) which views actually have data**. A
-static default that lands the user on an empty tab while a sibling holds exactly
-what they came for reads as broken. This pairs with §1.1: the empty state is the
-fallback _within_ a view; this rule is about not landing on that empty view in the
-first place when a better one exists.
-
-- [ ] **Open on the tab the entry implies.** When navigation carries intent — the
- user clicked a Skill, a file, a record of a specific type — land on the view
- that shows it, not the static first tab. ✅ Opening a document page by clicking
- a **skill** lands the right panel on the **Skills** tab; opening a plain
- document lands on **Documents**. _(Meaningful)_
-- [ ] **Fall back to a populated view when the default would be empty.** If the
- default tab has no data but a sibling does, default to the populated one so
- the surface opens on content. ✅ An agent with only skills (no documents)
- opens the panel on **Skills** instead of an empty **Documents** tab. _(Certainty)_
-- [ ] **Decide from resolved state, not mid-load.** Compute the default once the
- data has loaded — choosing off an empty _in-flight_ list flips the tab as data
- arrives. Hold the static default while loading, switch on resolved-empty. _(Certainty)_
-- [ ] **A manual choice wins and sticks.** Once the user picks a tab, stop
- auto-selecting — track "user-picked" separately (e.g. a nullable `pickedTab`
- that overrides the derived default) so later data changes don't yank them off
- their choice. _(Natural)_
-
----
-
-## 2. Edit — entering & changing content
-
-Any surface where the user **types or edits**. Input is expensive effort; the
-overriding rule is **never lose it**.
-
-### 2.1 Protect in-progress edits・Certainty・Meaningful
-
-Typed / edited content is real user effort; losing it is one of the most
-infuriating outcomes a product can produce. Whenever an editor holds unsaved
-input, assume the exit can be **accidental** — a misclick, a refresh, a crash, a
-navigation, a failed save — and build a safety net: back the draft up locally and
-recover it.
-
-- [ ] **Back up the draft locally as the user types.** Persist to
- localStorage / IndexedDB / store so a refresh, crash, accidental close, or
- navigation doesn't vaporize the content. _(Certainty)_
-- [ ] **Restore on return.** Coming back to the same editing context auto-restores
- (or offers to restore) the unsaved draft, rather than showing a blank field. _(Meaningful)_
-- [ ] **Guard destructive exits.** Closing / navigating / switching items away
- from a dirty editor warns or auto-saves — never silently discards. _(Certainty)_
-- [ ] **Survive a failed save.** If the save errors, keep the user's content in
- the field / draft and let them retry; never clear the input on failure. _(Meaningful)_
-- [ ] **Scope the draft to its target** (per topic / message / item id) so drafts
- don't bleed across entities or resurrect on the wrong item. _(Certainty)_
-
----
-
-## 3. Act — operations, flows & buttons
-
-Any surface where the user **performs an action** — a single op, a bulk op, or a
-multi-step flow. Covers momentum, focus, and full entity lifecycle.
-
-### 3.1 Flow & momentum・Natural・Meaningful
-
-Every action chain must **push the user forward**, never dead-end or block the flow.
-
-- [ ] **Forward momentum** — after any operation, lead the user to the next step,
- don't just stop. _(Meaningful)_
-- [ ] **Success state = primary "go to result", secondary "dismiss"** — the strong
- button is the forward action (take me to the result); "Done" is the weak/
- secondary button. ✅ After moving topics: primary = "Go to «target»", secondary
- \= "Done". _(Meaningful・Natural)_
-- [ ] **Bulk ⇄ single-item parity** — an action on a multi-select toolbar must also
- be reachable on a single item (its context menu), and vice versa. _(Certainty)_
-- [ ] **Confirm → in-progress → done, in one surface** — bulk/irreversible/async
- ops use a modal state machine: a confirm step stating exactly what happens →
- an in-progress view with **dismissal locked** → a done (or error) view in the
- same modal. Never fire-and-forget with only a toast; never leave a dead
- spinner. _(Certainty・Meaningful)_
-
-### 3.2 One primary button per surface・Certainty
-
-- [ ] **One primary button per surface.** The single primary CTA tells the user the
- core action; everything else is secondary/tertiary. Never a pile of primary
- buttons competing for attention. _(Certainty)_
-
-### 3.3 Entity lifecycle completeness・Meaningful・Certainty
-
-The recurring trap: a feature ships only the **display** of a list, but edit /
-delete / management are never built — so the user can add something and then be
-stuck with it. For every entity a user can see, design its **full lifecycle**:
-create / read / update / delete, plus state transitions (enable/disable,
-connect/disconnect, install/uninstall). A read-only list the user can't manage
-breaks the flow.
-
-**The allowed operation set depends on the entity's source / ownership** — decide
-it explicitly _before_ building. Worked example, the tools/connectors list:
-
-| Entity class | Add | Edit | Remove |
-| ----------------------------------- | ------- | --------- | ------------------ |
-| Official / built-in (skills, tools) | — | — | ✗ not removable |
-| Community (installed MCP) | install | configure | uninstall / remove |
-| User-custom (custom connector) | create | edit | delete |
-
-- [ ] **No display-only features.** For every listed entity, enumerate CRUD +
- lifecycle ops and build the ones that apply. _(Meaningful)_
-- [ ] **Operation set per source/ownership class** — built-in may be read-only;
- anything the user _installed_ must be removable; anything the user _created_
- must be editable **and** deletable. _(Certainty)_
-- [ ] **Each item exposes its allowed ops** (hover action / context menu / detail
- page), and there's a clear entry point to add/create where applicable. _(Natural)_
-- [ ] **An intentionally-absent op is a documented decision, not an oversight**
- (e.g. official tools can't be deleted — by design). _(Certainty)_
-
----
-
-## 4. Feedback — loading & system response
-
-How the product **answers back** while and after the user acts — loading visuals
-and proactive guardrails.
-
-### 4.1 Loading visuals・Natural
-
-**Never use antd `Spin`** — it doesn't match the product's loading visual. Use a
-project loader:
-
-| Need | Component |
-| --------------------------- | ----------------------------------------------------------------------------- |
-| Default loading (in-flight) | `NeuralNetworkLoading` from `@/components/NeuralNetworkLoading` (`size` prop) |
-| Inline dots | `DotsLoading` / `BubblesLoading` from `@/components` |
-| Branded full-page | `Loading` from `@/components/Loading/BrandTextLoading` |
-| List / card placeholder | a skeleton (e.g. `SkeletonList`) |
-
-When in doubt, reach for `NeuralNetworkLoading` — it's the default in-flight
-indicator (e.g. modal "in progress" states).
-
-**Minimise layout shift (CLS): swap text for skeleton in place, keep the chrome.**
-The strongest loading state changes as little of the final layout as possible, so
-nothing jumps when the real content lands. When a surface already knows its shape
-(a card, a row, a list item), **keep the layout elements — the container, border,
-radius, padding, icon — and replace only the text/data with a skeleton sized like
-the text it stands in for.** A generic full-block / full-card skeleton (or a
-centred spinner that the real content later pushes aside) is heavier and shifts
-the layout; an in-place text→skeleton swap is the optimal design.
-
-- [ ] **Reuse the loaded component's chrome for the skeleton.** Render the same
- card/row wrapper and only skeletonise the text slots, so loading→loaded is a
- content swap, not a relayout. _(Certainty・Natural)_
-- [ ] **Size skeleton lines like the text they replace** (line height, count,
- rough width) so the placeholder height ≈ the real height. _(Certainty)_
-- [ ] **Don't downgrade a known-shape surface to a bare block/spinner** — that
- throws away the layout you already have and reintroduces the shift. _(Natural)_
-
-### 4.2 Capability-gated features・Certainty・Meaningful
-
-A feature can be fully built and still produce a broken result when the selected
-model — or its still-loading config — **can't deliver the capability the feature
-depends on** (for example, an agentic run on a model without tool calling). This
-is usually the user's configuration choice, not a defect; but if the product stays
-silent the user reads it as the product being broken. When a feature's success
-depends on a capability the current config may lack, the product owes a
-**proactive, non-blocking reminder** — a guardrail, not a gate.
-
-- [ ] **Surface the mismatch, don't fail silently.** When a feature needs a model
- capability (tool calling, vision, reasoning, long context) the current model
- lacks, show a soft inline warning at the point of action — never a hard block
- or a modal that stops the user. _(Meaningful)_
-- [ ] **Stay reactive.** The reminder clears the moment the user switches to a
- capable model — derive it from live state, not a one-shot check. _(Natural)_
-- [ ] **Don't warn while config is loading.** A capability that hasn't resolved yet
- looks "unsupported"; warning then is a false alarm — exactly the glitch users
- mistake for a product bug. Warn only on a _resolved_ unsupported state. _(Certainty)_
-- [ ] **Scope to the mode that needs it.** Show only when the capability-dependent
- mode is on; one reminder per root cause, never a pile of overlapping notices. _(Natural・Certainty)_
-- [ ] **State the problem and the remedy.** The copy says what's wrong _and_ what
- the user should do about it. _(Meaningful)_
-
----
-
-## 5. Grow — discoverability & progressive disclosure
-
-How the product **deepens** as the user's needs deepen.
-
-### 5.1 Progressive disclosure・Growth
-
-The product should grow with the user — deeper power shows up as needs deepen.
-
-- [ ] **Progressive disclosure** — keep the novice path clean; reveal advanced
- capabilities as the user gets there, don't dump everything at once. _(Growth・Natural)_
-- [ ] **Surface related actions at the moment of need** — make the next capability
- discoverable in context (e.g. after the first item exists, offer what to do
- with it), not buried in a far-off menu. _(Growth・Meaningful)_
-
----
-
-## Quick review checklist
-
-**Read — viewing data & lists**
-
-- [ ] Empty / loading / error states are all designed; empty is a real page with a CTA. Always-rendered chrome (toolbar/header) still gets a body empty state.
-- [ ] List designed across 1 → 10k rows (virtual scroll / pagination / batch as needed).
-- [ ] Capped/scrollable/virtualized list scrolls the restored active item into view on mount (`block: 'nearest'`, re-run after async rows mount).
-- [ ] Pickers show all valid targets (default/inbox included); empty = truly none.
-- [ ] Multi-tab/view surface lands on the tab the entry intent implies (and falls back to a populated view, decided from resolved state); a manual pick sticks.
-
-**Edit — entering & changing content**
-
-- [ ] Editors back up in-progress input locally and recover it after refresh/crash/failed-save; destructive exits warn, never silently discard.
-
-**Act — operations, flows & buttons**
-
-- [ ] Action leads the user forward; success offers a primary "go to result".
-- [ ] Bulk action has a single-item entry (and vice versa).
-- [ ] Async/bulk/irreversible action: confirm → in-progress (locked) → done/error.
-- [ ] Exactly one primary button per surface.
-- [ ] Listed entities have their full lifecycle (not display-only); ops match source (built-in / installed / custom).
-
-**Feedback — loading & system response**
-
-- [ ] No antd `Spin`; use `NeuralNetworkLoading` / project loaders.
-- [ ] Capability-gated feature warns (soft, reactive, load-gated) when the model can't deliver it; copy gives the remedy.
-
-**Grow — discoverability & progressive disclosure**
-
-- [ ] Advanced capability is progressively disclosed / discoverable at the moment of need.
-
-## Related skills
-
-- **modal** — imperative `createModal` state-machine wiring for confirm/progress/done.
-- **DESIGN.md** (Voice & Content) — wording for confirm / done / empty / error states.
-- **react** — component priority, `Button` usage, styling.
diff --git a/.agents/skills/ux/references/design-values.md b/.agents/skills/ux/references/design-values.md
deleted file mode 100644
index 33452a9df8c..00000000000
--- a/.agents/skills/ux/references/design-values.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# LobeHub Design Values (设计价值观)
-
-The philosophy behind every LobeHub interface. Read this before designing or
-reviewing a flow; the per-aspect execution rules live in the parent
-[SKILL.md](../SKILL.md) and each checklist item is tagged with the value(s) it serves.
-
-Adapted from Ant Design's design values
-(<https://ant.design/docs/spec/values-cn>, <https://zhuanlan.zhihu.com/p/44809866>).
-LobeHub adopts all four.
-
-## 自然 (Natural)
-
-Minimise cognitive load. Digital products keep getting more complex while human
-attention stays scarce — so the interface should feel as effortless as the
-physical world. The next step should be obvious without thinking; the product
-proactively carries the user forward (sensible defaults, AI-assisted decisions,
-smooth transitions) rather than making them stop and figure things out.
-
-## 意义感 (Meaningful)
-
-Every screen is rooted in the user's real goal, not an isolated feature. Make the
-objective clear, give immediate feedback on the result of each action, and always
-point at the next meaningful step. Calibrate difficulty — neither a patronising
-over-simplification nor an overwhelming wall — so the user keeps a sense of
-progress and accomplishment.
-
-## 确定性 (Certainty)
-
-Low-entropy, predictable interactions. Reuse the same patterns, components, and
-wording so behaviour is never surprising. Keep a single clear focus per surface,
-and design **every** state (empty / loading / error / success) so nothing is left
-undefined. Restraint over cleverness: fewer, consistent rules beat many bespoke
-ones.
-
-## 生长性 (Growth)
-
-The product grows together with the user. As needs deepen and roles evolve,
-surface advanced capabilities progressively and make related features
-discoverable at the moment they become relevant — without crowding the novice
-path. Bridge product value to the user's changing scenarios and aim for
-human–machine symbiosis (人机共生): the user and the agent co-evolve, each making
-the other more capable over time.
-
-## Priority when values conflict
-
-For moment-to-moment interaction decisions: **意义感 ≳ 自然 > 确定性** — never
-sacrifice the user's goal or forward momentum just to keep things uniform.
-
-**生长性 (Growth)** is a longer-horizon lens: weigh it when shaping how a feature
-is discovered and how it scales with the user, not when resolving a single-screen
-layout trade-off.
diff --git a/AGENTS.md b/AGENTS.md
index 2f8354bd28b..66a6c9dc8bf 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -137,7 +137,7 @@ bun run type-check
Before reviewing a PR / diff / branch change, read the **review-checklist** skill (`.agents/skills/review-checklist/SKILL.md`) — it lists the recurring mistakes specific to this codebase.
-When designing or reviewing user-facing flows (empty/loading/error states, confirmations, async feedback, button hierarchy, lists at scale, pickers), follow the **ux** skill (`.agents/skills/ux/SKILL.md`) — LobeHub's design values (自然 / 意义感 / 确定性) plus per-aspect execution checklists.
+When designing or reviewing user-facing flows (empty/loading/error states, confirmations, async feedback, button hierarchy, lists at scale, pickers), follow LobeHub's design values in [`DESIGN.md`](./DESIGN.md) — Natural / Meaningful / Certainty / Growth (自然 / 意义感 / 确定性 / 成长).
<!-- BEGIN:nextjs-agent-rules -->
# This is NOT the Next.js you know
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index b61beeed9b8..36896890010 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -331,12 +331,15 @@ export default {
'messageForward.deleteConfirm.title': 'Delete messages',
'messageForward.empty': 'Select at least one message to forward',
'messageForward.modal.empty': 'No other agents available',
+ 'messageForward.modal.moreMessages': '+{{count}} more messages',
'messageForward.modal.noRecipients': 'Pick agents on the left to forward to',
'messageForward.modal.notePlaceholder': 'Add a note (optional) — sent along with the messages',
'messageForward.modal.recipients': 'Send to ({{count}})',
+ 'messageForward.modal.removeRecipient': 'Remove recipient',
'messageForward.modal.searchPlaceholder': 'Search agents…',
'messageForward.modal.sendCount': 'Forward ({{count}})',
'messageForward.modal.title': 'Forward to Agent',
+ 'messageForward.role.agent': 'Agent',
'messageForward.role.assistant': 'Assistant',
'messageForward.role.user': 'User',
'messageForward.success': 'Forwarded to {{title}}',
diff --git a/src/features/Conversation/ChatList/components/VirtualizedList.tsx b/src/features/Conversation/ChatList/components/VirtualizedList.tsx
index 3b18b48c610..8aa091fc8e8 100644
--- a/src/features/Conversation/ChatList/components/VirtualizedList.tsx
+++ b/src/features/Conversation/ChatList/components/VirtualizedList.tsx
@@ -84,6 +84,11 @@ const VirtualizedList = memo<VirtualizedListProps>(
const isAutoScrollEnabled = useAutoScrollEnabled();
+ // While multi-selecting, let message rows span the full stream width so the
+ // clickable/highlight band fills the available space instead of the centered
+ // reading column.
+ const isSelectionMode = useConversationStore(messageStateSelectors.isSelectionMode);
+
// Store actions
const registerVirtuaScrollMethods = useConversationStore((s) => s.registerVirtuaScrollMethods);
const setScrollState = useConversationStore((s) => s.setScrollState);
@@ -347,7 +352,11 @@ const VirtualizedList = memo<VirtualizedListProps>(
}
return (
- <WideScreenContainer key={messageId} style={{ position: 'relative' }}>
+ <WideScreenContainer
+ fullWidth={isSelectionMode}
+ key={messageId}
+ style={{ position: 'relative' }}
+ >
{content}
{isLastItem && isAutoScrollEnabled && !spacerActive && <AutoScroll />}
</WideScreenContainer>
diff --git a/src/features/Conversation/MessageForward/ForwardModal.tsx b/src/features/Conversation/MessageForward/ForwardModal.tsx
index a69697e153e..f18725556ff 100644
--- a/src/features/Conversation/MessageForward/ForwardModal.tsx
+++ b/src/features/Conversation/MessageForward/ForwardModal.tsx
@@ -1,11 +1,9 @@
'use client';
-import { ActionIcon, Flexbox, SearchBar, Text } from '@lobehub/ui';
+import { Flexbox, SearchBar, Text, TextArea } from '@lobehub/ui';
import { Button, Modal } from '@lobehub/ui/base-ui';
-import { Input } from 'antd';
import { createStaticStyles, cssVar, cx } from 'antd-style';
import isEqual from 'fast-deep-equal';
-import { X } from 'lucide-react';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -33,17 +31,27 @@ const styles = createStaticStyles(({ css }) => ({
margin-inline: -4px;
padding-inline: 4px;
`,
+ // Shared container holding the message preview and the note input, split by a
+ // divider above the input.
preview: css`
- overflow-y: auto;
- flex: 1;
-
- padding-block: 10px;
- padding-inline: 12px;
+ overflow: hidden;
border: 1px solid ${cssVar.colorBorderSecondary};
border-radius: ${cssVar.borderRadiusLG};
-
background: ${cssVar.colorFillQuaternary};
`,
+ previewLines: css`
+ overflow-y: auto;
+ flex: 1;
+ padding-block: 12px;
+ padding-inline: 12px;
+ `,
+ note: css`
+ background: transparent;
+ `,
+ noteDivider: css`
+ block-size: 1px;
+ background: ${cssVar.colorBorderSecondary};
+ `,
previewLine: css`
overflow: hidden;
@@ -52,8 +60,10 @@ const styles = createStaticStyles(({ css }) => ({
text-overflow: ellipsis;
white-space: nowrap;
`,
- recipientRemove: css`
- opacity: 0;
+ previewMore: css`
+ padding-block-start: 2px;
+ font-size: 12px;
+ color: ${cssVar.colorTextTertiary};
`,
row: css`
cursor: pointer;
@@ -67,10 +77,6 @@ const styles = createStaticStyles(({ css }) => ({
&:hover {
background-color: ${cssVar.colorFillTertiary};
-
- [data-remove] {
- opacity: 1;
- }
}
`,
rowSelected: css`
@@ -99,8 +105,7 @@ const ForwardModal = memo<ForwardModalProps>(({ open, onClose }) => {
return {
count: msgs.length,
lines: msgs.slice(0, 6).map((m) => ({
- role:
- m.role === 'user' ? t('messageForward.role.user') : t('messageForward.role.assistant'),
+ role: m.role === 'user' ? t('messageForward.role.user') : t('messageForward.role.agent'),
text: (m.content ?? '').replaceAll(/\s+/g, ' ').slice(0, 60),
})),
};
@@ -160,7 +165,7 @@ const ForwardModal = memo<ForwardModalProps>(({ open, onClose }) => {
value={keyword}
onChange={(e) => setKeyword(e.target.value)}
/>
- <Flexbox className={styles.list} gap={2}>
+ <Flexbox className={styles.list} gap={4}>
{candidates.length === 0 ? (
<Flexbox align={'center'} justify={'center'} padding={24}>
<Text type={'secondary'}>{t('messageForward.modal.empty')}</Text>
@@ -173,7 +178,7 @@ const ForwardModal = memo<ForwardModalProps>(({ open, onClose }) => {
horizontal
align={'center'}
className={cx(styles.row, checked && styles.rowSelected)}
- gap={10}
+ gap={8}
key={agent.id}
onClick={() => toggle(agent.id)}
>
@@ -191,54 +196,41 @@ const ForwardModal = memo<ForwardModalProps>(({ open, onClose }) => {
<div className={styles.divider} />
- {/* Right: recipients + forwarded content + note */}
- <Flexbox flex={1} gap={10} style={{ minWidth: 0 }}>
- <Text strong>{t('messageForward.modal.recipients', { count: selectedIds.length })}</Text>
- <Flexbox gap={2} style={{ maxHeight: 140, minHeight: 44, overflowY: 'auto' }}>
- {selectedAgents.length === 0 ? (
- <Text style={{ fontSize: 12, padding: '8px 0' }} type={'secondary'}>
- {t('messageForward.modal.noRecipients')}
- </Text>
- ) : (
- selectedAgents.map((agent) => (
- <Flexbox horizontal align={'center'} className={styles.row} gap={10} key={agent.id}>
- <AgentAvatar avatar={avatarOf(agent.avatar)} />
- <Text ellipsis style={{ flex: 1 }}>
- {agent.title || t('untitledAgent')}
- </Text>
- <ActionIcon
- data-remove
- className={styles.recipientRemove}
- icon={X}
- size={'small'}
- onClick={() => toggle(agent.id)}
- />
- </Flexbox>
- ))
- )}
- </Flexbox>
-
- <Flexbox className={styles.preview} gap={3}>
- <Text style={{ fontSize: 12 }} type={'secondary'}>
- {t('messageForward.transcript.header', { count: preview.count })}
- </Text>
- {preview.lines.map((line, i) => (
- <div className={styles.previewLine} key={i}>
- <Text strong style={{ fontSize: 12 }}>
- {line.role}:
- </Text>{' '}
- {line.text}
- </div>
- ))}
+ {/* Right: forwarded content preview + note */}
+ <Flexbox flex={1} gap={8} style={{ minWidth: 0 }}>
+ <Text style={{ fontSize: 12 }} type={'secondary'}>
+ {t('messageForward.transcript.header', { count: preview.count })}
+ </Text>
+ <Flexbox className={styles.preview} flex={1}>
+ <Flexbox className={styles.previewLines} flex={1} gap={4}>
+ {preview.lines.map((line, i) => (
+ <div className={styles.previewLine} key={i}>
+ <Text strong style={{ fontSize: 12 }}>
+ {line.role}:
+ </Text>{' '}
+ {line.text}
+ </div>
+ ))}
+ {preview.count > preview.lines.length && (
+ <div className={styles.previewMore}>
+ {t('messageForward.modal.moreMessages', {
+ count: preview.count - preview.lines.length,
+ })}
+ </div>
+ )}
+ </Flexbox>
+ <div className={styles.noteDivider} />
+ <TextArea
+ autoSize={{ maxRows: 4, minRows: 2 }}
+ className={styles.note}
+ placeholder={t('messageForward.modal.notePlaceholder')}
+ resize={false}
+ value={note}
+ variant={'borderless'}
+ onChange={(e) => setNote(e.target.value)}
+ />
</Flexbox>
- <Input.TextArea
- autoSize={{ maxRows: 4, minRows: 2 }}
- placeholder={t('messageForward.modal.notePlaceholder')}
- value={note}
- onChange={(e) => setNote(e.target.value)}
- />
-
<Flexbox horizontal gap={8} justify={'flex-end'}>
<Button onClick={handleClose}>{t('messageForward.bar.cancel')}</Button>
<Button disabled={selectedIds.length === 0} type={'primary'} onClick={handleForward}>
diff --git a/src/features/Conversation/MessageForward/MessageForwardFooter.tsx b/src/features/Conversation/MessageForward/MessageForwardFooter.tsx
index 9d88c73ce72..5084c178123 100644
--- a/src/features/Conversation/MessageForward/MessageForwardFooter.tsx
+++ b/src/features/Conversation/MessageForward/MessageForwardFooter.tsx
@@ -10,8 +10,8 @@ interface MessageForwardFooterProps {
}
/**
- * Wraps the chat composer: while multi-selecting it hides the input and shows
- * the selection action bar in its place (WeChat-style). The input stays mounted
+ * Wraps the chat composer: while multi-selecting it hides the input and docks
+ * the selection action bar at the bottom in its place. The input stays mounted
* but display:none so the editor/draft state survives toggling selection mode.
*/
const MessageForwardFooter = memo<MessageForwardFooterProps>(({ children }) => {
diff --git a/src/features/Conversation/MessageForward/MessageSelectionWrapper.tsx b/src/features/Conversation/MessageForward/MessageSelectionWrapper.tsx
index 13b42b3fb5e..c3cf1476cee 100644
--- a/src/features/Conversation/MessageForward/MessageSelectionWrapper.tsx
+++ b/src/features/Conversation/MessageForward/MessageSelectionWrapper.tsx
@@ -2,18 +2,43 @@
import { Flexbox } from '@lobehub/ui';
import { createStaticStyles, cssVar, cx } from 'antd-style';
-import { memo, type ReactNode, useCallback } from 'react';
+import { memo, type MouseEvent, type ReactNode, useCallback } from 'react';
+
+import { CONVERSATION_MIN_WIDTH } from '@/const/layoutTokens';
+import { useGlobalStore } from '@/store/global';
+import { systemStatusSelectors } from '@/store/global/selectors';
import { messageStateSelectors, useConversationStore } from '../store';
import { isSelectableRole } from './selectableRoles';
import SelectCircle from './SelectCircle';
const styles = createStaticStyles(({ css }) => ({
- // Nudge the circle down so it lines up with the message's first line instead
- // of floating at the very top of the row.
+ // Full-bleed clickable band, WeChat-style. Stretches to the full stream width
+ // regardless of the reading-column preference; the lane inside keeps the
+ // content at its normal width. Kept light: selection uses the weakest fill
+ // (the filled circle is the real indicator); hover is one notch up.
+ band: css`
+ cursor: pointer;
+ user-select: none;
+ inline-size: 100%;
+ transition: background-color 0.1s ${cssVar.motionEaseInOut};
+
+ &:hover {
+ background-color: ${cssVar.colorFillTertiary};
+ }
+ `,
+ bandSelected: css`
+ background-color: ${cssVar.colorFillQuaternary};
+
+ &:hover {
+ background-color: ${cssVar.colorFillQuaternary};
+ }
+ `,
+ // Pinned to the band's leading edge; vertical centering is handled by the
+ // band's cross-axis alignment.
checkbox: css`
flex: none;
- padding-block-start: 6px;
+ padding-inline-start: 16px;
`,
content: css`
/* Content is non-interactive while selecting — the whole row is the toggle. */
@@ -29,6 +54,20 @@ const styles = createStaticStyles(({ css }) => ({
[data-assistant-group-action-bar-portal] {
display: none;
}
+
+ /* The avatar + name + time header is redundant while scanning to select —
+ drop it so every turn reads as one clean line. */
+ .message-header {
+ display: none;
+ }
+ `,
+ // Assistant turns flow from the leading edge of the lane. User turns keep their
+ // native right alignment + indent so they still read as "sent by the user".
+ contentAssistant: css`
+ .message-wrapper {
+ align-items: flex-start !important;
+ padding-inline-start: 0 !important;
+ }
`,
// Assistant turns (esp. tool-call workflows) are long; fold them to a preview
// height while selecting so the list stays scannable. Fades out at the bottom.
@@ -38,29 +77,15 @@ const styles = createStaticStyles(({ css }) => ({
mask-image: linear-gradient(to bottom, #000 56%, transparent 100%);
`,
- disabled: css`
+ disabledBand: css`
cursor: not-allowed;
- opacity: 0.4;
- `,
- // Full-width single-row band, WeChat-style. Kept light: selection uses the
- // weakest fill (the filled circle is the real indicator); hover is one notch
- // up purely for transient feedback.
- row: css`
- cursor: pointer;
inline-size: 100%;
- padding-inline: 12px;
- transition: background-color 0.1s ${cssVar.motionEaseInOut};
-
- &:hover {
- background-color: ${cssVar.colorFillTertiary};
- }
+ opacity: 0.4;
`,
- rowSelected: css`
- background-color: ${cssVar.colorFillQuaternary};
-
- &:hover {
- background-color: ${cssVar.colorFillQuaternary};
- }
+ // Centered reading column inside the full-bleed band — the width preference the
+ // rest of the conversation follows.
+ lane: css`
+ padding-inline: 16px;
`,
}));
@@ -71,41 +96,72 @@ interface MessageSelectionWrapperProps {
}
/**
- * In multi-select mode, wraps a message with a leading round checkbox and turns
- * the whole full-width row into a single toggle target. Outside selection mode
- * it renders the message untouched.
+ * In multi-select mode, wraps a message with a full-bleed clickable band and a
+ * round checkbox pinned to the band's leading edge. The band stretches to the
+ * full stream width, while the inner lane keeps the content at the usual
+ * reading-column width. Outside selection mode it renders the message untouched.
*/
const MessageSelectionWrapper = memo<MessageSelectionWrapperProps>(({ children, id, role }) => {
const isSelectionMode = useConversationStore(messageStateSelectors.isSelectionMode);
const isSelected = useConversationStore(messageStateSelectors.isMessageSelected(id));
const toggleMessageSelected = useConversationStore((s) => s.toggleMessageSelected);
+ const selectRange = useConversationStore((s) => s.selectRange);
+ const wideScreen = useGlobalStore(systemStatusSelectors.wideScreen);
const selectable = isSelectableRole(role);
const isAssistant = role === 'assistant' || role === 'assistantGroup';
- const handleToggle = useCallback(() => {
- if (!selectable) return;
- toggleMessageSelected(id);
- }, [selectable, toggleMessageSelected, id]);
+ const handleToggle = useCallback(
+ (event: MouseEvent) => {
+ if (!selectable) return;
+ // Shift-click extends the selection from the anchor to this message.
+ if (event.shiftKey) selectRange(id);
+ else toggleMessageSelected(id);
+ },
+ [selectable, selectRange, toggleMessageSelected, id],
+ );
if (!isSelectionMode) return <>{children}</>;
+ // Mirror WideScreenContainer's column width so selection content lines up with
+ // the rest of the conversation.
+ const laneWidth = wideScreen ? '100%' : `min(${CONVERSATION_MIN_WIDTH}px, 100%)`;
+
+ const inner = (
+ <>
+ <div className={styles.checkbox}>{selectable && <SelectCircle checked={isSelected} />}</div>
+ <Flexbox align={'center'} flex={1} style={{ minWidth: 0 }}>
+ <Flexbox className={styles.lane} width={laneWidth}>
+ <div
+ className={cx(
+ styles.content,
+ isAssistant && styles.contentAssistant,
+ isAssistant && styles.contentCollapsed,
+ )}
+ >
+ {children}
+ </div>
+ </Flexbox>
+ </Flexbox>
+ </>
+ );
+
if (!selectable) {
- return <div className={styles.disabled}>{children}</div>;
+ return (
+ <Flexbox horizontal align={'center'} className={styles.disabledBand}>
+ {inner}
+ </Flexbox>
+ );
}
return (
<Flexbox
horizontal
- align={'flex-start'}
- className={cx(styles.row, isSelected && styles.rowSelected)}
- gap={8}
+ align={'center'}
+ className={cx(styles.band, isSelected && styles.bandSelected)}
onClick={handleToggle}
>
- <div className={styles.checkbox}>
- <SelectCircle checked={isSelected} />
- </div>
- <div className={cx(styles.content, isAssistant && styles.contentCollapsed)}>{children}</div>
+ {inner}
</Flexbox>
);
});
diff --git a/src/features/Conversation/MessageForward/SelectCircle.tsx b/src/features/Conversation/MessageForward/SelectCircle.tsx
index 85326b860dd..76e068d9a90 100644
--- a/src/features/Conversation/MessageForward/SelectCircle.tsx
+++ b/src/features/Conversation/MessageForward/SelectCircle.tsx
@@ -37,7 +37,7 @@ interface SelectCircleProps {
*/
const SelectCircle = memo<SelectCircleProps>(({ checked, className }) => (
<Center className={cx(styles.circle, checked && styles.checked, className)}>
- {checked && <Icon icon={Check} size={13} />}
+ {checked && <Icon icon={Check} size={14} />}
</Center>
));
diff --git a/src/features/Conversation/MessageForward/SelectToHereButton.tsx b/src/features/Conversation/MessageForward/SelectToHereButton.tsx
index f6aed894bd0..9a71fce6953 100644
--- a/src/features/Conversation/MessageForward/SelectToHereButton.tsx
+++ b/src/features/Conversation/MessageForward/SelectToHereButton.tsx
@@ -1,54 +1,92 @@
'use client';
-import { Icon } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { ArrowDownToLine } from 'lucide-react';
-import { memo } from 'react';
+import { memo, useCallback, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { messageStateSelectors, useConversationStore } from '../store';
const styles = createStaticStyles(({ css }) => ({
+ button: css`
+ pointer-events: auto;
+ background: ${cssVar.colorBgElevated};
+ box-shadow: ${cssVar.boxShadowSecondary};
+ `,
+ line: css`
+ flex: 1;
+ block-size: 0;
+ border-block-start: 1px dashed ${cssVar.colorBorder};
+ `,
+ // The "here" marker: a dashed rule across the chat area at ~25% from the
+ // bottom edge, with the trigger centered on it. Purely a visual guide except
+ // for the button, so it never blocks scrolling or message clicks.
wrap: css`
pointer-events: none;
position: absolute;
- z-index: 50;
- inset-block-start: 12px;
- inset-inline-start: 16px;
-
- > * {
- pointer-events: auto;
- background: ${cssVar.colorBgElevated};
- box-shadow: ${cssVar.boxShadowSecondary};
- }
+ z-index: 20;
+ inset-block-start: 75%;
+ inset-inline: 0;
+ transform: translateY(-50%);
`,
}));
/**
- * Pinned-to-top "select to here" affordance shown while multi-selecting: selects
- * every message from the top of the conversation down to the anchor. Mirrors
- * WeChat's "选择到这里". Renders nothing outside selection mode.
+ * "Select to here" marker shown while multi-selecting: a dashed line across the
+ * chat area near the bottom, with a button that selects every message from the
+ * top of the conversation down to the line. Renders nothing outside selection
+ * mode.
*/
const SelectToHereButton = memo(() => {
const { t } = useTranslation('chat');
+ const wrapRef = useRef<HTMLDivElement>(null);
const isSelectionMode = useConversationStore(messageStateSelectors.isSelectionMode);
const selectToHere = useConversationStore((s) => s.selectToHere);
+ const handleClick = useCallback(() => {
+ const wrap = wrapRef.current;
+ if (!wrap) return;
+ const rect = wrap.getBoundingClientRect();
+ const lineY = rect.top + rect.height / 2;
+
+ // The last selectable message whose top edge sits at or above the line is
+ // "here"; the store then selects everything from the top down to it
+ // (including messages scrolled above the viewport).
+ let targetId: string | undefined;
+ for (const node of wrap.ownerDocument.querySelectorAll<HTMLElement>('[data-message-id]')) {
+ if (node.getBoundingClientRect().top <= lineY) {
+ targetId = node.dataset.messageId ?? targetId;
+ }
+ }
+ if (targetId) selectToHere(targetId);
+ }, [selectToHere]);
+
if (!isSelectionMode) return null;
return (
- <div className={styles.wrap}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={styles.wrap}
+ gap={12}
+ paddingInline={16}
+ ref={wrapRef}
+ >
+ <div className={styles.line} />
<Button
+ className={styles.button}
icon={<Icon icon={ArrowDownToLine} />}
shape={'round'}
size={'small'}
- onClick={selectToHere}
+ onClick={handleClick}
>
{t('messageForward.bar.selectToHere')}
</Button>
- </div>
+ <div className={styles.line} />
+ </Flexbox>
);
});
diff --git a/src/features/Conversation/MessageForward/SelectionFooterBar.tsx b/src/features/Conversation/MessageForward/SelectionFooterBar.tsx
index dcfb1b56728..ee8bc6b6a3d 100644
--- a/src/features/Conversation/MessageForward/SelectionFooterBar.tsx
+++ b/src/features/Conversation/MessageForward/SelectionFooterBar.tsx
@@ -1,96 +1,48 @@
'use client';
-import { Center, Flexbox, Icon, Text } from '@lobehub/ui';
-import { confirmModal } from '@lobehub/ui/base-ui';
+import { Flexbox, Icon, Text } from '@lobehub/ui';
+import { Button, confirmModal } from '@lobehub/ui/base-ui';
import { App } from 'antd';
-import { createStaticStyles, cssVar, cx } from 'antd-style';
-import { Forward, type LucideIcon, Trash2, X } from 'lucide-react';
-import { type FC, memo, useState } from 'react';
+import { createStaticStyles, cssVar } from 'antd-style';
+import { Forward, Trash2, X } from 'lucide-react';
+import { memo, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { messageStateSelectors, useConversationStore } from '../store';
import ForwardModal from './ForwardModal';
const styles = createStaticStyles(({ css }) => ({
- action: css`
- cursor: pointer;
- user-select: none;
-
- &:hover [data-icon-box] {
- background: ${cssVar.colorFillSecondary};
- }
- `,
- actionDisabled: css`
- cursor: not-allowed;
- opacity: 0.35;
-
- &:hover [data-icon-box] {
- background: ${cssVar.colorFillTertiary};
- }
- `,
+ // Full-width bar docked at the bottom in place of the composer (hidden by
+ // MessageForwardFooter while selecting). Count on the leading edge, actions on
+ // the trailing edge.
bar: css`
- min-block-size: 92px;
+ position: relative;
+
+ inline-size: 100%;
padding-block: 12px;
padding-inline: 16px;
border-block-start: 1px solid ${cssVar.colorBorderSecondary};
background: ${cssVar.colorBgContainer};
`,
+ // Pinned to the side so the actions stay centered regardless of the count.
count: css`
position: absolute;
- inset-block-start: 12px;
+ inset-block-start: 50%;
inset-inline-start: 16px;
- `,
- iconBox: css`
- inline-size: 46px;
- block-size: 46px;
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorFillTertiary};
-
- transition: background-color 0.1s ${cssVar.motionEaseInOut};
- `,
- iconBoxDanger: css`
- color: ${cssVar.colorError};
+ transform: translateY(-50%);
`,
}));
-interface ActionColumnProps {
- danger?: boolean;
- disabled?: boolean;
- icon: LucideIcon;
- label: string;
- onClick: () => void;
-}
-
-const ActionColumn: FC<ActionColumnProps> = ({ icon, label, onClick, disabled, danger }) => (
- <Flexbox
- align={'center'}
- className={cx(styles.action, disabled && styles.actionDisabled)}
- gap={6}
- onClick={disabled ? undefined : onClick}
- >
- <Center data-icon-box className={cx(styles.iconBox, danger && styles.iconBoxDanger)}>
- <Icon icon={icon} size={20} />
- </Center>
- <Text
- style={{ color: danger ? cssVar.colorError : undefined, fontSize: 12 }}
- type={'secondary'}
- >
- {label}
- </Text>
- </Flexbox>
-);
-
/**
- * Bottom action bar that replaces the chat input while multi-selecting. Styled
- * like WeChat's forward toolbar: a row of labelled icon buttons at a height
- * close to the composer it stands in for.
+ * Bottom action bar shown while multi-selecting: selection count on the leading
+ * edge, Cancel / Delete / Forward on the trailing edge. Replaces the chat
+ * composer (hidden by MessageForwardFooter).
*/
const SelectionFooterBar = memo(() => {
const { t } = useTranslation('chat');
const { message } = App.useApp();
- const [modalOpen, setModalOpen] = useState(false);
+ const [forwardOpen, setForwardOpen] = useState(false);
const selectedCount = useConversationStore(messageStateSelectors.selectedMessageCount);
const selectedMessageIds = useConversationStore((s) => s.selectedMessageIds);
const exitSelectionMode = useConversationStore((s) => s.exitSelectionMode);
@@ -98,6 +50,17 @@ const SelectionFooterBar = memo(() => {
const disabled = selectedCount === 0;
+ // Esc exits selection mode. When the forward dialog is open, its own Esc
+ // handler closes it first — skip so a single Esc doesn't do both.
+ useEffect(() => {
+ const onKeyDown = (e: KeyboardEvent) => {
+ if (e.key !== 'Escape' || forwardOpen) return;
+ exitSelectionMode();
+ };
+ window.addEventListener('keydown', onKeyDown);
+ return () => window.removeEventListener('keydown', onKeyDown);
+ }, [forwardOpen, exitSelectionMode]);
+
const handleDelete = () => {
confirmModal({
cancelText: t('cancel', { ns: 'common' }),
@@ -115,37 +78,34 @@ const SelectionFooterBar = memo(() => {
return (
<>
- <Flexbox
- align={'center'}
- className={styles.bar}
- justify={'center'}
- style={{ position: 'relative' }}
- >
+ <Flexbox horizontal align={'center'} className={styles.bar} justify={'center'}>
<Text className={styles.count} type={'secondary'}>
{t('messageForward.bar.selected', { count: selectedCount })}
</Text>
- <Flexbox horizontal align={'center'} gap={44} justify={'center'}>
- <ActionColumn
- disabled={disabled}
- icon={Forward}
- label={t('messageForward.bar.forward')}
- onClick={() => setModalOpen(true)}
- />
- <ActionColumn
+ <Flexbox horizontal align={'center'} gap={4}>
+ <Button icon={<Icon icon={X} />} type={'text'} onClick={exitSelectionMode}>
+ {t('messageForward.bar.cancel')}
+ </Button>
+ <Button
danger
disabled={disabled}
- icon={Trash2}
- label={t('messageForward.bar.delete')}
+ icon={<Icon icon={Trash2} />}
+ type={'text'}
onClick={handleDelete}
- />
- <ActionColumn
- icon={X}
- label={t('messageForward.bar.cancel')}
- onClick={exitSelectionMode}
- />
+ >
+ {t('messageForward.bar.delete')}
+ </Button>
+ <Button
+ disabled={disabled}
+ icon={<Icon icon={Forward} />}
+ type={'text'}
+ onClick={() => setForwardOpen(true)}
+ >
+ {t('messageForward.bar.forward')}
+ </Button>
</Flexbox>
</Flexbox>
- <ForwardModal open={modalOpen} onClose={() => setModalOpen(false)} />
+ <ForwardModal open={forwardOpen} onClose={() => setForwardOpen(false)} />
</>
);
});
diff --git a/src/features/Conversation/store/slices/messageState/action.ts b/src/features/Conversation/store/slices/messageState/action.ts
index ebc0d92e0fe..80bf1c263ea 100644
--- a/src/features/Conversation/store/slices/messageState/action.ts
+++ b/src/features/Conversation/store/slices/messageState/action.ts
@@ -14,12 +14,18 @@ export interface MessageEditingAction {
* Leave multi-select mode and drop every selected id.
*/
exitSelectionMode: () => void;
+ /**
+ * Shift-click range select: add every selectable message between the current
+ * anchor and `id` (inclusive) to the selection, then move the anchor to `id`.
+ * Falls back to a plain toggle when there is no anchor yet.
+ */
+ selectRange: (id: string) => void;
/**
* Select every selectable message from the top of the conversation down to
- * the anchor (the message selection started from), inclusive. Mirrors
- * WeChat's "选择到这里".
+ * `targetId` (inclusive) — the "here" marker line. Falls back to the anchor
+ * when no target is given. Mirrors WeChat's "选择到这里".
*/
- selectToHere: () => void;
+ selectToHere: (targetId?: string) => void;
/**
* Toggle message editing state
*/
@@ -68,10 +74,42 @@ export const messageEditingSlice: StateCreator<
'exitSelectionMode',
);
},
- selectToHere: () => {
- const { displayMessages, selectionAnchorId } = get();
+ selectRange: (id) => {
+ const { displayMessages, selectionAnchorId, selectedMessageIds } = get();
const anchorIndex = selectionAnchorId
? displayMessages.findIndex((m) => m.id === selectionAnchorId)
+ : -1;
+ const targetIndex = displayMessages.findIndex((m) => m.id === id);
+ // No anchor yet (or target missing): behave like a plain select-on.
+ if (targetIndex < 0 || anchorIndex < 0) {
+ set(
+ {
+ selectedMessageIds: toggleBooleanList(selectedMessageIds, id, true),
+ selectionAnchorId: id,
+ },
+ false,
+ 'selectRange',
+ );
+ return;
+ }
+
+ const [lo, hi] =
+ anchorIndex <= targetIndex ? [anchorIndex, targetIndex] : [targetIndex, anchorIndex];
+ const rangeIds = displayMessages
+ .slice(lo, hi + 1)
+ .filter((m) => isSelectableRole(m.role))
+ .map((m) => m.id);
+
+ const next = new Set(selectedMessageIds);
+ for (const rangeId of rangeIds) next.add(rangeId);
+
+ set({ selectedMessageIds: [...next], selectionAnchorId: id }, false, 'selectRange');
+ },
+ selectToHere: (targetId) => {
+ const { displayMessages, selectionAnchorId } = get();
+ const anchorId = targetId ?? selectionAnchorId;
+ const anchorIndex = anchorId
+ ? displayMessages.findIndex((m) => m.id === anchorId)
: displayMessages.length - 1;
if (anchorIndex < 0) return;
@@ -93,7 +131,9 @@ export const messageEditingSlice: StateCreator<
const current = get().selectedMessageIds;
const next = selected ?? !current.includes(id);
set(
- { selectedMessageIds: toggleBooleanList(current, id, next) },
+ // Move the anchor to the last interacted message so Shift-range and
+ // "select to here" both reference the user's current focus.
+ { selectedMessageIds: toggleBooleanList(current, id, next), selectionAnchorId: id },
false,
'toggleMessageSelected',
);
diff --git a/src/features/WideScreenContainer/index.tsx b/src/features/WideScreenContainer/index.tsx
index 4c5f3d4f5e7..809b6174ca1 100644
--- a/src/features/WideScreenContainer/index.tsx
+++ b/src/features/WideScreenContainer/index.tsx
@@ -20,13 +20,19 @@ const styles = createStaticStyles(({ css }) => ({
}));
interface WideScreenContainerProps extends FlexboxProps {
+ /**
+ * Force the inner column to span the full available width, bypassing the
+ * centered `min(CONVERSATION_MIN_WIDTH, 100%)` cap. Used e.g. while
+ * multi-selecting so the clickable rows fill the whole stream.
+ */
+ fullWidth?: boolean;
minWidth?: number;
onChange?: () => void;
wrapperStyle?: CSSProperties;
}
const WideScreenContainer = memo<WideScreenContainerProps>(
- ({ children, className, onChange, wrapperStyle, onClick, minWidth, ...rest }) => {
+ ({ children, className, onChange, wrapperStyle, onClick, minWidth, fullWidth, ...rest }) => {
const wideScreen = useGlobalStore(systemStatusSelectors.wideScreen);
useEffect(() => {
@@ -37,8 +43,10 @@ const WideScreenContainer = memo<WideScreenContainerProps>(
<Flexbox style={wrapperStyle} width={'100%'} onClick={onClick}>
<Flexbox
className={cx(styles.container, className)}
- paddingInline={16}
- width={wideScreen ? '100%' : `min(${minWidth || CONVERSATION_MIN_WIDTH}px, 100%)`}
+ paddingInline={fullWidth ? 0 : 16}
+ width={
+ fullWidth || wideScreen ? '100%' : `min(${minWidth || CONVERSATION_MIN_WIDTH}px, 100%)`
+ }
{...rest}
>
{children}