minor improvements

This commit is contained in:
Arjun 2026-05-06 21:37:34 +05:30
parent a3a92ca6ac
commit 6bb2dfe1dd
2 changed files with 29 additions and 80 deletions

View file

@ -1,6 +1,6 @@
import { mergeAttributes, Node } from '@tiptap/react' import { mergeAttributes, Node } from '@tiptap/react'
import { ReactNodeViewRenderer, NodeViewWrapper } from '@tiptap/react' import { ReactNodeViewRenderer, NodeViewWrapper } from '@tiptap/react'
import { X, ExternalLink, Copy, Check, MessageSquare, ChevronDown, Reply, Forward } from 'lucide-react' import { X, ExternalLink, Copy, Check, MessageSquare, ChevronDown } from 'lucide-react'
import { blocks } from '@x/shared' import { blocks } from '@x/shared'
import { useState, useEffect, useRef, useCallback } from 'react' import { useState, useEffect, useRef, useCallback } from 'react'
import { useTheme } from '@/contexts/theme-context' import { useTheme } from '@/contexts/theme-context'
@ -65,11 +65,9 @@ declare global {
function EmailExpandedBody({ function EmailExpandedBody({
config, config,
resolvedTheme, resolvedTheme,
onDelete,
}: { }: {
config: blocks.EmailBlock config: blocks.EmailBlock
resolvedTheme: string resolvedTheme: string
onDelete?: () => void
}) { }) {
const [draftBody, setDraftBody] = useState(config.draft_response || '') const [draftBody, setDraftBody] = useState(config.draft_response || '')
const [copied, setCopied] = useState(false) const [copied, setCopied] = useState(false)
@ -139,28 +137,6 @@ function EmailExpandedBody({
{config.date && <span className="email-gmail-exp-fulldate">{formatFullDate(config.date)}</span>} {config.date && <span className="email-gmail-exp-fulldate">{formatFullDate(config.date)}</span>}
</div> </div>
</div> </div>
<div className="email-gmail-exp-meta-actions">
{gmailUrl && (
<button
className="email-gmail-icon-btn"
onClick={(e) => { e.stopPropagation(); window.open(gmailUrl, '_blank') }}
onMouseDown={(e) => e.stopPropagation()}
title="Open in Gmail"
>
<ExternalLink size={15} />
</button>
)}
{onDelete && (
<button
className="email-gmail-icon-btn"
onClick={(e) => { e.stopPropagation(); onDelete() }}
onMouseDown={(e) => e.stopPropagation()}
title="Remove"
>
<X size={15} />
</button>
)}
</div>
</div> </div>
<div className="email-gmail-exp-body">{config.latest_email}</div> <div className="email-gmail-exp-body">{config.latest_email}</div>
@ -172,35 +148,28 @@ function EmailExpandedBody({
</div> </div>
)} )}
{/* Reply / Forward / Draft with Rowboat row */} {!hasDraft && (
<div className="email-gmail-reply-row"> <div className="email-gmail-reply-row">
<button {gmailUrl && (
className="email-gmail-reply-btn" <button
onMouseDown={(e) => e.stopPropagation()} className="email-gmail-btn"
onClick={(e) => { e.stopPropagation(); draftWithAssistant() }} onMouseDown={(e) => e.stopPropagation()}
> onClick={(e) => { e.stopPropagation(); window.open(gmailUrl, '_blank') }}
<Reply size={14} /> >
Reply <ExternalLink size={13} />
</button> Open in Gmail
{gmailUrl && ( </button>
)}
<button <button
className="email-gmail-reply-btn" className="email-gmail-btn email-gmail-btn-primary email-gmail-reply-row-end"
onMouseDown={(e) => e.stopPropagation()} onMouseDown={(e) => e.stopPropagation()}
onClick={(e) => { e.stopPropagation(); window.open(gmailUrl, '_blank') }} onClick={(e) => { e.stopPropagation(); draftWithAssistant() }}
> >
<Forward size={14} /> <MessageSquare size={13} />
Forward Draft with Rowboat
</button> </button>
)} </div>
<button )}
className="email-gmail-btn email-gmail-btn-primary email-gmail-reply-row-end"
onMouseDown={(e) => e.stopPropagation()}
onClick={(e) => { e.stopPropagation(); draftWithAssistant() }}
>
<MessageSquare size={13} />
{hasDraft ? 'Refine with Rowboat' : 'Draft with Rowboat'}
</button>
</div>
{hasDraft && ( {hasDraft && (
<div className="email-gmail-compose"> <div className="email-gmail-compose">
@ -236,6 +205,16 @@ function EmailExpandedBody({
{copied ? <Check size={13} /> : <Copy size={13} />} {copied ? <Check size={13} /> : <Copy size={13} />}
{copied ? 'Copied!' : 'Copy draft'} {copied ? 'Copied!' : 'Copy draft'}
</button> </button>
{gmailUrl && (
<button
className="email-gmail-btn"
onMouseDown={(e) => e.stopPropagation()}
onClick={(e) => { e.stopPropagation(); window.open(gmailUrl, '_blank') }}
>
<ExternalLink size={13} />
Open in Gmail
</button>
)}
</div> </div>
</div> </div>
)} )}
@ -443,7 +422,6 @@ function EmailBlockView({ node, deleteNode, updateAttributes }: {
<EmailExpandedBody <EmailExpandedBody
config={config} config={config}
resolvedTheme={resolvedTheme} resolvedTheme={resolvedTheme}
onDelete={deleteNode}
/> />
)} )}
</div> </div>

View file

@ -1822,35 +1822,6 @@
margin-left: auto; margin-left: auto;
} }
/* Icon-only buttons (open in Gmail, remove) */
.tiptap-editor .ProseMirror .email-gmail-icon-btn {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: 50%;
border: none;
background: none;
color: color-mix(in srgb, var(--foreground) 45%, transparent);
cursor: pointer;
transition: background 0.12s ease, color 0.12s ease;
}
.tiptap-editor .ProseMirror .email-gmail-icon-btn:hover {
background: color-mix(in srgb, var(--foreground) 8%, transparent);
color: var(--foreground);
}
.tiptap-editor .ProseMirror .email-gmail-exp-meta-actions {
display: flex;
align-items: center;
gap: 2px;
margin-left: auto;
flex-shrink: 0;
}
/* ---- Emails inbox block (language-emails) ---- */ /* ---- Emails inbox block (language-emails) ---- */
.tiptap-editor .ProseMirror .email-inbox-card { .tiptap-editor .ProseMirror .email-inbox-card {