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

updating colors #35

Merged
merged 4 commits into from
Jan 22, 2025
Merged

updating colors #35

merged 4 commits into from
Jan 22, 2025

Conversation

Naseem77
Copy link
Contributor

@Naseem77 Naseem77 commented Jan 21, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced dynamic color theming for charts and navigation buttons using CSS custom properties.
    • Added new color variables for FalkorDB and Neo4j.
  • Styling

    • Updated color references in charts and navigation components to use new named color variables.
    • Enhanced visual styling of buttons and footer links for improved user experience.
    • Increased font size for subtitles in charts.
  • Configuration

    • Updated Tailwind CSS configuration to support new color variables.
  • Test Results

    • Latest test run status updated to "interrupted" with no specific test failures.

Copy link

vercel bot commented Jan 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
benchmark ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 22, 2025 1:40pm

Copy link

coderabbitai bot commented Jan 21, 2025

Walkthrough

This pull request introduces a color management strategy across various UI components by replacing hardcoded color values with dynamic CSS custom properties. The changes affect multiple files, including chart components, global CSS, navigation, and Tailwind configuration, allowing for a consistent and flexible theming approach that can be easily customized through CSS variables. Additionally, the test run status in a JSON file has been updated to reflect an interrupted state.

Changes

File Change Summary
ui/app/components/HorizontalBarChart.tsx Introduced backgroundColors variable to use CSS custom properties for dynamic background colors based on the window object. Updated chartData to utilize this new variable. Increased subtitle font size and specified font families.
ui/app/components/VerticalBarChart.tsx Modified getBarColor function to fetch colors from CSS properties and removed the defaultColor parameter. Updated chartData construction and added borderRadius to datasets. Increased subtitle font size and specified font families.
ui/app/globals.css Added new CSS custom properties --FalkorDB-color and --Neo4j-color.
ui/components/ui/nav-main.tsx Updated button styling to use named color classes instead of hardcoded hex values for selected options.
ui/tailwind.config.js Added new color definitions for FalkorDB and Neo4j using CSS variables.
ui/test-results/.last-run.json Updated test results file to indicate an "interrupted" status with no failed tests.
ui/app/components/footer.tsx Modified anchor element styling in the footer to use new color classes, enhancing visual presentation.

Possibly related PRs

  • restyle benchmark ui #8: Changes in the main PR regarding dynamic styling using CSS custom properties are related to the modifications in the VerticalBarChart.tsx and HorizontalBarChart.tsx files, which also utilize CSS custom properties for color values.

Suggested reviewers

  • Anchel123
  • barakb

Poem

🎨 Colors dance, variables sing,
A rabbit's palette takes wing!
FalkorDB red, Neo4j blue,
Dynamic styling, fresh and true!
Hop along the color lane! 🐰✨


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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: 3

🧹 Nitpick comments (4)
ui/app/components/VerticalBarChart.tsx (1)

54-66: Optimize color retrieval to reduce DOM reads.

The current implementation calls getBarColor multiple times for the same vendor, triggering unnecessary DOM reads.

Consider caching the color value:

 const chartData = {
   labels: ["P50", "P95", "P99"],
   datasets: data.flatMap((item, index) => [
+    const itemColor = getBarColor(item.vendor);
     {
       label: `${item.vendor} P50`,
       data: [item.p50, 0, 0],
-      backgroundColor: getBarColor(item.vendor),
+      backgroundColor: itemColor,
       stack: `${index}`,
     },
     {
       label: `${item.vendor} P95`,
       data: [0, item.p95, 0],
-      backgroundColor: getBarColor(item.vendor),
+      backgroundColor: itemColor,
       stack: `${index}`,
     },
     {
       label: `${item.vendor} P99`,
       data: [0, 0, item.p99],
-      backgroundColor: getBarColor(item.vendor),
+      backgroundColor: itemColor,
       stack: `${index}`,
     },
   ]),
 };
ui/components/ui/nav-main.tsx (1)

87-89: Maintain consistency in color management.

While FalkorDB and Neo4j colors now use Tailwind classes, the third option still uses a hardcoded hex value (#7466FF).

Consider adding this color to your Tailwind config and using it consistently:

-                            ? "bg-[#F5F4FF] text-FalkorDB border-FalkorDB"
-                            : option.id === "neo4j"
-                            ? "bg-[#F5F4FF] text-Neo4j border-Neo4j"
-                            : "bg-[#F5F4FF] text-[#7466FF] border-[#7466FF]"
+                            ? "bg-highlight text-FalkorDB border-FalkorDB"
+                            : option.id === "neo4j"
+                            ? "bg-highlight text-Neo4j border-Neo4j"
+                            : "bg-highlight text-primary border-primary"

Add to tailwind.config.js:

 colors: {
   FalkorDB: 'var(--FalkorDB-color)',
   Neo4j: 'var(--Neo4j-color)',
+  primary: 'var(--primary-color)',
+  highlight: 'var(--highlight-bg)',
ui/app/globals.css (2)

52-53: Consider using HSL color format for consistency.

The new color variables use hex format while existing theme colors use HSL. Consider converting the hex colors to HSL for consistency with the existing color system:

  • #FF804D12 100% 65%
  • #0B6190203 86% 30%
- --FalkorDB-color: #FF804D;
- --Neo4j-color: #0B6190;
+ --FalkorDB-color: hsl(12 100% 65%);
+ --Neo4j-color: hsl(203 86% 30%);

52-53: Consider adding dark mode variants for brand colors.

The brand colors should have dark mode variants to maintain consistency with the theme system's dark mode support. Consider adding corresponding color definitions in the .dark selector.

.dark {
  /* existing dark mode variables */
+ --FalkorDB-color: hsl(12 100% 55%);  /* Darker variant */
+ --Neo4j-color: hsl(203 86% 25%);     /* Darker variant */
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2f77842 and 40fc881.

📒 Files selected for processing (6)
  • ui/app/components/HorizontalBarChart.tsx (1 hunks)
  • ui/app/components/VerticalBarChart.tsx (2 hunks)
  • ui/app/globals.css (1 hunks)
  • ui/components/ui/nav-main.tsx (1 hunks)
  • ui/tailwind.config.js (1 hunks)
  • ui/test-results/.last-run.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • ui/test-results/.last-run.json
🧰 Additional context used
🪛 Biome (1.9.4)
ui/app/components/VerticalBarChart.tsx

[error] 36-36: This code is unreachable

... because this statement will return from the function beforehand

(lint/correctness/noUnreachable)

🔇 Additional comments (2)
ui/tailwind.config.js (1)

23-24: LGTM! Well-structured color definitions.

The addition of FalkorDB and Neo4j colors using CSS custom properties follows best practices for theme management in Tailwind CSS.

ui/app/globals.css (1)

52-53: Verify color contrast ratios for accessibility.

Please ensure that these brand colors meet WCAG 2.1 contrast requirements when used for text or interactive elements.

@Naseem77 Naseem77 linked an issue Jan 22, 2025 that may be closed by this pull request
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: 1

♻️ Duplicate comments (1)
ui/app/components/VerticalBarChart.tsx (1)

31-39: ⚠️ Potential issue

Fix syntax error and improve error handling in getBarColor.

The previously identified issues in the function are still present and need to be addressed:

  1. Remove the extra semicolon in the Neo4j case
  2. Add error handling for getComputedStyle
  3. Add type safety for document.documentElement
  4. Add SSR support

Please refer to the previous review comment for the detailed fix.

🧰 Tools
🪛 Biome (1.9.4)

[error] 36-36: This code is unreachable

... because this statement will return from the function beforehand

(lint/correctness/noUnreachable)

🧹 Nitpick comments (1)
ui/app/components/VerticalBarChart.tsx (1)

54-70: Reduce code duplication in dataset configuration.

The backgroundColor and borderRadius properties are repeated across multiple dataset objects. Consider extracting these common properties into a shared configuration object.

 const chartData = {
   labels: ["P50", "P95", "P99"],
+  const commonDatasetConfig = (vendor: string) => ({
+    backgroundColor: getBarColor(vendor),
+    borderRadius: 8,
+  });
   datasets: data.flatMap((item, index) => [
     {
       label: `${item.vendor} P50`,
       data: [item.p50, 0, 0],
-      backgroundColor: getBarColor(item.vendor),
-      borderRadius: 8,
       stack: `${index}`,
+      ...commonDatasetConfig(item.vendor),
     },
     // Apply similar changes to other dataset objects
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cc99682 and 39ef608.

📒 Files selected for processing (3)
  • ui/app/components/HorizontalBarChart.tsx (3 hunks)
  • ui/app/components/VerticalBarChart.tsx (3 hunks)
  • ui/app/globals.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • ui/app/globals.css
  • ui/app/components/HorizontalBarChart.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
ui/app/components/VerticalBarChart.tsx

[error] 36-36: This code is unreachable

... because this statement will return from the function beforehand

(lint/correctness/noUnreachable)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Rust project - Build and Test (stable)

@Naseem77 Naseem77 requested review from gkorland and barakb January 22, 2025 14:23
@@ -28,14 +28,14 @@ interface VerticalBarChartProps {
xAxisTitle: string;
}

const getBarColor = (vendor: string, defaultColor: string) => {
const getBarColor = (vendor: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

why aren't you use the const backgroundColors ?

@Naseem77 Naseem77 merged commit 15519c3 into master Jan 22, 2025
4 checks passed
@Naseem77 Naseem77 deleted the update-style branch January 22, 2025 15:06
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.

Rounded edges for the vertical chart + font updates Update FalkorDB UI colors
2 participants