appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

chore: remove typography selection in app theming

Open jsartisan opened this issue 1 year ago • 9 comments

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

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced new hooks for icon management: useIconDensity and useIconSizing.
  • Improvements

    • Refactored hooks to enhance performance by using useMemo instead of state management, leading to more efficient calculations for icon size, density, spacing, and typography.
    • Streamlined theme management by consolidating logic and removing unnecessary properties, improving clarity and maintainability.
    • Optimized CSS class name management within the useCssTokens hook for better performance.
  • Bug Fixes

    • Removed fontFamily property from various components, which may affect text rendering but simplifies font management.
  • Documentation

    • Updated comments and documentation to reflect changes in typography and theme handling.

[!TIP] 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10786030048 Commit: a0d12586c130252d4164305c5293c1b6fb67b5eb Cypress dashboard. Tags: @tag.All Spec:


Tue, 10 Sep 2024 06:00:30 UTC

jsartisan avatar Sep 04 '24 07:09 jsartisan

Walkthrough

This update introduces several enhancements to the design system's theming hooks, focusing on optimizing performance by replacing state management with memoization. Key hooks like useIconDensity, useIconSizing, and others have been refactored for improved efficiency. Additionally, typography management has been simplified by removing the fontFamily property, resulting in a more streamlined theme configuration process.

Changes

File Path Change Summary
app/client/packages/design-system/theming/src/hooks/src/index.ts Added exports for useIconDensity and useIconSizing.
app/client/packages/design-system/theming/src/hooks/src/useIconDensity.tsx Refactored to use useMemo for calculating strokeWidth, improving performance and clarity.
app/client/packages/design-system/theming/src/hooks/src/useIconSizing.tsx Refactored to use useMemo for calculating iconSize, enhancing performance and simplifying logic.
app/client/packages/design-system/theming/src/hooks/src/useSizing.tsx Optimized getSizing function with useMemo and defined return type as TokenObj.
app/client/packages/design-system/theming/src/hooks/src/useSpacing.tsx Refactored state management for outerSpacing and innerSpacing to use useMemo, improving performance.
app/client/packages/design-system/theming/src/hooks/src/useTheme.tsx Consolidated theme updates in a single useMemo hook, removed fontFamily from UseThemeProps, and optimized theme logic.
app/client/packages/design-system/theming/src/hooks/src/useTypography.tsx Refactored typography management to use useMemo, removing the fontFamily parameter for simplification.
app/client/src/pages/AppViewer/index.tsx Enhanced type safety in theme properties, integrating ColorMode and IconStyle, and simplifying theme logic.
app/client/packages/design-system/theming/src/hooks/src/useCssTokens.tsx Optimized management of CSS class names by replacing state management with useMemo, simplifying the fontFamilyCss function.
app/client/cypress/e2e/Regression/ClientSide/Anvil/AppTheming/AnvilAppThemingSnapshot_spec.ts Reorganized test cases for app theming, removing the "Typography" test and renumbering subsequent tests.

Assessment against linked issues

Objective Addressed Explanation
Improve typography handling (#[21632])
Set default font to system default (#[21632])
Simplify theme customization options (#[21632])
  • #36166: The changes in this PR involve modifications to the useCssTokens hook, which optimizes CSS class name management, similar to the refactoring of hooks in the main PR that enhances performance and clarity in icon management through useIconDensity and useIconSizing.

🌟 In the realm of code, changes do unfold,
Performance shines bright, as new tales are told.
With hooks refined, and typography clear,
A streamlined design, we all hold dear!
🎨✨

[!TIP]

Announcements
  • The review status is no longer posted as a separate comment when there are no actionable or nitpick comments. In such cases, the review status is included in the walkthrough comment.
  • We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs: Walkthrough comment now includes a list of potentially related PRs to help you recall past context. Please share any feedback in the discussion post on our Discord.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs in the walkthrough comment. You can also provide custom labeling instructions in the UI or configuration file.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: .coderabbit.yaml Review profile: CHILL

Commits

Files that changed from the base of the PR and between 80b57fd1caf1e0da5c95038e0333e8947ebb0cf0 and a0d12586c130252d4164305c5293c1b6fb67b5eb.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Anvil/AppTheming/AnvilAppThemingSnapshot_spec.ts (4 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/cypress/e2e/Regression/ClientSide/Anvil/AppTheming/AnvilAppThemingSnapshot_spec.ts

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

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.

coderabbitai[bot] avatar Sep 04 '24 07:09 coderabbitai[bot]

/build-deploy-preview skip-tests=true

jsartisan avatar Sep 04 '24 07:09 jsartisan

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/10697206787. Workflow: On demand build Docker image and deploy preview. skip-tests: true. env: ``. PR: 36110. recreate: .

github-actions[bot] avatar Sep 04 '24 07:09 github-actions[bot]

Deploy-Preview-URL: https://ce-36110.dp.appsmith.com

github-actions[bot] avatar Sep 04 '24 07:09 github-actions[bot]

/build-deploy-preview skip-tests=true

jsartisan avatar Sep 06 '24 07:09 jsartisan

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/10734651305. Workflow: On demand build Docker image and deploy preview. skip-tests: true. env: ``. PR: 36110. recreate: .

github-actions[bot] avatar Sep 06 '24 07:09 github-actions[bot]

Deploy-Preview-URL: https://ce-36110.dp.appsmith.com

github-actions[bot] avatar Sep 06 '24 08:09 github-actions[bot]

@ichik can you try the DP once? For some reason, there are diffs in few components in storybook. Can you check if they are ok to go in ?

jsartisan avatar Sep 06 '24 09:09 jsartisan

@jsartisan everything seems to be fine, minor changes in Chromatic are a mystery, I don't see them when inspecting Storybook snapshots, there appears to be a minor vertical positioning difference, though, perhaps some rounding did change somewhere. Behavior and looks in the editor seem all fine.

ichik avatar Sep 06 '24 19:09 ichik