• Mohamed Aziz Mejri's avatar
    Prompt the user for attachement type after dragging the file (#2563) · 8f87e0f3
    Mohamed Aziz Mejri 提交于
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2563"
    target="_blank">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Show a dialog after dragging or pasting files into chat to choose how to
    attach them—as chat context or upload to codebase. This makes intent
    explicit and blocks submit, drop, and paste until you choose.
    
    - **New Features**
    - Added FileAttachmentTypeDialog; integrated in ChatInput and
    HomeChatInput. i18n (en, pt-BR, zh-CN) with singular/plural titles and
    descriptions.
    - Updated useAttachments with pendingFiles and confirm/cancel.
    Drag/paste set pendingFiles; prevent attaching while pending;
    clearAttachments also clears pendingFiles; submit blocked when dialog is
    open.
    - Fixed e2e to select “Attach file as chat context”; dialog buttons use
    type="button" with focus-visible ring.
    
    - **Refactors**
      - confirmPendingFiles reuses addAttachments to deduplicate logic.
    
    <sup>Written for commit b625847b5ed5f82bea4616db27b87b16b5b33613.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    ---------
    Co-authored-by: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
    8f87e0f3