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

fix(ds): fix (negative) elevations #17616

Merged
merged 1 commit into from
Mar 12, 2025
Merged

Conversation

jvaclavik
Copy link
Contributor

@jvaclavik jvaclavik commented Mar 12, 2025

Description

Related Issue

Resolve

Screenshots:

BEFORE AFTER
image image
image image

@jvaclavik jvaclavik requested review from Nodonisko and a team as code owners March 12, 2025 15:47
Copy link

coderabbitai bot commented Mar 12, 2025

Walkthrough

The changes update how negative elevation values are handled across the codebase. In the button styling utility, the mapping for elevation -1 now returns a new token, replacing the previous one. In the theme configuration, multiple new properties have been added to both light and dark themes for managing negative elevation, while deprecated or invalid tokens have been removed. Additionally, the palette conversion script now normalizes names by replacing instances of "-1" with "Negative" before further processing. No changes were made to the public API declarations.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8a2e798 and 8bdbb70.

📒 Files selected for processing (3)
  • packages/components/src/components/buttons/buttonStyleUtils.ts (1 hunks)
  • packages/theme/src/colors.ts (4 hunks)
  • scripts/convertFigmaPalette.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/convertFigmaPalette.ts
  • packages/components/src/components/buttons/buttonStyleUtils.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=other, trezor-user-env-unix)
  • GitHub Check: run-e2e-suite-desktop-tests (@group=passphrase, trezor-user-env-unix)
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: build-web
  • GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (2)
packages/theme/src/colors.ts (2)

34-143:

✅ Verification successful

Consider verifying usage for newly introduced negative elevation tokens in the light theme.
The addition of “OnElevationNegative” tokens for backgrounds, borders, and interactions aligns with the existing naming pattern for elevation states (0, 1, 2, 3). However, please ensure these tokens are actually used in button or component styles throughout the codebase. If they remain unused, consider removing to avoid code bloat. Similarly, you might benefit from programmatically generating these variants to reduce duplication and simplify future maintenance.

You can run a script to locate references across the repo:


🏁 Script executed:

#!/bin/bash
# Verify usage of newly introduced negative elevation tokens in the light theme

tokens=(
"backgroundAlertBlueSubtleOnElevationNegative"
"backgroundAlertPurpleSubtleOnElevationNegative"
"backgroundAlertRedSubtleOnElevationNegative"
"backgroundAlertYellowSubtleOnElevationNegative"
"backgroundNeutralSubtleOnElevationNegative"
"backgroundPrimarySubtleOnElevationNegative"
"backgroundSurfaceElevationNegative"
"backgroundTertiaryDefaultOnElevationNegative"
"backgroundTertiaryPressedOnElevationNegative"
"borderOnElevationNegative"
"interactionBackgroundDestructiveDefaultHoverOnElevationNegative"
"interactionBackgroundDestructiveDefaultNormalOnElevationNegative"
"interactionBackgroundInfoDefaultHoverOnElevationNegative"
"interactionBackgroundInfoDefaultNormalOnElevationNegative"
"interactionBackgroundTertiaryDefaultHoverOnElevationNegative"
"interactionBackgroundTertiaryDefaultNormalOnElevationNegative"
"interactionBackgroundWarningDefaultHoverOnElevationNegative"
"interactionBackgroundWarningDefaultNormalOnElevationNegative"
)

for token in "${tokens[@]}"; do
    rg "$token"
done

Length of output: 12116


Action: Negative Elevation Tokens Verified in Use

The verification confirms that all the newly introduced “OnElevationNegative” tokens are actively referenced across various components (e.g., in AlertBox, HomeScreen, and several suite-native and suite components). Their usage aligns with the established naming pattern, and no evidence of unused tokens was found.

  • The tokens are consistently applied in both light and dark theme contexts.
  • While removal isn’t needed, you might consider automating the generation of these token variants to reduce duplication and aid future maintainability.

208-317:

✅ Verification successful

Ensure that negative elevation tokens for the dark theme are consistent and fully tested.
Similar to the light theme tokens, these negative elevation mappings appear to maintain naming consistency with the existing elevations 0–3. Verify that the new color definitions (e.g., backgroundAlertBlueSubtleOnElevationNegative, borderOnElevationNegative, etc.) integrate correctly in dark mode. If some tokens are unused, consider removing or at least documenting their intended use.

You can run a script to check where these tokens are referenced:


🏁 Script executed:

#!/bin/bash
# Verify usage of newly introduced negative elevation tokens in the dark theme

tokens=(
"backgroundAlertBlueSubtleOnElevationNegative"
"backgroundAlertPurpleSubtleOnElevationNegative"
"backgroundAlertRedSubtleOnElevationNegative"
"backgroundAlertYellowSubtleOnElevationNegative"
"backgroundNeutralSubtleOnElevationNegative"
"backgroundPrimarySubtleOnElevationNegative"
"backgroundSurfaceElevationNegative"
"backgroundTertiaryDefaultOnElevationNegative"
"backgroundTertiaryPressedOnElevationNegative"
"borderOnElevationNegative"
"interactionBackgroundDestructiveDefaultHoverOnElevationNegative"
"interactionBackgroundDestructiveDefaultNormalOnElevationNegative"
"interactionBackgroundInfoDefaultHoverOnElevationNegative"
"interactionBackgroundInfoDefaultNormalOnElevationNegative"
"interactionBackgroundTertiaryDefaultHoverOnElevationNegative"
"interactionBackgroundTertiaryDefaultNormalOnElevationNegative"
"interactionBackgroundWarningDefaultHoverOnElevationNegative"
"interactionBackgroundWarningDefaultNormalOnElevationNegative"
)

for token in "${tokens[@]}"; do
    rg "$token"
done

Length of output: 12116


Negative Elevation Tokens in Dark Theme – Integration Verified

The negative elevation tokens in packages/theme/src/colors.ts have been defined consistently, and our search confirms that all tokens (e.g., backgroundAlertBlueSubtleOnElevationNegative, borderOnElevationNegative, etc.) are actively referenced across various components (such as alerts, pictograms, and layout elements). There are no signs of unused tokens, and the naming aligns with the established patterns for elevations 0–3. Please ensure that dark mode visual tests remain robust to cover these definitions.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
  • @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.

@@ -22,6 +22,7 @@ import { hideBin } from 'yargs/helpers';

const normalizeName = (name: string) =>
name
.replace(/(-1)/g, 'Negative')
Copy link
Contributor Author

@jvaclavik jvaclavik Mar 12, 2025

Choose a reason for hiding this comment

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

This caused bug that I forgot to add these "negative" colors 😅

(-1 was converted to 1 and it was replaced with next 1 token)

@jvaclavik jvaclavik requested a review from seibei-iguchi March 12, 2025 15:54
@jvaclavik jvaclavik requested a review from matejkriz March 12, 2025 16:06
@jvaclavik jvaclavik force-pushed the fix-negative-elevations branch from 8a2e798 to 8bdbb70 Compare March 12, 2025 16:28
@jvaclavik jvaclavik merged commit 308f6bb into develop Mar 12, 2025
29 checks passed
@jvaclavik jvaclavik deleted the fix-negative-elevations branch March 12, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🤝 Needs QA
Development

Successfully merging this pull request may close these issues.

2 participants