diff --git a/apps/dashboard/src/components/workflow-editor/steps/base/base-body.tsx b/apps/dashboard/src/components/workflow-editor/steps/base/base-body.tsx index 1d5c6388fb0..ba345ba6c0c 100644 --- a/apps/dashboard/src/components/workflow-editor/steps/base/base-body.tsx +++ b/apps/dashboard/src/components/workflow-editor/steps/base/base-body.tsx @@ -47,7 +47,7 @@ export const BaseBody = () => { /> - {`This supports markdown and variables, type { for more.`} + {`This supports markdown and variables, type {{ for more.`} )} /> diff --git a/apps/dashboard/src/components/workflow-editor/steps/chat/chat-preview.tsx b/apps/dashboard/src/components/workflow-editor/steps/chat/chat-preview.tsx index fe80ba4c8a6..659f20d2cec 100644 --- a/apps/dashboard/src/components/workflow-editor/steps/chat/chat-preview.tsx +++ b/apps/dashboard/src/components/workflow-editor/steps/chat/chat-preview.tsx @@ -16,6 +16,7 @@ export const ChatPreview = ({ }) => { const isValidChatPreview = previewData?.result.type === ChannelTypeEnum.CHAT && previewData?.result.preview.body.length > 0; + const body = isValidChatPreview ? ((previewData?.result.preview as ChatRenderOutput)?.body ?? '') : ''; return (
@@ -34,14 +35,14 @@ export const ChatPreview = ({
{isPreviewPending ? ( - ) : !isValidChatPreview ? ( - Preview not available ) : ( - {(previewData?.result.preview as ChatRenderOutput).body} + {body} )} diff --git a/apps/dashboard/src/components/workflow-editor/steps/push/push-preview.tsx b/apps/dashboard/src/components/workflow-editor/steps/push/push-preview.tsx index b2a09e7cb28..dea05f2ebaf 100644 --- a/apps/dashboard/src/components/workflow-editor/steps/push/push-preview.tsx +++ b/apps/dashboard/src/components/workflow-editor/steps/push/push-preview.tsx @@ -1,6 +1,6 @@ import { HTMLAttributes } from 'react'; import { HTMLMotionProps, motion } from 'motion/react'; -import { ChannelTypeEnum, GeneratePreviewResponseDto } from '@novu/shared'; +import { ChannelTypeEnum, GeneratePreviewResponseDto, PushRenderOutput } from '@novu/shared'; import { Skeleton } from '@/components/primitives/skeleton'; import { cn } from '@/utils/ui'; @@ -11,6 +11,10 @@ export function PushPreview({ isPreviewPending: boolean; previewData?: GeneratePreviewResponseDto; }) { + const isValidPushPreview = previewData?.result.type === ChannelTypeEnum.PUSH; + const subject = isValidPushPreview ? ((previewData?.result.preview as PushRenderOutput)?.subject ?? '') : ''; + const body = isValidPushPreview ? ((previewData?.result.preview as PushRenderOutput)?.body ?? '') : ''; + if (isPreviewPending) { return ( @@ -24,28 +28,12 @@ export function PushPreview({ ); } - if (previewData?.result.type !== ChannelTypeEnum.PUSH) { - return ( - - - - - - - - ); - } - return ( - - + + @@ -66,7 +54,7 @@ export const PushSubjectPreview = ({ subject, isPending, className, ...rest }: P return (
- {subject} + {subject}
now
@@ -89,7 +77,7 @@ export const PushBodyPreview = ({ body, isPending, className, ...rest }: PushBod return (
- {body} + {body}
); }; diff --git a/apps/dashboard/src/components/workflow-editor/steps/sms/sms-phone.tsx b/apps/dashboard/src/components/workflow-editor/steps/sms/sms-phone.tsx index 2be43ebafbc..afd72370eb4 100644 --- a/apps/dashboard/src/components/workflow-editor/steps/sms/sms-phone.tsx +++ b/apps/dashboard/src/components/workflow-editor/steps/sms/sms-phone.tsx @@ -7,7 +7,7 @@ const SmsChatBubble = ({ children }: { children: React.ReactNode }) => ( transition={{ duration: 0.3, ease: 'easeOut' }} className="relative my-1 inline-block max-w-[90%] rounded-2xl bg-[#e9ecef] px-4 py-2 text-sm text-[#2b2b33] before:absolute before:bottom-0 before:left-[-7px] before:h-5 before:w-5 before:rounded-br-[15px] before:bg-[#e9ecef] before:content-[''] after:absolute after:bottom-0 after:left-[-10px] after:h-5 after:w-[10px] after:rounded-br-[10px] after:bg-white after:content-['']" > -
{children}
+
{children}
); diff --git a/apps/dashboard/src/components/workflow-editor/steps/sms/sms-preview.tsx b/apps/dashboard/src/components/workflow-editor/steps/sms/sms-preview.tsx index 6a8d1d41a94..566634e3078 100644 --- a/apps/dashboard/src/components/workflow-editor/steps/sms/sms-preview.tsx +++ b/apps/dashboard/src/components/workflow-editor/steps/sms/sms-preview.tsx @@ -1,5 +1,5 @@ import { SmsPhone } from '@/components/workflow-editor/steps/sms/sms-phone'; -import { ChannelTypeEnum, type GeneratePreviewResponseDto } from '@novu/shared'; +import { ChannelTypeEnum, SmsRenderOutput, type GeneratePreviewResponseDto } from '@novu/shared'; import { ReactNode } from 'react'; const SmsPreviewContainer = ({ children }: { children: ReactNode }) => { @@ -14,31 +14,21 @@ export const SmsPreview = ({ previewData?: GeneratePreviewResponseDto; }) => { const previewResult = previewData?.result; - - if (isPreviewPending || previewData === undefined) { - return ( - - - - ); - } - const isValidSmsPreview = previewResult && previewResult.type === ChannelTypeEnum.SMS && previewResult.preview.body.length > 0; + const body = isValidSmsPreview ? ((previewData?.result.preview as SmsRenderOutput)?.body ?? '') : ''; - if (!isValidSmsPreview) { + if (isPreviewPending || previewData === undefined) { return ( - + ); } - const smsBody = previewResult.preview.body; - return ( - + ); };