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: Update ADS button min width #37338

Merged
merged 6 commits into from
Nov 13, 2024
Merged

chore: Update ADS button min width #37338

merged 6 commits into from
Nov 13, 2024

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Nov 12, 2024

Description

Sets the min width of an ADS button (expect icon buttons) to be 60px

Fixes #37367

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11809774671
Commit: 224483d
Cypress dashboard.
Tags: @tag.All
Spec:


Wed, 13 Nov 2024 07:15:22 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Enhanced button styles to include minimum width constraints: 60 pixels for small buttons and 80 pixels for medium buttons, improving layout consistency for non-icon buttons.
    • Introduced a new property isIconButton in the Button component to adjust button presentation.
    • Added functionality to refresh the workspace list immediately after creating a new workspace.
    • Implemented improved error handling by checking for workspace.id before rendering workspace items.
    • Added a new state variable to manage the visibility of the import application modal.

Copy link
Contributor

coderabbitai bot commented Nov 12, 2024

Walkthrough

The pull request modifies the Button.styles.tsx file by enhancing the getSizes function to introduce a --button-min-width variable for small (sm) and medium (md) button sizes. Small buttons are assigned a minimum width of 60px, while medium buttons have a minimum width of 80px. The min-width property for non-icon buttons is updated to use this new variable, while icon buttons retain an "unset" value. These changes standardize button layout behavior based on size and icon presence.

Changes

File Path Change Summary
app/client/packages/design-system/ads/src/Button/Button.styles.tsx Enhanced getSizes function with --button-min-width for sm (60px) and md (80px) sizes; updated min-width for non-icon buttons to use this variable, icon buttons remain "unset".
app/client/src/ce/pages/Applications/index.tsx Added isIconButton property in Button component; updated createNewWorkspace to call fetchAllWorkspaces() post-creation; modified WorkspaceMenuItem to check for workspace.id; added state variable selectedWorkspaceIdForImportApplication; included resetCurrentWorkspace action in mapDispatchToProps.

Possibly related PRs

Suggested labels

Task, Design System Product, Widgets & Accelerators Pod

Suggested reviewers

  • ankitakinger
  • albinAppsmith
  • KelvinOm

🎉 In the realm of buttons, a change so bright,
Non-icon ones now have a width just right!
Sixty pixels they claim, with a style that’s neat,
While icons stay free, their layout's a treat!
So here’s to the buttons, both bold and refined,
In our design system, harmony we find! 🎨


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

@hetunandu hetunandu added ADS Components All issues related ADS components ok-to-test Required label for CI labels Nov 12, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Nov 12, 2024
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

🧹 Outside diff range and nitpick comments (3)
app/client/src/ce/pages/Applications/index.tsx (3)

Line range hint 572-579: Consider memoizing workspace filtering logic

The workspace filtering logic could benefit from memoization to prevent unnecessary recalculations on re-renders.

-  const activeWorkspace = workspaces.find(
-    (workspace: Workspace) => workspace.id === activeWorkspaceId,
-  );
+  const activeWorkspace = useMemo(
+    () => workspaces.find((workspace: Workspace) => workspace.id === activeWorkspaceId),
+    [workspaces, activeWorkspaceId]
+  );

Line range hint 1012-1016: Add type safety to workspaces mapping

The any type usage could lead to runtime errors. Consider adding proper typing.

-  let workspaces: any;
+  let workspaces: Workspace[];

Line range hint 1034-1057: Enhance error handling for workspace fetching

The workspace fetching logic should include proper error handling for failed API calls.

  useEffect(() => {
+   try {
      setActiveWorkspaceId(
        workspaceIdFromQueryParams
          ? workspaceIdFromQueryParams
          : workspaces[0]?.id,
      );

      if (
        activeWorkspaceId &&
        fetchedWorkspaceId &&
        fetchedWorkspaceId !== activeWorkspaceId
      ) {
        const activeWorkspace: Workspace = workspaces.find(
          (workspace: Workspace) => workspace.id === activeWorkspaceId,
        );

        if (activeWorkspace) {
          dispatch({
            type: ReduxActionTypes.SET_CURRENT_WORKSPACE,
            payload: { ...activeWorkspace },
          });
          dispatch(
            fetchEntitiesOfWorkspace({
              workspaceId: activeWorkspaceId,
            }),
          );
        }
      }
+   } catch (error) {
+     dispatch({
+       type: ReduxActionTypes.FETCH_WORKSPACE_ERROR,
+       payload: { error },
+     });
+   }
  }, [workspaceIdFromQueryParams, fetchedWorkspaces, activeWorkspaceId]);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9d2bac7 and 224483d.

📒 Files selected for processing (1)
  • app/client/src/ce/pages/Applications/index.tsx (1 hunks)
🔇 Additional comments (1)
app/client/src/ce/pages/Applications/index.tsx (1)

321-321: LGTM: Button prop addition aligns with requirements

The addition of isIconButton prop helps distinguish icon-only buttons from regular buttons, supporting the min-width requirements.

@hetunandu hetunandu enabled auto-merge (squash) November 13, 2024 07:07
@github-actions github-actions bot added ADS Visual Styles All issues related to ADS visual styles Design System Product Appsmith design system related issues IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Task A simple Todo labels Nov 13, 2024
@hetunandu hetunandu merged commit df7521e into release Nov 13, 2024
94 of 95 checks passed
@hetunandu hetunandu deleted the chore/button-min-width branch November 13, 2024 07:15
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Nov 20, 2024
## Description

Sets the min width of an ADS button (expect icon buttons) to be 60px


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/11809774671>
> Commit: 224483d
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11809774671&attempt=1&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.All
> Spec: 
> The following are new failures, please fix them before merging the PR:
<ol>
>
<li>cypress/e2e/Regression/ClientSide/Widgets/ListV2/Childwigets/List_Inputs_spec.js</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Wed, 13 Nov 2024 04:12:40 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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


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

- **New Features**
- Enhanced button styles to include minimum width constraints: 60 pixels
for small buttons and 80 pixels for medium buttons, improving layout
consistency for non-icon buttons.
- Introduced a new property `isIconButton` in the `Button` component to
adjust button presentation.
- Added functionality to refresh the workspace list immediately after
creating a new workspace.
- Implemented improved error handling by checking for `workspace.id`
before rendering workspace items.
- Added a new state variable to manage the visibility of the import
application modal.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADS Components All issues related ADS components ADS Visual Styles All issues related to ADS visual styles Design System Product Appsmith design system related issues IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: ADS Button min width
2 participants