feat: add external link to edit email templates in SendEmailStepDialog and WorkflowBuilder

This commit is contained in:
Dries Augustyns
2026-05-09 16:36:47 +02:00
parent d11495061d
commit 4ba43dd3b6
2 changed files with 30 additions and 6 deletions
+15 -5
View File
@@ -17,6 +17,7 @@ import '@xyflow/react/dist/style.css';
import type {WorkflowStep} from '@plunk/db';
import {
Clock,
ExternalLink,
GitBranch,
Hourglass,
Lightbulb,
@@ -243,7 +244,7 @@ function CustomNode({
bgColor?: string;
onEdit?: () => void;
onDelete?: () => void;
template?: {name: string};
template?: {id: string; name: string};
config?: any;
};
}) {
@@ -341,10 +342,19 @@ function CustomNode({
{/* Details */}
{data.template && (
<div className="mt-3 pt-3 border-t border-neutral-100">
<div className="flex items-center gap-2 text-xs text-neutral-600">
<Mail className="h-3 w-3" />
<span className="truncate">{data.template.name}</span>
</div>
<a
href={`/templates/${data.template.id}`}
target="_blank"
rel="noopener noreferrer"
onClick={e => e.stopPropagation()}
onMouseDown={e => e.stopPropagation()}
className="nodrag flex items-center gap-2 text-xs text-neutral-600 hover:text-blue-600 hover:bg-blue-50 -mx-2 px-2 py-1 rounded transition-colors group/template"
title="Open template in a new tab"
>
<Mail className="h-3 w-3 shrink-0" />
<span className="truncate flex-1">{data.template.name}</span>
<ExternalLink className="h-3 w-3 shrink-0 opacity-0 group-hover/template:opacity-100 transition-opacity" />
</a>
</div>
)}
{data.type === 'DELAY' && data.config?.amount && (
@@ -1,4 +1,5 @@
import {Label, Select, SelectContent, SelectItemWithDescription, SelectTrigger, SelectValue, Input} from '@plunk/ui';
import {ExternalLink} from 'lucide-react';
import {useState} from 'react';
import {toast} from 'sonner';
@@ -68,7 +69,20 @@ export function SendEmailStepDialog({step, workflowId, open, onOpenChange, onSuc
>
<div className="space-y-4">
<div>
<Label htmlFor="editTemplate">Email Template</Label>
<div className="flex items-center justify-between">
<Label htmlFor="editTemplate">Email Template</Label>
{templateId && (
<a
href={`/templates/${templateId}`}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1 text-xs text-neutral-500 hover:text-blue-600 transition-colors"
>
Edit template
<ExternalLink className="h-3 w-3" />
</a>
)}
</div>
<TemplateSearchPicker value={templateId} initialName={step.template?.name} onChange={setTemplateId} />
</div>