Skip to content

Conversation

@chmurson
Copy link
Collaborator

@chmurson chmurson commented Aug 22, 2025

759dd60 - feat: Add label tooltips to filter menu
e00d007 - feat: Add outlined variant to Label component
437d922 - fix: labels filter dropdown color scheme and selection
e02c45b - style: update labels style to match design more closely
debca32 - chore: update @fluffylabs/shared-ui
ee17aad - add 0/1 indicator to labels dropdown; add there nice loading UI

@coderabbitai
Copy link

coderabbitai bot commented Aug 22, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Updates package.json scripts and a dependency version. Adjusts Label component API, styling, and color computation with a new color-utils module. Tweaks Label.css by removing padding and border-radius. Updates LabelsFilter to pass forcedColorScheme, adopt outlined labels with tooltips, adjust opacity handling, and prevent default selection in dropdown items.

Changes

Cohort / File(s) Summary of changes
Build & scripts
package.json
Added script qa-fix-unsafe: biome check --write --unsafe. Bumped @fluffylabs/shared-ui from ^0.1.1 to ^0.1.2.
Label styles
src/components/Label/Label.css
Removed padding: 1px 5px; and border-radius: 6px; from .label.
Label component & color utilities
src/components/Label/Label.tsx, src/components/Label/color-utils.ts
Label gains props `variant: "filled"
Labels filter integration
src/components/LabelsFilter/LabelsFilter.tsx
Passed forcedColorScheme to DropdownMenuContent. Switched Labels to variant="outlined" with showTooltip. Adjusted inactive opacity via classes. Added onSelect with e.preventDefault() on checkbox items; selection continues via onCheckedChange.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant LF as LabelsFilter
  participant DM as DropdownMenuContent
  participant CI as DropdownMenuCheckboxItem
  participant L as Label
  participant CU as color-utils

  U->>LF: Open labels menu / interact
  LF->>DM: Render with forcedColorScheme
  loop For each label
    DM->>CI: Render checkbox item
    CI->>L: Render Label(variant="outlined", showTooltip)
    L->>CU: Compute colors (hslToHex, contrast, hslColorToCss)
    CU-->>L: Hex/HSL and contrast values
  end

  U->>CI: Click item
  CI->>CI: onSelect(e.preventDefault())
  CI->>LF: onCheckedChange(checked)
  LF->>LF: Update selection state
  LF->>L: Re-render Label with updated classes
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • DrEverr
  • mateuszsikora
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-shared-ui-for-dropdown-improvements

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@netlify
Copy link

netlify bot commented Aug 22, 2025

Deploy Preview for graypaper-reader ready!

Name Link
🔨 Latest commit 8f1e191
🔍 Latest deploy log https://app.netlify.com/projects/graypaper-reader/deploys/68acaf6823b9de00083c0c18
😎 Deploy Preview https://deploy-preview-277--graypaper-reader.netlify.app
📱 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 project configuration.

@chmurson chmurson marked this pull request as ready for review August 25, 2025 17:18
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 (6)
package.json (1)

10-10: Be cautious with “unsafe” auto-fixes in CI/dev flows

Adding biome’s --unsafe can rewrite code in non-trivial ways. Consider restricting it to local-only usage (e.g., a separate npm script not used by hooks/CI) or scoping to specific paths. Document its intended use in CONTRIBUTING.md.

src/components/Label/color-utils.ts (2)

13-19: Tighten types for contrast to guarantee RGB tuple length

Use a fixed-size tuple instead of number[] to prevent accidental short/long arrays and improve call-site safety.

Apply:

-export function contrast(rgb1: number[], rgb2: number[]) {
+export type RGB = readonly [number, number, number];
+export function contrast(rgb1: RGB, rgb2: RGB) {

1-3: Optionally round HSL values for stable CSS strings

If hslColorToCss receives high-precision floats, CSS is valid but noisy. Rounding to one decimal improves consistency and caching.

Apply:

-export function hslColorToCss(hsl: [number, number, number]) {
-  return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;
+export type HSL = readonly [number, number, number];
+export function hslColorToCss(hsl: HSL) {
+  const [h, s, l] = hsl;
+  const r = (v: number) => Math.round(v * 10) / 10;
+  return `hsl(${r(h)}, ${r(s)}%, ${r(l)}%)`;
 }
src/components/Label/Label.tsx (3)

25-32: Prefer class merging helper for predictable class composition

Use twMerge to combine base classes with overrides and avoid accidental duplication when consumers pass spacing/rounded utilities.

Apply:

-  return (
-    <span
-      style={style}
-      className={`label truncate ${className} rounded-xl px-2.5 py-0.5`}
-      title={showTooltip ? label : undefined}
-    >
+  return (
+    <span
+      style={style}
+      className={twMerge("label truncate rounded-xl px-2.5 py-0.5", className)}
+      title={showTooltip ? label : undefined}
+    >

Also applies to: 34-41


49-54: Revisit dimming formula for outlined background; current lightness/5 may be too dark

Dividing lightness by 5 (e.g., 65 → 13) produces near-black backgrounds, which can reduce contrast for the colored text, especially for hues with poor contrast at low L. Consider a gentler dim (e.g., clamp to [20–30]) or scale relative to current L.

Example:

-  const newDimmedLightness = mainColor.hsl[2] / 5;
+  const newDimmedLightness = Math.max(22, Math.min(32, mainColor.hsl[2] * 0.5));

56-67: Text color heuristic is simple and works; consider WCAG AA checks if needed

The white path uses #E0E0E0 for reduced glare. If accessibility targets require 4.5:1, consider computing contrast against both #000 and #E0E0E0 and falling back to #FFF if needed to hit AA.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8035eee and debca32.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • package.json (2 hunks)
  • src/components/Label/Label.css (0 hunks)
  • src/components/Label/Label.tsx (4 hunks)
  • src/components/Label/color-utils.ts (1 hunks)
  • src/components/LabelsFilter/LabelsFilter.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/components/Label/Label.css
🧰 Additional context used
🧬 Code graph analysis (2)
src/components/LabelsFilter/LabelsFilter.tsx (1)
src/components/Label/Label.tsx (1)
  • Label (8-43)
src/components/Label/Label.tsx (2)
src/components/NotesProvider/hooks/useLabels.ts (1)
  • PrefixedLabel (8-8)
src/components/Label/color-utils.ts (2)
  • hslColorToCss (1-3)
  • hslToHex (21-32)
🔇 Additional comments (6)
package.json (1)

22-22: Confirm forcedColorScheme prop support on DropdownMenuContent

Please verify that your installed version of @fluffylabs/shared-ui (^0.1.2) exposes a forcedColorScheme prop on its DropdownMenuContent component. If this prop isn’t explicitly handled by the component (in its implementation or TypeScript declarations), it will be forwarded to the underlying DOM element and trigger React warnings about unknown props.

Recommended verification steps:

  • Inspect the source or type definitions of DropdownMenuContent in node_modules/@fluffylabs/shared-ui and ensure forcedColorScheme is listed.
  • Run a quick search, for example:
    grep -R "forcedColorScheme" node_modules/@fluffylabs/shared-ui
    • Open the component’s .d.ts (or source) and look for a matching prop signature.
src/components/Label/color-utils.ts (1)

5-11: Good luminance/contrast implementation

sRGB companding and Rec. 709 coefficients look correct. No side effects; nice and testable.

src/components/LabelsFilter/LabelsFilter.tsx (3)

70-70: Prop passthrough: confirm DropdownMenuContent supports forcedColorScheme

Same concern as in package.json: ensure this prop is defined on the shared-ui component and not forwarded to a DOM node.

If needed, gate it with a conditional prop spread:

-      <DropdownMenuContent className="w-auto max-w-72" align="end" forcedColorScheme={forcedColorScheme}>
+      <DropdownMenuContent
+        className="w-auto max-w-72"
+        align="end"
+        {...(forcedColorScheme ? { forcedColorScheme } : {})}
+      >

77-79: onSelect preventDefault is appropriate to keep the menu open; verify keyboard behavior

Preventing default here keeps the menu open for multi-select, which matches the intent. Please confirm that Space/Enter still toggle via onCheckedChange for both root and child items and that focus doesn’t get trapped.

Manual checks:

  • Navigate with Arrow keys, toggle with Space/Enter, ensure the menu stays open.
  • Click outside should still close the menu.
  • ESC should close the menu.

Also applies to: 92-94


80-85: Nice: tooltip + outlined variant improve scannability

Good UX tweak. Truncation with title preserves discoverability for long labels.

src/components/Label/Label.tsx (1)

81-87: Good: color generation pipeline is deterministic and stable across sessions

Fixed palette size with hash → hue mapping plus hslToHex makes label colors predictable. Nice.

@chmurson chmurson merged commit 270b754 into main Aug 25, 2025
8 checks passed
@chmurson chmurson deleted the update-shared-ui-for-dropdown-improvements branch August 25, 2025 18:48
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.

1 participant