Skip to content

New email design #61

New issue

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

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

Already on GitHub? # to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft

New email design #61

wants to merge 1 commit into from

Conversation

jaybuidl
Copy link
Member

@jaybuidl jaybuidl commented Dec 19, 2024

New Reality Question

The template variables are the same as the existing template.

Live preview

image

Test inputs

<%
    var notification = {
        event: {
            txHash: "xxx",
            questionId: "foo",
            snapshotId: "bar",
        },
        space: {
            ens: "1inch.eth",
        }
    };
    
    var unsubscribeEmail = "https://google.com";

    getSnapshotProposalLink = function(notification) {
        return `https://snapshot.org/#/1inch.th/proposal/1234`;
    };
    
    getRealityQuestionLink = function(notification) {
        return `https://reality.eth.limo/app/#!/question/1234-5678/token/ETH`;
    };
%>

New Answer

TODO once we approve the other template.

Summary by CodeRabbit

  • New Features
    • Introduced a new HTML email template for notifications related to the creation of a new reality question.
    • Enhanced email design with responsive elements and clear calls to action.

Copy link

coderabbitai bot commented Dec 19, 2024

Walkthrough

A new HTML email template proposal-created-html2.ejs has been created in the templates/email/ directory. The template is specifically designed for sending notifications about newly created reality questions related to Snapshot proposals. It features a responsive HTML structure with comprehensive styling, dynamic content placeholders, and carefully designed sections including a header, message body, action buttons, and footer with social media links and an unsubscribe option.

Changes

File Change Summary
templates/email/proposal-created-html2.ejs New email template for Snapshot proposal notifications with responsive design, dynamic content placeholders, styled buttons, and comprehensive email structure

Possibly related PRs

Suggested reviewers

  • divyangchauhan
  • salgozino
  • wadader

Poem

🐰 A template hops into view,
Emails dancing, crisp and new
Snapshot's story, neatly dressed
In HTML, perfectly expressed
Rabbit's code, a digital brew! 📧✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jaybuidl jaybuidl self-assigned this Dec 19, 2024
@jaybuidl jaybuidl requested a review from fcanela December 19, 2024 13:48
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
templates/email/proposal-created-html2.ejs (2)

122-122: Remove empty CSS rulesets.

The following empty rulesets can be removed to improve code maintainability:

  • .es-p-default {}
  • .es-header-body p {}
  • .es-content-body p {}
  • .es-footer-body p {}
  • .es-infoblock p {}

Also applies to: 163-169


464-467: Improve image accessibility with better alt text.

The alt text for images should be more descriptive to improve accessibility:

  • "Logo" could be "Kleros Reality Logo"
  • Empty alt text should be replaced with meaningful descriptions
  • Social media icons should have consistent alt text format

Also applies to: 699-702, 757-759, 765-769, 775-779

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a92a81e and 33a1db9.

📒 Files selected for processing (1)
  • templates/email/proposal-created-html2.ejs (1 hunks)
🔇 Additional comments (2)
templates/email/proposal-created-html2.ejs (2)

1-15: Well-structured HTML email template with proper meta tags.

The document structure follows email HTML best practices with appropriate DOCTYPE, meta tags for responsiveness, and email client compatibility declarations.


11-11: Verify required EJS variables documentation.

The template uses several EJS variables. Please ensure these are documented in the README or relevant documentation:

  • notification.space.ens
  • getRealityQuestionLink(notification)
  • getSnapshotProposalLink(notification)
  • notification.event.txHash
  • unsubscribeEmail

Also applies to: 532-533, 541-541, 556-556, 571-571, 725-725

✅ Verification successful

Let me check if these variables are documented elsewhere in the codebase, such as in documentation files or in the template's directory.


Let me check if there's any type definition or interface file that might document these variables' structure.


Template variables are well-defined in the codebase

The EJS variables used in the template are properly defined and documented in the codebase:

  • notification.space.ens is part of the Space interface in the notification type definition
  • getRealityQuestionLink(notification) and getSnapshotProposalLink(notification) are helper functions defined in src/utils/links.ts
  • notification.event.txHash is part of both ProposalNotificationEvent and AnswerNotificationEvent types
  • unsubscribeEmail is used consistently across email templates

Additionally, there are test templates (templates/test/*.ejs) that serve as documentation by example, showing the expected structure of all variables.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if variables are documented
echo "Searching for documentation of required EJS variables..."
rg -l "notification\.space\.ens|getRealityQuestionLink|getSnapshotProposalLink|notification\.event\.txHash|unsubscribeEmail" "README.md" || echo "Variables not found in README.md"

Length of output: 334


Script:

#!/bin/bash
# Search for documentation files and check template directory
echo "Searching for documentation files..."
fd -e md -e txt -e doc

echo -e "\nSearching for variable documentation in all files..."
rg -A 2 "notification\.space\.ens|getRealityQuestionLink|getSnapshotProposalLink|notification\.event\.txHash|unsubscribeEmail" --type-add 'docs:*.{md,txt,doc}' --type-add 'template:*.ejs' -t docs -t template

Length of output: 14616


Script:

#!/bin/bash
# Search for type definitions or interfaces
echo "Searching for type definitions..."
rg -A 5 "interface.*Notification|type.*Notification|notification:" --type ts

echo -e "\nSearching for helper function definitions..."
ast-grep --pattern 'function $_(notification) {
  $$$
}'

Length of output: 10017

td .es-button-border-1685481741719:hover {
background: #7BCBFF !important;
border-style: solid solid solid solid !important;
border-color: #aNaNaN #aNaNaN #aNaNaN #aNaNaN !important;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix invalid color values in CSS.

The border-color property contains invalid color values using 'aNaNaN'. This will not work as expected.

Apply this fix to the affected lines:

-border-color: #aNaNaN #aNaNaN #aNaNaN #aNaNaN !important;
+border-color: transparent !important;

Also applies to: 99-99, 110-110

Comment on lines +754 to +756
<a target="_blank"
href="https://twitter.com/kleros_io"
style="mso-line-height-rule:exactly;text-decoration:underline;color:#FFFFFF;font-size:14px"><img
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add security attributes to external links.

External links should include rel="noopener noreferrer" to prevent potential security issues:

Apply this change to social media links:

-<a target="_blank" href="https://twitter.com/kleros_io"
+<a target="_blank" rel="noopener noreferrer" href="https://twitter.com/kleros_io"

Also applies to: 763-765, 772-774

Comment on lines +725 to +728
<a href="<%- unsubscribeEmail %>"
target="_blank"
style="mso-line-height-rule:exactly;text-decoration:none;color:#ccbfdd;font-size:12px">Unsubscribe</a>
</p>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve unsubscribe link visibility.

The unsubscribe link's color (#ccbfdd) has low contrast against the background. Consider using a more visible color to ensure it meets accessibility standards.

Apply this change:

-style="mso-line-height-rule:exactly;text-decoration:none;color:#ccbfdd;font-size:12px"
+style="mso-line-height-rule:exactly;text-decoration:underline;color:#ffffff;font-size:12px"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<a href="<%- unsubscribeEmail %>"
target="_blank"
style="mso-line-height-rule:exactly;text-decoration:none;color:#ccbfdd;font-size:12px">Unsubscribe</a>
</p>
<a href="<%- unsubscribeEmail %>"
target="_blank"
style="mso-line-height-rule:exactly;text-decoration:underline;color:#ffffff;font-size:12px">Unsubscribe</a>
</p>

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant