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: configuration footer fix #1088

Merged
merged 1 commit into from
Nov 27, 2024
Merged

fix: configuration footer fix #1088

merged 1 commit into from
Nov 27, 2024

Conversation

DhaaraniCIT
Copy link
Contributor

@DhaaraniCIT DhaaraniCIT commented Nov 27, 2024

Description

fix: configuration footer fix

Clickup

Please add link here

Summary by CodeRabbit

  • New Features

    • Enhanced button functionality with conditional SVG icon display based on the state of ctaText.
  • Bug Fixes

    • Improved responsiveness of the user interface to different button states.

Copy link
Contributor

coderabbitai bot commented Nov 27, 2024

Walkthrough

The changes in this pull request focus on the configuration-step-footer.component.html file, specifically modifying the conditions for rendering an SVG icon within a button. The new logic includes an additional check to ensure that the ctaText is not equal to 'Save', alongside the existing checks for brandingFeatureConfig.isIconsInsideButtonAllowed and AppName. This adjustment alters the control flow related to icon visibility based on the button's state.

Changes

File Path Change Summary
src/app/shared/components/configuration/configuration-step-footer/configuration-step-footer.component.html Modified conditions for rendering <app-svg-icon> to include a check for ctaText not being 'Save'.

Possibly related PRs

Suggested labels

size/XS

Suggested reviewers

  • ashwin1111

🐇 In the footer where buttons gleam,
Icons dance in a new scheme.
If 'Save' is not what you say,
The SVG will shy away.
Conditions shift, the flow is bright,
A user’s choice brings pure delight! 🌟


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.

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.

@github-actions github-actions bot added the size/XS Extra Small PR label Nov 27, 2024
Copy link

PR description must contain a link to a ClickUp (case-insensitive)

Copy link

Unit Test Coverage % values
Statements 34.81% ( 4246 / 12195 )
Branches 28.79% ( 1232 / 4279 )
Functions 27.44% ( 938 / 3418 )
Lines 34.96% ( 4176 / 11945 )

Copy link

PR description must contain a link to a ClickUp (case-insensitive)

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 (1)
src/app/shared/components/configuration/configuration-step-footer/configuration-step-footer.component.html (1)

Line range hint 18-30: Consider optimizing button state handling.

The template could be simplified to reduce duplication in button states. Consider extracting the common button properties and using a single button with dynamic content.

Here's a suggested refactor:

-        <button *ngIf="ctaText !== 'Saving' && ctaText !== 'Syncing'" pButton type="button" class="p-button-raised" (click)="saveChanges()" [disabled]="isButtonDisabled">
-            <span *ngIf="brandingConfig.brandId === 'co'">
-                {{ ctaText | sentenceCase}}
-            </span>
-            <span *ngIf="brandingConfig.brandId === 'fyle'">
-                {{ ctaText }}
-            </span>
-            <app-svg-icon *ngIf="brandingFeatureConfig.isIconsInsideButtonAllowed && ctaText !== 'Save' && AppName !== appName.QBD_DIRECT" [svgSource]="'arrow-tail-right-medium'" [width]="'18px'" [height]="'18px'" [styleClasses]="'tw-text-white tw-pl-10-px tw-pt-2-px tw-text-12-px'"></app-svg-icon>
-        </button>
-        <button *ngIf="ctaText === 'Saving' || ctaText === 'Syncing'" pButton type="button" class="p-button-raised" disabled>
-            {{ ctaText }}
-            <div *ngIf="brandingFeatureConfig.isIconsInsideButtonAllowed" class="tw-w-5 tw-h-5 tw-ml-2 tw-border-2 tw-border-b-transparent tw-border-r-transparent tw-border-l-transparent tw-border-t-border-tertiary tw-rounded-full tw-animate-spin"></div>
-        </button>
+        <button 
+            pButton 
+            type="button" 
+            class="p-button-raised"
+            [disabled]="isButtonDisabled || ctaText === 'Saving' || ctaText === 'Syncing'"
+            (click)="saveChanges()">
+            <span [ngSwitch]="true">
+                <ng-container *ngSwitchCase="brandingConfig.brandId === 'co'">
+                    {{ ctaText | sentenceCase }}
+                </ng-container>
+                <ng-container *ngSwitchCase="brandingConfig.brandId === 'fyle'">
+                    {{ ctaText }}
+                </ng-container>
+            </span>
+            <ng-container [ngSwitch]="true">
+                <app-svg-icon 
+                    *ngSwitchCase="brandingFeatureConfig.isIconsInsideButtonAllowed && ctaText !== 'Save' && AppName !== appName.QBD_DIRECT && ctaText !== 'Saving' && ctaText !== 'Syncing'"
+                    [svgSource]="'arrow-tail-right-medium'"
+                    [width]="'18px'"
+                    [height]="'18px'"
+                    [styleClasses]="'tw-text-white tw-pl-10-px tw-pt-2-px tw-text-12-px'">
+                </app-svg-icon>
+                <div 
+                    *ngSwitchCase="brandingFeatureConfig.isIconsInsideButtonAllowed && (ctaText === 'Saving' || ctaText === 'Syncing')"
+                    class="tw-w-5 tw-h-5 tw-ml-2 tw-border-2 tw-border-b-transparent tw-border-r-transparent tw-border-l-transparent tw-border-t-border-tertiary tw-rounded-full tw-animate-spin">
+                </div>
+            </ng-container>
+        </button>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ec1144a and bb8470c.

📒 Files selected for processing (1)
  • src/app/shared/components/configuration/configuration-step-footer/configuration-step-footer.component.html (1 hunks)
🔇 Additional comments (1)
src/app/shared/components/configuration/configuration-step-footer/configuration-step-footer.component.html (1)

24-24: LGTM! The icon visibility logic is improved.

The additional condition ctaText !== 'Save' makes sense from a UX perspective, as 'Save' actions typically don't need directional arrows. This aligns well with the existing conditions for branding and app name checks.

Let's verify the consistency of button states:

✅ Verification successful

The icon visibility logic is correctly implemented and consistent with the component's design

The verification confirms that:

  • The component properly handles different button states through the ctaText input, including 'Save and Continue', 'Saving', and 'Save'
  • The Storybook stories demonstrate the expected button states and configurations
  • The icon visibility condition ctaText !== 'Save' aligns with the component's usage patterns and states
  • The implementation is consistent with the branding configuration checks
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for all possible ctaText values and button states
# to ensure consistent handling across the codebase

# Search for places where ctaText is set
rg -t typescript "ctaText.*=" --glob "!dist/*" -A 2

# Search for other configuration footer instances
fd -e html -e ts "configuration.*footer" --exec rg -l "ctaText|p-button"

Length of output: 428


Script:

#!/bin/bash
# Let's check the component and story files to verify ctaText usage
cat ./src/app/shared/components/configuration/configuration-step-footer/configuration-step-footer.component.ts
echo "---"
cat ./src/stories/ConfigurationStepFooter.stories.ts

Length of output: 2657

@DhaaraniCIT DhaaraniCIT merged commit ebd88de into master Nov 27, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS Extra Small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants