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

Platform Banner extended to show terms and privacy #7092

Merged
merged 3 commits into from
Oct 23, 2024

Conversation

bobbykolev
Copy link
Contributor

@bobbykolev bobbykolev commented Oct 22, 2024

#6988

Based on the requirements the existing Platform Banner was extended to:

  • Support terms and privacy links;
  • Support non-clickable updates;
    • use NOT_CLICKABLE in the releaseNotes.url i18n value;

Additional .md was created for ease of understanding the visibility logic and the available configurations behind the feature.

Final design approved by Simone.
image

Summary by CodeRabbit

  • New Features

    • Updated release notes now highlight changes to the Terms of Service and Privacy Policy with non-clickable links.
    • Enhanced ReleaseNotesBanner component to control banner interactivity based on new parameters.
  • Improvements

    • Enhanced DashboardBanner component for flexible rendering based on a new optional property.
    • Improved interactivity and visual elements in the ReleaseNotesBanner component.
  • Documentation

    • Added documentation for the ReleaseNotesBanner component detailing its functionality and usage.

@bobbykolev bobbykolev requested a review from ccanos October 22, 2024 15:11
Copy link

coderabbitai bot commented Oct 22, 2024

Walkthrough

The changes in this pull request primarily involve updates to the translation.en.json file, specifically in the "releaseNotes" section, which now highlights updates to the Terms of Service and Privacy Policy. Additionally, modifications were made to the DashboardBanner and ReleaseNotesBanner components to incorporate new properties and logic for rendering links based on the updated release notes. A new documentation file was also added to describe the ReleaseNotesBanner component's functionality and usage.

Changes

File Change Summary
src/core/i18n/en/translation.en.json Updated releaseNotes.title and releaseNotes.url to reflect new Terms of Service and Privacy Policy updates; added releaseNotes.isClickable.
src/core/ui/content/DashboardBanner.tsx Added optional isLink property to DashboardBannerProps, modifying rendering logic to conditionally display RouterLink or Box.
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md Added documentation for ReleaseNotesBanner component, detailing visibility logic and formatting options.
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx Enhanced component with new imports and logic for managing clickable URLs based on the presence of a marker.

Possibly related PRs

  • Calendar events changes #6998: This PR modifies the translation.en.json file, specifically updating the releaseNotes section, which directly relates to the changes made in the main PR that also focuses on the releaseNotes in the same JSON file.
  • Change text to make more clear, issue 7030 #7040: This PR also updates the translation.en.json file, specifically enhancing the releaseNotes section, which is directly related to the changes in the main PR.
  • Change the copy on explore spaces related to All to Active  #7051: This PR includes modifications to the translation.en.json file, affecting the text used in the platform's interface, which may relate to the overall context of user engagement similar to the changes in the main PR.

Suggested reviewers

  • SimoneZaza
  • ccanos

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 anywhere in the PR title to generate the title automatically.

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.

@bobbykolev bobbykolev linked an issue Oct 22, 2024 that may be closed by this pull request
2 tasks
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: 2

🧹 Outside diff range and nitpick comments (3)
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (3)

10-10: LGTM: Constant is well-defined, but consider adding a comment for clarity.

The URL_NOT_CLICKABLE_MARKER constant is correctly defined and follows proper naming conventions. To enhance code readability, consider adding a brief comment explaining its purpose and usage.

// Marker used to identify non-clickable release note URLs
const URL_NOT_CLICKABLE_MARKER = 'NOT_CLICKABLE';

14-15: LGTM: Good use of custom hook, but consider adding type annotation.

The useConfig hook is correctly used to retrieve the locations object. To improve type safety and code readability, consider adding a type annotation for the locations object.

const { locations }: { locations: { terms?: string; privacy?: string } } = useConfig();

This assumes that terms and privacy are optional string properties of locations. Adjust the type according to the actual structure of the locations object.


31-31: LGTM: Good use of Trans component with new elements.

The addition of the icon and RouterLink components enhances the banner's functionality and appearance. The use of optional chaining for locations.terms and locations.privacy is a good practice.

Consider removing the underline="always" prop from the RouterLink components if this style is or can be handled by global link styles. This would improve consistency across the application:

terms: <RouterLink to={locations?.terms ?? ''} />,
privacy: <RouterLink to={locations?.privacy ?? ''} />,

Also, ensure that the URLs for terms and privacy are properly sanitized to prevent potential XSS attacks, especially if they come from an external source.

Also applies to: 34-35

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2a9d6df and 6376f3d.

📒 Files selected for processing (4)
  • src/core/i18n/en/translation.en.json (1 hunks)
  • src/core/ui/content/DashboardBanner.tsx (1 hunks)
  • src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md (1 hunks)
  • src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/core/i18n/en/translation.en.json (1)

Pattern src/**/*.json: Review the JSON files for correct syntax and structure.
Ensure that the configuration and data are accurate and follow the project's standards.
Check for sensitive data exposure and ensure that the data is properly validated.

src/core/ui/content/DashboardBanner.tsx (1)

Pattern src/**/*.{ts,tsx,js}: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Ensure sufficient error handling and logging is present.
Check for common security vulnerabilities such as:

  • SQL Injection
  • XSS (Cross-Site Scripting)
  • CSRF (Cross-Site Request Forgery)
  • Insecure dependencies
  • Sensitive data exposure
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md (1)

Pattern **/*.md: Ensure the documentation is clear, concise, and up-to-date, with accurate instructions.

src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (1)

Pattern src/**/*.{ts,tsx,js}: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Ensure sufficient error handling and logging is present.
Check for common security vulnerabilities such as:

  • SQL Injection
  • XSS (Cross-Site Scripting)
  • CSRF (Cross-Site Request Forgery)
  • Insecure dependencies
  • Sensitive data exposure
🪛 LanguageTool
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md

[uncategorized] ~9-~9: A comma is probably missing here.
Context: ...ting to the URL value; ##### Regarding formatting you can use the following tags: - `<sm...

(MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE)

🪛 Markdownlint
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md

3-3: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time

(MD001, heading-increment)


3-3: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


9-9: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

🔇 Additional comments (4)
src/core/ui/content/DashboardBanner.tsx (2)

5-5: LGTM: Import statement updated correctly.

The addition of Box to the import statement is consistent with its usage in the component.


11-11: LGTM: Interface updated correctly.

The addition of the isLink property to the DashboardBannerProps interface is correctly typed and consistent with the component's updated behavior.

src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (1)

2-2: LGTM: New imports are correctly added and follow best practices.

The new imports enhance the component's functionality by adding an icon and routing capabilities. The use of the custom useConfig hook suggests good separation of concerns.

Also applies to: 7-8

src/core/i18n/en/translation.en.json (1)

36-37: LGTM! Consider these points for implementation.

The changes to the "releaseNotes" section look good and align with the PR objectives. However, please consider the following:

  1. Ensure that the component rendering this text can properly handle the HTML-like tags (<small>, <icon/>, <terms>, <privacy>).
  2. The NOT_CLICKABLE parameter in the URL is unconventional. Make sure the component using this translation has the necessary logic to handle this parameter correctly.

To verify the proper handling of these changes, you can run the following script:

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: 0

🧹 Outside diff range and nitpick comments (3)
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (3)

10-10: LGTM: Constant for non-clickable marker added.

The URL_NOT_CLICKABLE_MARKER constant is correctly implemented to support non-clickable updates as per the PR objectives.

Consider moving this constant to a separate constants file if it might be used elsewhere in the application for better maintainability.


20-21: LGTM with suggestion: Logic for non-clickable URLs implemented.

The notClickable variable correctly implements the logic for determining if the release notes URL is clickable, as per the PR objectives.

Consider improving type safety and error handling:

const notClickable = typeof releaseNotesUrl === 'string' && releaseNotesUrl.includes(URL_NOT_CLICKABLE_MARKER);

This change ensures that releaseNotesUrl is a string before calling includes(), preventing potential runtime errors.


27-35: LGTM with suggestion: Banner and Trans component updated correctly.

The changes to the DashboardBanner and Trans components correctly implement the new features as per the PR objectives. The isLink prop and new terms and privacy links are appropriately added.

Consider improving the null handling for the locations URLs:

terms: <RouterLink to={locations?.terms || '#'} underline="always" />,
privacy: <RouterLink to={locations?.privacy || '#'} underline="always" />,

This change ensures that a valid URL is always provided, even if the locations object is undefined or the specific URL is missing.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6376f3d and de25642.

📒 Files selected for processing (1)
  • src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (1)

Pattern src/**/*.{ts,tsx,js}: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Ensure sufficient error handling and logging is present.
Check for common security vulnerabilities such as:

  • SQL Injection
  • XSS (Cross-Site Scripting)
  • CSRF (Cross-Site Request Forgery)
  • Insecure dependencies
  • Sensitive data exposure
🔇 Additional comments (2)
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (2)

2-2: LGTM: New imports are correctly added and utilized.

The new imports (CampaignOutlinedIcon, RouterLink, and useConfig) are appropriately added and used within the component, enhancing its functionality as per the PR objectives.

Also applies to: 7-8


14-14: LGTM: Config hook used to retrieve locations.

The useConfig hook is correctly utilized to retrieve the locations object, which is essential for implementing the terms and privacy links as specified in the PR objectives.

@bobbykolev bobbykolev requested a review from ccanos October 23, 2024 12:13
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: 2

🧹 Outside diff range and nitpick comments (4)
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md (3)

1-2: Improve document structure with proper heading hierarchy.

The document should start with a level 1 heading for better navigation and structure.

Apply this diff:

-### ReleaseNotesBanner
+# ReleaseNotesBanner

3-8: Improve visibility logic section structure and clarity.

The section about banner visibility could be better structured for clarity.

Apply these changes:

-##### The banner visibility logic depends on:
+## Banner Visibility Logic
 
-1. platform.latestReleaseDiscussion from LatestReleaseDiscussion query;
-2. the `releaseNotes.url` value from the translations (it's added to the local storage once closed, so make sure it's unique);
-   1. note that you can control the banner wrapper to be static (not clickable) by setting the `releaseNotes.isClickable` value to "FALSE" and to "TRUE" if you want to be clickable (navigating to the url value); The `releaseNotes.isClickable: "FALSE"` is useful if you're updating the users with terms and privacy (internal links);
+The banner's visibility is controlled by two main factors:
+
+1. The `platform.latestReleaseDiscussion` from LatestReleaseDiscussion query
+2. The `releaseNotes.url` value from translations (stored in local storage once closed, ensure uniqueness)
+
+### Banner Interaction
+
+You can control the banner's clickability using `releaseNotes.isClickable`:
+- Set to "FALSE" for a static, non-clickable banner
+- Set to "TRUE" for a clickable banner that navigates to the specified URL
+
+Note: Static banners (isClickable: "FALSE") are particularly useful for terms and privacy updates with internal links.
🧰 Tools
🪛 Markdownlint

3-3: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time

(MD001, heading-increment)


3-3: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


9-15: Enhance formatting section with better organization and details.

The formatting section could be improved with better organization and more detailed information about the icon component.

Apply these changes:

-##### Regarding formatting you can use the following tags:
+## Available Formatting Tags
 
-The following HTML-like tags are supported:
+The following tags are supported for content formatting:
 
-- `<small></small>`
-- `<big></big>`
-- `<terms></terms>`
-- `<privacy></privacy>`
-- `<icon />` - currently displaying CampaignOutlinedIcon
+| Tag | Description |
+|-----|-------------|
+| `<small>` | Renders text in smaller size |
+| `<big>` | Renders text in larger size |
+| `<terms>` | Formats terms of service links |
+| `<privacy>` | Formats privacy policy links |
+| `<icon />` | Renders CampaignOutlinedIcon from @mui/icons-material |
🧰 Tools
🪛 LanguageTool

[uncategorized] ~9-~9: A comma is probably missing here.
Context: ...vacy (internal links); ##### Regarding formatting you can use the following tags: - `<sm...

(MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE)

🪛 Markdownlint

9-9: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (1)

30-34: Consider using theme-based styling.

The hardcoded margin and styling values should ideally come from the theme system for better consistency and maintainability.

-          icon: <CampaignOutlinedIcon fontSize="small" sx={{ marginRight: '8px', verticalAlign: 'bottom' }} />,
+          icon: <CampaignOutlinedIcon fontSize="small" sx={(theme) => ({ 
+            marginRight: theme.spacing(1),
+            verticalAlign: 'bottom'
+          })} />,
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between de25642 and dd1e6be.

📒 Files selected for processing (3)
  • src/core/i18n/en/translation.en.json (1 hunks)
  • src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md (1 hunks)
  • src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/i18n/en/translation.en.json
🧰 Additional context used
📓 Path-based instructions (2)
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md (1)

Pattern **/*.md: Ensure the documentation is clear, concise, and up-to-date, with accurate instructions.

src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (1)

Pattern src/**/*.{ts,tsx,js}: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Ensure sufficient error handling and logging is present.
Check for common security vulnerabilities such as:

  • SQL Injection
  • XSS (Cross-Site Scripting)
  • CSRF (Cross-Site Request Forgery)
  • Insecure dependencies
  • Sensitive data exposure
🪛 LanguageTool
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md

[uncategorized] ~9-~9: A comma is probably missing here.
Context: ...vacy (internal links); ##### Regarding formatting you can use the following tags: - `<sm...

(MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE)

🪛 Markdownlint
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.md

3-3: Expected: h4; Actual: h5
Heading levels should only increment by one level at a time

(MD001, heading-increment)


3-3: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


9-9: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

🔇 Additional comments (1)
src/main/topLevelPages/myDashboard/releaseNotesBanner/ReleaseNotesBanner.tsx (1)

26-26: LGTM! Clean implementation of the clickable behavior.

The implementation now uses a clear and maintainable approach with the isLink prop, as agreed in the previous discussion.

@ccanos ccanos merged commit 84b1507 into develop Oct 23, 2024
3 checks passed
@ccanos ccanos deleted the client-6988-terms-banner branch October 23, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Release Banner" to update users on updated policies
2 participants