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

chore: Adjust prominence of icon and main text in StatBox #34729

Closed
wants to merge 1 commit into from

Conversation

ichik
Copy link
Contributor

@ichik ichik commented Jul 4, 2024

Description

Fixes #34334

Before After
before after

Automation

/ok-to-test tags="@tag.Anvil"

🔍 Cypress test results

Caution

If you modify the content in this section, you are likely to disrupt the CI result for your PR.

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Improved color calculation logic for fgNeutral in both Dark Mode and Light Mode themes, enhancing visual clarity.
  • Bug Fixes

    • Updated test cases for fgNeutral and fgNeutralSubtle colors to reflect new calculations, ensuring accuracy in different scenarios.

@ichik ichik requested a review from KelvinOm July 4, 2024 15:03
@ichik ichik self-assigned this Jul 4, 2024
Copy link
Contributor

coderabbitai bot commented Jul 4, 2024

Walkthrough

The recent code update simplifies the color calculation logic for fgNeutral in both DarkModeTheme and LightModeTheme by adjusting the lightness based on the main foreground color. It includes modifications to tests to reflect these new calculations, ensuring precise color adjustments for neutral and subtle variations.

Changes

File Path Summary
.../DarkModeTheme.ts Simplified fgNeutral color calculation based on fg.
.../LightModeTheme.ts Simplified fgNeutral color calculation to make it less prominent than the main foreground color.
.../DarkModeTheme.test.ts Adjustments to color values in tests for fgNeutral and fgNeutralSubtle.
.../LightModeTheme.test.ts Updated RGB values for fgNeutral and fgNeutralSubtle to reflect precise color calculations.

Assessment against linked issues

Objective Addressed Explanation
Adjust prominence of icon and main text in StatBox (#34334)

Poem

In themes of light and dark, we play,
Adjusting hues by night and day.
More subtle tones for icons shine,
A coder's world in color fine.
With every test and line of code,
The rabbit hops down the aesthetic road. 🌟


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@github-actions github-actions bot added Anvil Pod Issue related to Anvil project Task A simple Todo WDS team skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Jul 4, 2024
@ichik
Copy link
Contributor Author

ichik commented Jul 4, 2024

@KelvinOm we need to also be able to pass the color to the icon and set it to valueColor for this widget.

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 52e8cda and fc6431b.

Files selected for processing (4)
  • app/client/packages/design-system/theming/src/color/src/DarkModeTheme.ts (1 hunks)
  • app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts (1 hunks)
  • app/client/packages/design-system/theming/src/color/tests/DarkModeTheme.test.ts (2 hunks)
  • app/client/packages/design-system/theming/src/color/tests/LightModeTheme.test.ts (2 hunks)
Files skipped from review due to trivial changes (3)
  • app/client/packages/design-system/theming/src/color/src/DarkModeTheme.ts
  • app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts
  • app/client/packages/design-system/theming/src/color/tests/DarkModeTheme.test.ts
Additional comments not posted (2)
app/client/packages/design-system/theming/src/color/tests/LightModeTheme.test.ts (2)

600-612: Verify new RGB values for fgNeutral color calculations.

The RGB values for fgNeutral have been updated. Ensure these new values are correctly calculated and reflect the intended color adjustments.


622-622: Verify new RGB value for fgNeutralSubtle color calculation.

The RGB value for fgNeutralSubtle has been updated. Ensure this new value is correctly calculated and reflects the intended color adjustment.

Verification successful

Verify new RGB value for fgNeutralSubtle color calculation.

The fgNeutralSubtle color is derived by incrementing the lightness of fgNeutral, which itself is derived from fg with a lightness increment. The initial fg color is set with a lightness of 0.12. Ensure these adjustments result in the expected RGB value of rgb(19.892% 19.892% 19.892%).

  • LightModeTheme.ts:
    • private get fg(): Initializes fg with this.seedColor and sets color.oklch.l = 0.12.
    • private get fgNeutral(): Clones fg and increments lightness by 0.1.
    • private get fgNeutralSubtle(): Clones fgNeutral and increments lightness by 0.1.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new RGB value for `fgNeutralSubtle` color calculation.

# Test: Search for the `fgNeutralSubtle` color calculation in the `LightModeTheme` implementation.
rg --type python $'fgNeutralSubtle'

Length of output: 65


Script:

#!/bin/bash
# Description: Verify the new RGB value for `fgNeutralSubtle` color calculation.

# Test: Search for the `fgNeutralSubtle` color calculation in the `LightModeTheme` implementation.
rg 'fgNeutralSubtle' --type-add 'web:*.{ts,tsx,js,jsx}' --type web

Length of output: 1461


Script:

#!/bin/bash
# Description: Extract the relevant code segments for `fgNeutralSubtle` calculation in `LightModeTheme.ts`.

# Extract the definition of the `fgNeutralSubtle` getter in `LightModeTheme.ts`.
rg --pcre2 --context 5 'private get fgNeutralSubtle' app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts

Length of output: 300


Script:

#!/bin/bash
# Description: Extract the definition of `this.fgNeutral` in `LightModeTheme.ts` to verify its initial value.

# Extract the definition and assignment of `fgNeutral` in `LightModeTheme.ts`.
rg --pcre2 --context 5 'fgNeutral' app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts

Length of output: 1027


Script:

#!/bin/bash
# Description: Extract the definition of `this.fg` in `LightModeTheme.ts` to verify its initial value.

# Extract the definition and assignment of `fg` in `LightModeTheme.ts`.
rg --pcre2 --context 5 'fg' app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts

Length of output: 6066

@KelvinOm KelvinOm mentioned this pull request Jul 8, 2024
2 tasks
KelvinOm added a commit that referenced this pull request Jul 9, 2024
## Description
1. Add scripts for local e2e testing in the docker container. 
2. Add types for cypress-image-snapshot

In this PR, I also added the following PRS as they affect screenshot
tests as well. I did this to speed up the process and unblock the team.

#34528
#34546
#34676
#34729
#34638
#34639
#34511

To run E2E tests locally in docker, you need to do the following:
1. Run FE locally and prepare the tests for local launch. See the
instructions
[here](https://github.com/appsmithorg/appsmith/blob/release/contributions/ClientSetup.md).
2. Run `yarn cypress:snapshot:docker:build` — this will create a docker
container with the necessary environment.
3. Run `yarn cypress:snapshot:docker
"./cypress/e2e/Regression/ClientSide/Anvil/Widgets/*_spec.ts"
updateSnapshots=false`. Here we can use the path to a specific file, or
set `updateSnapshots=true` flag to update the screenshots.

## Automation

/ok-to-test tags="@tag.Anvil"

### :mag: Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9844579277>
> Commit: 75f2659
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9844579277&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Anvil`
> Spec:
> <hr>Mon, 08 Jul 2024 18:37:36 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added support for image snapshot testing with the
`@types/cypress-image-snapshot` dependency.

- **Refactor**
- Updated test specifications by removing unnecessary
`triggerInputInvalidState()` calls.
- Reorganized and improved efficiency of image snapshot methods for
various devices.

- **Chores**
- Updated `Dockerfile` to configure the Cypress environment with
specific versions for dependencies.
  - Changed import paths in `e2e.js` for better module resolution. 

- **Style**
  - Fixed a comment typo in Cypress plugin configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Pawan Kumar <[email protected]>
Co-authored-by: unknown <[email protected]>
@KelvinOm
Copy link
Collaborator

KelvinOm commented Jul 9, 2024

Merged here.

@KelvinOm KelvinOm closed this Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Anvil Pod Issue related to Anvil project skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo WDS team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore: Adjust prominence of icon and main text in StatBox
2 participants