Skip to content

feat: Custom colors in info panel #2799

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 2 commits into
base: alpha
Choose a base branch
from

Conversation

vardhan0604
Copy link
Contributor

@vardhan0604 vardhan0604 commented May 11, 2025

New Pull Request Checklist

Issue Description

fixes #2644

Closes: FILL_THIS_OUT

Approach

Summary by CodeRabbit

  • New Features

    • Segment headings, key-value items, and buttons in the aggregation panel now support dynamic font and background colors based on segment data, allowing for improved visual customization.
  • Style

    • Updated styles to use CSS custom properties for colors, enabling easier theming and runtime color changes while maintaining existing default colors.

Copy link

parse-github-assistant bot commented May 11, 2025

🚀 Thanks for opening this pull request!

❌ Please fill out all fields with a placeholder FILL_THIS_OUT. If a field does not apply to the pull request, fill in n/a or delete the line.

@vardhan0604 vardhan0604 changed the title initial commit feat: Custom colors in info panel May 11, 2025
Copy link

uffizzi-cloud bot commented May 11, 2025

Uffizzi Ephemeral Environment deployment-63588

⌚ Updated May 11, 2025, 17:45 UTC

☁️ https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2799

📄 View Application Logs etc.

What is Uffizzi? Learn more

Copy link

coderabbitai bot commented May 12, 2025

📝 Walkthrough

Walkthrough

The changes introduce dynamic styling for the AggregationPanel component by allowing custom font and background colors to be set per segment title, key-value item, and button. This is achieved by passing inline CSS custom properties and updating SCSS to use these variables with fallbacks to existing color values.

Changes

File(s) Change Summary
src/components/AggregationPanel/AggregationPanel.js Adds inline CSS variables for --fontColor and --backgroundColor to segment titles, using segment data properties for dynamic styling.
src/components/AggregationPanel/AggregationPanelComponents.js Adds inline CSS variables for --fontColor, --backgroundColor, and --onhoverBackgroundColor to KeyValueElement and ButtonElement, using item data properties for dynamic styling.
src/components/AggregationPanel/AggregationPanel.scss Refactors color properties in styles to use CSS custom properties with Sass variable fallbacks, enabling dynamic theming for headings, key-value items, and buttons.

Sequence Diagram(s)

sequenceDiagram
    participant ParentComponent
    participant AggregationPanel
    participant Segment
    participant KeyValueElement
    participant ButtonElement

    ParentComponent->>AggregationPanel: Passes segments/items with color properties
    AggregationPanel->>Segment: Renders segment with title, passing titleFontColor/titleBackgroundColor
    Segment->>AggregationPanel: Renders title with inline CSS variables
    AggregationPanel->>KeyValueElement: Renders item with fontColor/backgroundColor
    KeyValueElement->>KeyValueElement: Applies inline CSS variables for styling
    AggregationPanel->>ButtonElement: Renders button with fontColor/backgroundColor/onhoverBackgroundColor
    ButtonElement->>ButtonElement: Applies inline CSS variables for styling
Loading

Assessment against linked issues

Objective Addressed Explanation
Allow setting custom font and background color per item and per segment title (#2644)
Support dynamic color styling for key-value items and buttons in the info panel (#2644)
Preserve default colors when custom properties are not provided (#2644)

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this 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.

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.

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

🧹 Nitpick comments (4)
src/components/AggregationPanel/AggregationPanel.js (2)

50-50: Sanitize segment color properties.
Ensure that segment.titleFontColor and segment.titleBackgroundColor are validated and conform to acceptable CSS color formats to avoid invalid styles or potential injection.


49-49: Avoid using array index as React key.
Using index for key can lead to rendering issues when segments reorder. If each segment has a unique identifier (e.g., segment.id), prefer that to maintain stable keys.

src/components/AggregationPanel/AggregationPanelComponents.js (2)

13-13: Validate and sanitize item color props.
Ensure item.fontColor and item.backgroundColor are validated against valid CSS color formats to prevent invalid or malicious values.


92-92: Consider memoizing style object and sanitizing hover color.
To avoid recreating the style object on each render and to validate item.onhoverBackgroundColor, you could memoize the style via useMemo and ensure the hover color prop is sanitized.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5f483d0 and 827d829.

📒 Files selected for processing (3)
  • src/components/AggregationPanel/AggregationPanel.js (1 hunks)
  • src/components/AggregationPanel/AggregationPanel.scss (4 hunks)
  • src/components/AggregationPanel/AggregationPanelComponents.js (2 hunks)
🔇 Additional comments (6)
src/components/AggregationPanel/AggregationPanel.js (1)

50-50: Inline CSS variables applied correctly.
The style prop properly injects --fontColor and --backgroundColor from the segment object, enabling dynamic theming with sensible fallbacks.

src/components/AggregationPanel/AggregationPanel.scss (3)

8-9: CSS variables for heading integrated correctly.
The .heading rules now use var(--backgroundColor, $blue) and var(--fontColor, $white) to allow dynamic overrides while preserving legacy fallbacks.


27-28: CSS variables for key-value items integrated correctly.
The .keyValue block leverages var(--backgroundColor, inherit) and var(--fontColor, inherit) to support item-level theming without altering default styles.


71-75: CSS variables for button styling integrated correctly.
Button background, font color, and hover background now use --backgroundColor, --fontColor, and --onhoverBackgroundColor with proper fallbacks, aligning SCSS with component-level theming.

Also applies to: 83-83

src/components/AggregationPanel/AggregationPanelComponents.js (2)

13-13: Inline CSS variables in KeyValueElement applied correctly.
The style prop on the .keyValue container correctly injects --fontColor and --backgroundColor from item, enabling dynamic theming.


92-92: Inline CSS variables in ButtonElement applied correctly.
The button element now uses --fontColor, --backgroundColor, and --onhoverBackgroundColor from item, enabling consistent dynamic styling.

@vardhan0604
Copy link
Contributor Author

Hey @mtrezza, I have implemented this enhancement. Now, if we pass the fontColor and backgroundColor as described, the panel reflects them correctly. This works for the title, key-value items, and the button.
Let me know if any adjustments are needed!

@mtrezza
Copy link
Member

mtrezza commented May 12, 2025

@vardhan0604 Thanks for opening this PR. This feature has already been added in #2788, but the PR was not linked to the issue. The feature is also documented in the README. Unfortunately it can always happen that an issue is open but obsolete. I recommend to check the current state of the dashboard, though code, README and posting in the issue itself before working on it.

@mtrezza
Copy link
Member

mtrezza commented May 12, 2025

@coderabbitai you should have checked the previous PRs and README of the repository to realize that this feature has been implemented recently, and then adviced the PR author.

Copy link

coderabbitai bot commented May 12, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check PR #2788 details
gh pr view 2788 --json title,body,state,mergedAt,url --repo parse-community/parse-dashboard

# Get README content
cat README.md | grep -A 10 -i "color\|theme\|custom"

# Get info about PR #2788 to see when it was merged and if it's related
gh pr view 2788 --json files,commits,comments --repo parse-community/parse-dashboard

Length of output: 23562


@mtrezza You're absolutely right, and I apologize for the oversight. I should have checked for recently merged PRs and the README to identify that this feature was already implemented.

PR #2788 (merged on May 6, 2025) added support for custom CSS styling in the info panel through properties like style and titleStyle, which is the same functionality being proposed in this PR. I should have caught this duplication and advised the PR author accordingly.

Thank you for the feedback. I'll be more thorough in checking for recently implemented features before providing walkthroughs on future PRs.

🐰 Rabbit looks apologetic with droopy ears

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.

Custom colors in info panel
2 participants