fix: show correct default value for placeholder

This commit is contained in:
Dries Augustyns
2025-12-09 15:57:54 +01:00
parent badb035585
commit 04275e3cf5
+7 -2
View File
@@ -28,10 +28,15 @@ export function EmailSettings({
onReplyToChange,
fromPlaceholder = 'hello',
fromNamePlaceholder = 'Your Company',
replyToPlaceholder = 'support',
replyToPlaceholder,
showFromNameHelpText = false,
layout = 'grid',
}: EmailSettingsProps) {
// Use from email's local part as the reply-to placeholder if not provided
// Extract local part (before @) since the domain is shown in a dropdown
// Fall back to fromPlaceholder when from is empty (since reply-to defaults to from)
const fromLocalPart = from.includes('@') ? from.split('@')[0] : from;
const effectiveReplyToPlaceholder = replyToPlaceholder || fromLocalPart || fromPlaceholder;
const GridWrapper = layout === 'grid' ? 'div' : 'div';
const gridClassName = layout === 'grid' ? 'grid gap-4 md:grid-cols-2' : 'space-y-4';
@@ -73,7 +78,7 @@ export function EmailSettings({
label="Reply-To Email"
value={replyTo}
onChange={onReplyToChange}
placeholder={replyToPlaceholder}
placeholder={effectiveReplyToPlaceholder}
/>
</div>
</GridWrapper>