Skip to content

feat(dashboard,api-service): layout editor preview fixes NV-6219 #8658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: next
Choose a base branch
from

Conversation

LetItRock
Copy link
Contributor

@LetItRock LetItRock commented Jul 7, 2025

What changed? Why was the change needed?

Related Maily PR

Layout Editor - Preview.

Screenshots

Screenshot 2025-07-07 at 17 21 38
Screenshot 2025-07-07 at 17 21 27

@LetItRock LetItRock self-assigned this Jul 7, 2025
Copy link

linear bot commented Jul 7, 2025

Copy link

netlify bot commented Jul 7, 2025

Deploy Preview for dashboard-v2-novu-staging canceled.

Name Link
🔨 Latest commit 79c06d4
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/686ee5766c90f9000835934a

@github-actions github-actions bot changed the title feat(dashboard,api-service): layout editor preview feat(dashboard,api-service): layout editor preview fixes NV-6219 Jul 7, 2025
body: email?.body,
editorType: email?.editorType,
layoutId: null,
body: enhanceBodyForPreview(editorType, body),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the important part where we adjust the "layout body" and replace the {{content}} variable with the div placeholder or for the Maily - placeholder node.

* ]
* }
*/
export const replaceMailyNodesByCondition = (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the helper util that allows you with matching condition replace the Maily node

Comment on lines +36 to +44
const form = useForm({
defaultValues,
values,
shouldFocusError: false,
resetOptions: {
keepDirtyValues: true,
},
});
const controlValues = useWatch({ control: form.control });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the form to be inside here as I need to watch on the control value changes and do the preview request

import { useLayoutEditor } from './layout-editor-provider';
import { EmailCorePreview } from '../workflow-editor/steps/preview/previews/email-preview-wrapper';

export const LayoutPreviewFactory = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the future we might have other preview components for example for the in-app layout

import { useEffect, useState } from 'react';
import { useDataRef } from './use-data-ref';

export function useDebouncedValue<T>(value: T, delay: number): T {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved from the other component to reusable hook

`<span style="background: #FFFFFF; border: 1px solid #E1E4EA; border-radius: 4px; padding: 4px 8px; flex; justify-content: center; align-items: center; font-size: 10px; line-height: 1; color: #99A0AE;">${placeholderText}</span>` +
'</div>';

export const enhanceBodyForPreview = (editorType: string, body: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it ended up quite nicely!

djabarovgeorge added a commit that referenced this pull request Jul 8, 2025
- Introduced ClickHouse client integration for analytics logging.
- Added cleanup functions for ClickHouse database and tables.
- Updated environment configuration for ClickHouse connection.
- Implemented E2E tests for logging requests with filtering capabilities.
- Refactored request log mapping to utilize a dedicated mapper function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants