mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-18 13:23:33 +08:00
A user-requested drag target should reuse the existing attachment pipeline instead of creating a second upload path. The composer now handles browser DataTransfer drops and Tauri native drag-drop events, while keeping desktop attachments path-only so large files are not serialized into chat payloads. The fallback /goal metadata is also aligned with the existing desktop command surface because the desktop gate exercises that menu while validating composer behavior. Constraint: Desktop attachments must remain path-only to avoid inflated websocket payloads Rejected: Read dropped desktop files with FileReader | would reintroduce large inline data payloads Confidence: high Scope-risk: moderate Directive: Do not replace the Tauri drag-drop path conversion with data URLs without rerunning payload-size regression coverage Tested: cd desktop && bun run test -- --run src/lib/composerAttachments.test.ts src/components/chat/ChatInput.test.tsx src/pages/EmptySession.test.tsx Tested: cd desktop && bun run lint Tested: cd desktop && bun run build Tested: bun run check:desktop Tested: agent-browser overlay and dropped-chip smoke at http://127.0.0.1:1421/?serverUrl=http%3A%2F%2F127.0.0.1%3A3456 Tested: bun run verify Not-tested: Finder-to-packaged-.app manual drag smoke
26 lines
1.2 KiB
TypeScript
26 lines
1.2 KiB
TypeScript
type ComposerDropOverlayProps = {
|
|
title: string
|
|
description: string
|
|
testId: string
|
|
}
|
|
|
|
export function ComposerDropOverlay({ title, description, testId }: ComposerDropOverlayProps) {
|
|
return (
|
|
<div
|
|
data-testid={testId}
|
|
className="composer-drop-overlay pointer-events-none absolute inset-0 z-40 flex items-center justify-center rounded-[inherit] border border-[var(--color-brand)]/45 bg-[var(--color-surface-container-lowest)]/88 p-4 backdrop-blur-[2px]"
|
|
aria-hidden="true"
|
|
>
|
|
<div className="flex max-w-[280px] items-center gap-3 rounded-[10px] border border-[var(--color-brand)]/30 bg-[var(--color-surface-container-low)] px-4 py-3 text-left shadow-[var(--shadow-dropdown)]">
|
|
<span className="material-symbols-outlined flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-[var(--color-brand)]/12 text-[20px] text-[var(--color-brand)]">
|
|
upload_file
|
|
</span>
|
|
<span className="min-w-0">
|
|
<span className="block text-sm font-semibold leading-5 text-[var(--color-text-primary)]">{title}</span>
|
|
<span className="block text-xs leading-5 text-[var(--color-text-tertiary)]">{description}</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|