Skip to content
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

feat(dashboard): Digest liquid helper and popover handler #7439

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

Conversation

scopsy
Copy link
Contributor

@scopsy scopsy commented Jan 6, 2025

What changed? Why was the change needed?

  • adds a digest modifier name
  • Adds suggested transformers section based on variable name suggestions

Screenshots

CleanShot 2025-01-06 at 16 45 39@2x

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

@scopsy scopsy marked this pull request as ready for review January 6, 2025 14:46
* {{ users | digest: 2, "name" }} => For array of {name: string}
* {{ users | digest: 2, "profile.name", "•" }} => "John • Josh and 3 others"
*/
export function digest(array: unknown, maxNames = 2, keyPath?: string, separator = ', '): string {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if that's the best name 🤔

Base automatically changed from pills-for-all-inputs to next January 14, 2025 10:15
Copy link

netlify bot commented Jan 16, 2025

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit a2b8f7a
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/678d04885ed02300084210a6
😎 Deploy Preview https://deploy-preview-7439.dashboard.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 16, 2025

Deploy Preview for dashboard-v2-novu-staging ready!

Name Link
🔨 Latest commit a2b8f7a
🔍 Latest deploy log https://app.netlify.com/sites/dashboard-v2-novu-staging/deploys/678d048888cb3100082e1d87
😎 Deploy Preview https://deploy-preview-7439.dashboard-v2.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

filters: Filters[];
};

export function useSuggestedFilters(variableName: string, currentFilters: FilterWithParam[]): SuggestionGroup[] {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These provide filter suggestion based on common variable names, patterns of data

this.templateEngine.registerFilter('json', (value, spaces) =>
stringifyDataStructureWithSingleQuotes(value, spaces)
);
this.templateEngine.registerFilter('digest', digest);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SokratisVidros any name suggestions?

Comment on lines +126 to +129
const parserEngine = new Liquid(LIQUID_CONFIG);

// Register digest filter for validation of digest transformers
parserEngine.registerFilter('digest', () => '');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently we have 2 version of liquid one in the framework and one in the API, didn't do it in this PR but worth considering consolidating them somehow or exporting from the framework the parser

@scopsy scopsy requested a review from SokratisVidros January 17, 2025 07:52
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