[PR #4413] [MERGED] feat(chat): mobile drop dock for chat resource drag-and-drop #6368

Closed
opened 2026-10-23 04:09:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4413
Author: @Gunterlie
Created: 8/1/2026
Status: ✅ Merged
Merged: 8/1/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/mobile-chat-resource-drop-dock


📝 Commits (7)

  • c0308c7 feat(chat): drop resources into the active chat from the mobile library panel
  • 13b5805 fix(chat): shrink the mobile drop dock to an icon-sized target
  • 419ec7e feat(agents): make agent rows touch-draggable
  • 5350f0b feat(chat): reopen the library panel after a mobile drop settles
  • 3eccdde feat(chat): surface agent setup after a drop and restore the panel after it
  • a2c977b Merge branch 'staging' into feat/mobile-chat-resource-drop-dock
  • ac13988 Merge branch 'staging' into feat/mobile-chat-resource-drop-dock

📊 Changes

18 files changed (+449 additions, -18 deletions)

View changed files

📝 packages/client/src/components/chat/ChatArea.tsx (+8 -0)
📝 packages/client/src/components/chat/ChatResourceDropOverlay.tsx (+36 -14)
➕ packages/client/src/components/chat/ChatResourceMobileDropDock.tsx (+113 -0)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+15 -1)
📝 packages/client/src/components/layout/AppShell.tsx (+3 -0)
📝 packages/client/src/components/panels/AgentsPanel.tsx (+95 -0)
📝 packages/client/src/components/panels/CharactersPanel.tsx (+22 -0)
📝 packages/client/src/components/panels/ConnectionsPanel.tsx (+7 -0)
📝 packages/client/src/components/panels/LorebooksPanel.tsx (+11 -0)
📝 packages/client/src/components/panels/PersonasPanel.tsx (+7 -0)
📝 packages/client/src/components/panels/PresetsPanel.tsx (+1 -0)
📝 packages/client/src/components/panels/settings/BackgroundPicker.tsx (+1 -0)
📝 packages/client/src/hooks/use-touch-folder-drag.ts (+12 -0)
📝 packages/client/src/lib/chat-resource-drag.ts (+46 -0)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/client/src/stores/ui.store.ts (+1 -1)
📝 packages/client/src/styles/globals.css (+28 -1)
📝 scripts/regressions/chat-resource-drop.regression.ts (+42 -1)

📄 Description

Closes #4412

Why

Chat resource drag-and-drop is desktop-only in practice. On mobile the library panel is a full-width overlay over the chat, so a touch drag has nowhere to land — there is no visible [data-chat-resource-drop-surface], and touch drops only ever resolved against folder targets inside the panel. Users on mobile can only use the tap-only ChatResourceActionButton, so the gesture that the whole feature is built around simply does not exist for them.

What

A left-edge drop dock that appears only while a chat-resource touch drag is active, sits above the panel (z-9000, below modals at z-10000), and shows the same icon/accent/title as the desktop overlay — including the blocked state for already-active or unsupported resources.

Dropping on it closes the right panel and dispatches requestChatResourceAssignment(payload), i.e. the exact same assignment path the desktop overlay and the row action button already use. No new mutation, confirmation or modal logic.

  • chat-resource-drag.ts: touch drags carry no dataTransfer, so the active payload is held in module state with a subscribe/notify pair the dock reads through useSyncExternalStore.
  • use-touch-folder-drag.ts: one optional chatResourcePayload start option; the hook sets it on activate and clears it on cancel/drop, so lifecycle stays in one place. No behavior change when the option is omitted.
  • The 8 chat-resource drag cards pass the payload they already build for onDragStart.
  • The dock hit-tests its own cached rect rather than reading getBoundingClientRect per touchmove, and listens in the capture phase so the payload is still set when it reads it.

Panel folder drops need no changes: they resolve via elementFromPoint(...).closest("[data-*-folder-id]"), and the dock is not a folder, so that branch already no-ops.

Panel closes on drop

Deliberate divergence from the tap button, which leaves the panel open. A drop means "put this in the chat"; if the panel stayed open the success toast — the only route to undo — would fire behind a full-screen overlay. The connection-needs-setup branch reopens the panel afterwards, which is the correct ordering since the close happens before the assignment dispatches.

Validation

  • pnpm check
  • pnpm localization:check
  • pnpm regression:chat-resource-drop
  • pnpm smoke:ui

Test plan

  • Manually verify on a real touch device (or mobile emulation) that long-pressing a character row in the library panel shows the dock at the left edge
  • Manually verify the dock highlights when the finger enters it and returns to rest when it leaves
  • Manually verify dropping on the dock closes the panel and adds the character to the chat
  • Manually verify the blocked state renders for a resource already active in the chat, and that dropping it does nothing
  • Manually verify each resource kind: character, lorebook, persona, preset, connection, background
  • Manually verify the greeting/lorebook modal after a character drop is legible and dismissible at 360px width
  • Manually verify the preset choice modal (ChoiceSelectionModal) at 360px width
  • Manually verify the persona/preset/connection replacement confirmation appears above the panel and its first tap is not swallowed
  • Manually verify dropping a connection with no model still opens connection setup
  • Manually verify the success toast and its Undo action are reachable after the panel closes
  • Manually verify dragging a row onto a folder still moves it into that folder (no regression to folder drag)
  • Manually verify the dock does not appear on desktop drags

Notes

  • Automated coverage is the touch-drag state lifecycle in chat-resource-drop.regression.ts; the dock geometry and gesture itself are not covered by the Playwright lane and need the manual pass above.
  • Untranslated: ui.chat.chatresourcemobiledropdock.label is English-only, as with other new keys.

Summary by CodeRabbit

  • New Features

    • Added mobile touch-and-drop support for assigning agents and other resources to chats.
    • Added a mobile drop dock with clear action states, accessibility labels, and blocked-drop feedback.
    • Added touch dragging for agents, characters, connections, lorebooks, personas, presets, and backgrounds.
    • Chat settings now reopen the previous panel after resource assignment when appropriate.
    • Added agent setup handoff that opens chat settings automatically.
  • Bug Fixes

    • Improved panel restoration and drag-state cleanup during resource assignment and cancellation.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4413 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 8/1/2026 **Status:** ✅ Merged **Merged:** 8/1/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/mobile-chat-resource-drop-dock` --- ### 📝 Commits (7) - [`c0308c7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c0308c75f22ce4d116103a9a2ead42e80d1b59d4) feat(chat): drop resources into the active chat from the mobile library panel - [`13b5805`](https://github.com/Pasta-Devs/Marinara-Engine/commit/13b5805c64e2e2ad28cb1d466e0116e90cb7a5a3) fix(chat): shrink the mobile drop dock to an icon-sized target - [`419ec7e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/419ec7e5a026608671047751f0b3e581202f3de0) feat(agents): make agent rows touch-draggable - [`5350f0b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5350f0b245e97ef8d55fd4b1b4e26b5886abdc6d) feat(chat): reopen the library panel after a mobile drop settles - [`3eccdde`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3eccdde36f26335166e206c50603e7ae5921a643) feat(chat): surface agent setup after a drop and restore the panel after it - [`a2c977b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a2c977bdb2f0c08194769ac5dd0155d0f5db8050) Merge branch 'staging' into feat/mobile-chat-resource-drop-dock - [`ac13988`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ac13988cee5b60906d909315c143b20ab1a917a4) Merge branch 'staging' into feat/mobile-chat-resource-drop-dock ### 📊 Changes **18 files changed** (+449 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatArea.tsx` (+8 -0) 📝 `packages/client/src/components/chat/ChatResourceDropOverlay.tsx` (+36 -14) ➕ `packages/client/src/components/chat/ChatResourceMobileDropDock.tsx` (+113 -0) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+15 -1) 📝 `packages/client/src/components/layout/AppShell.tsx` (+3 -0) 📝 `packages/client/src/components/panels/AgentsPanel.tsx` (+95 -0) 📝 `packages/client/src/components/panels/CharactersPanel.tsx` (+22 -0) 📝 `packages/client/src/components/panels/ConnectionsPanel.tsx` (+7 -0) 📝 `packages/client/src/components/panels/LorebooksPanel.tsx` (+11 -0) 📝 `packages/client/src/components/panels/PersonasPanel.tsx` (+7 -0) 📝 `packages/client/src/components/panels/PresetsPanel.tsx` (+1 -0) 📝 `packages/client/src/components/panels/settings/BackgroundPicker.tsx` (+1 -0) 📝 `packages/client/src/hooks/use-touch-folder-drag.ts` (+12 -0) 📝 `packages/client/src/lib/chat-resource-drag.ts` (+46 -0) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/client/src/stores/ui.store.ts` (+1 -1) 📝 `packages/client/src/styles/globals.css` (+28 -1) 📝 `scripts/regressions/chat-resource-drop.regression.ts` (+42 -1) </details> ### 📄 Description Closes #4412 ## Why Chat resource drag-and-drop is desktop-only in practice. On mobile the library panel is a full-width overlay over the chat, so a touch drag has nowhere to land — there is no visible `[data-chat-resource-drop-surface]`, and touch drops only ever resolved against folder targets inside the panel. Users on mobile can only use the tap-only `ChatResourceActionButton`, so the gesture that the whole feature is built around simply does not exist for them. ## What A left-edge drop dock that appears only while a chat-resource **touch** drag is active, sits above the panel (`z-9000`, below modals at `z-10000`), and shows the same icon/accent/title as the desktop overlay — including the blocked state for already-active or unsupported resources. Dropping on it closes the right panel and dispatches `requestChatResourceAssignment(payload)`, i.e. the exact same assignment path the desktop overlay and the row action button already use. No new mutation, confirmation or modal logic. - `chat-resource-drag.ts`: touch drags carry no `dataTransfer`, so the active payload is held in module state with a subscribe/notify pair the dock reads through `useSyncExternalStore`. - `use-touch-folder-drag.ts`: one optional `chatResourcePayload` start option; the hook sets it on activate and clears it on cancel/drop, so lifecycle stays in one place. No behavior change when the option is omitted. - The 8 chat-resource drag cards pass the payload they already build for `onDragStart`. - The dock hit-tests its own cached rect rather than reading `getBoundingClientRect` per `touchmove`, and listens in the capture phase so the payload is still set when it reads it. Panel folder drops need no changes: they resolve via `elementFromPoint(...).closest("[data-*-folder-id]")`, and the dock is not a folder, so that branch already no-ops. ### Panel closes on drop Deliberate divergence from the tap button, which leaves the panel open. A drop means "put this in the chat"; if the panel stayed open the success toast — the only route to **undo** — would fire behind a full-screen overlay. The connection-needs-setup branch reopens the panel afterwards, which is the correct ordering since the close happens before the assignment dispatches. ## Validation - [ ] `pnpm check` - [ ] `pnpm localization:check` - [ ] `pnpm regression:chat-resource-drop` - [ ] `pnpm smoke:ui` ## Test plan - [ ] Manually verify on a real touch device (or mobile emulation) that long-pressing a character row in the library panel shows the dock at the left edge - [ ] Manually verify the dock highlights when the finger enters it and returns to rest when it leaves - [ ] Manually verify dropping on the dock closes the panel and adds the character to the chat - [ ] Manually verify the blocked state renders for a resource already active in the chat, and that dropping it does nothing - [ ] Manually verify each resource kind: character, lorebook, persona, preset, connection, background - [ ] Manually verify the greeting/lorebook modal after a character drop is legible and dismissible at 360px width - [ ] Manually verify the preset choice modal (`ChoiceSelectionModal`) at 360px width - [ ] Manually verify the persona/preset/connection replacement confirmation appears above the panel and its first tap is not swallowed - [ ] Manually verify dropping a connection with no model still opens connection setup - [ ] Manually verify the success toast and its Undo action are reachable after the panel closes - [ ] Manually verify dragging a row onto a folder still moves it into that folder (no regression to folder drag) - [ ] Manually verify the dock does not appear on desktop drags ## Notes - Automated coverage is the touch-drag state lifecycle in `chat-resource-drop.regression.ts`; the dock geometry and gesture itself are not covered by the Playwright lane and need the manual pass above. - Untranslated: `ui.chat.chatresourcemobiledropdock.label` is English-only, as with other new keys. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added mobile touch-and-drop support for assigning agents and other resources to chats. * Added a mobile drop dock with clear action states, accessibility labels, and blocked-drop feedback. * Added touch dragging for agents, characters, connections, lorebooks, personas, presets, and backgrounds. * Chat settings now reopen the previous panel after resource assignment when appropriate. * Added agent setup handoff that opens chat settings automatically. * **Bug Fixes** * Improved panel restoration and drag-state cleanup during resource assignment and cancellation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:09:44 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6368
No description provided.