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

Adjusted the view change button position #9172

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

nithish1018
Copy link
Contributor

@nithish1018 nithish1018 commented Nov 21, 2024

Proposed Changes

Screen Recording:

Recording.2024-11-21.122035.mp4

image

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced internationalization support by updating the resource title to be translatable.
    • Reintroduced the Advanced Filter Button in both Resource and Shifting List views for improved filtering options.
  • Bug Fixes

    • Restored functionality of the Advanced Filter Button, ensuring users can access advanced filtering options.
  • Style

    • Minor adjustments made to JSX formatting for better readability.
    • Updated the Sort Dropdown's stacking context to improve visibility.

@nithish1018 nithish1018 requested a review from a team as a code owner November 21, 2024 06:51
Copy link
Contributor

coderabbitai bot commented Nov 21, 2024

Walkthrough

The changes in this pull request involve modifications to the ListView components in both ResourceList.tsx and ShiftingList.tsx. Key updates include the enhancement of internationalization support for the title in the Resource List and the reinstatement of the AdvancedFilterButton in both components. The overall structure, logic, and functionality of the components remain unchanged, ensuring consistent data handling and user experience.

Changes

File Path Change Summary
src/components/Resource/ResourceList.tsx Updated title prop to use translatable string; reinstated AdvancedFilterButton.
src/components/Shifting/ShiftingList.tsx Reintroduced AdvancedFilterButton in JSX; minor formatting adjustments.
src/components/Common/SortDropdown.tsx Updated containerClassName property of DropdownMenu to include z-20.

Assessment against linked issues

Objective Addressed Explanation
Button position consistency across views (#9170)
Search icon overlay issue in dropdown (#9174) No changes made to address the overlay issue.

Possibly related PRs

Suggested labels

tested

Suggested reviewers

  • rithviknishad
  • shivankacker

🐇 In the meadow, where the bunnies play,
A button's place, now here to stay.
With titles that dance in many a tongue,
Our filters are back, let the joy be sung!
Hopping along, we fix and we cheer,
Consistent views, bring the friends near! 🐰✨


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.

Copy link

netlify bot commented Nov 21, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 5cf52f4
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/674093d295d7cc000831c4ee
😎 Deploy Preview https://deploy-preview-9172--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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 (2)
src/components/Resource/ResourceList.tsx (1)

221-226: Consider adding a data-testid attribute

To ensure the button positioning can be verified through automated testing, consider adding data-testid attributes to the button container and buttons.

-          <div className="mt-2 flex w-full flex-col gap-2 lg:w-fit lg:flex-row lg:gap-4">
+          <div className="mt-2 flex w-full flex-col gap-2 lg:w-fit lg:flex-row lg:gap-4" data-testid="view-toggle-container">
-            <ButtonV2 className="py-[11px]" onClick={onBoardViewBtnClick}>
+            <ButtonV2 className="py-[11px]" onClick={onBoardViewBtnClick} data-testid="board-view-button">
               <CareIcon icon="l-list-ul" className="rotate-90" />
               {t("board_view")}
             </ButtonV2>
-            <AdvancedFilterButton
+            <AdvancedFilterButton
+              data-testid="advanced-filter-button"
               onClick={() => advancedFilter.setShow(true)}
             />
           </div>
src/components/Shifting/ShiftingList.tsx (1)

282-287: Review button container implementation

The flex container implementation with responsive classes (flex-collg:flex-row) and width control (w-fulllg:w-fit) provides consistent button positioning across different screen sizes. The gap utilities (gap-2lg:gap-4) ensure proper spacing in both layouts.

Consider extracting this button container pattern into a reusable component to ensure consistent positioning across both Shifting and Resource pages.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 10369c5 and 3ecad4f.

📒 Files selected for processing (2)
  • src/components/Resource/ResourceList.tsx (2 hunks)
  • src/components/Shifting/ShiftingList.tsx (1 hunks)
🔇 Additional comments (4)
src/components/Resource/ResourceList.tsx (2)

192-192: LGTM: Good i18n practice!

Using the translation function for the title ensures consistent internationalization support.


223-225: Verify button positioning consistency

The AdvancedFilterButton placement within the flex container looks good and should maintain consistent positioning. However, let's verify that this implementation matches the ShiftingList component to ensure unified behavior across both pages.

✅ Verification successful

Let me verify the button positioning by checking the actual button implementations and their container structures.


Let me try one more search to get the ShiftingList button implementation:


Button positioning is consistent across components

The AdvancedFilterButton implementation in ResourceList matches the ShiftingList component exactly:

  • Both use the same flex container with identical classes: mt-2 flex w-full flex-col gap-2 lg:w-fit lg:flex-row lg:gap-4
  • Both have the same button arrangement with ButtonV2 and AdvancedFilterButton
  • Both maintain consistent padding with py-[11px] on the ButtonV2 component
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent button container implementation across components
# Check if the same flex container classes are used in ShiftingList.tsx

rg -A 2 -B 2 "mt-2 flex w-full flex-col gap-2 lg:w-fit lg:flex-row lg:gap-4" src/components/Shifting/

Length of output: 474


Script:

#!/bin/bash
# Check the AdvancedFilterButton implementation in ResourceList
rg -A 5 -B 5 "AdvancedFilterButton" src/components/Resource/ResourceList.tsx

# Check the button implementation in ShiftingList
rg -A 5 -B 5 "ButtonV2.*className=\"py-\[11px\]\"" src/components/Shifting/ShiftingList.tsx

Length of output: 1071


Script:

#!/bin/bash
# Search for the flex container and surrounding button implementation in ShiftingList
rg -A 10 -B 10 "mt-2 flex w-full flex-col gap-2 lg:w-fit lg:flex-row lg:gap-4" src/components/Shifting/ShiftingList.tsx

Length of output: 948

src/components/Shifting/ShiftingList.tsx (2)

284-286: Ensure consistent button positioning across views

The AdvancedFilterButton placement looks good, but verify that this implementation matches the Resource page to maintain consistency.

Let's check the Resource page implementation:

✅ Verification successful

Button positioning implementation matches across views

The verification confirms that both Resource and Shifting pages implement identical button container structures:

  • Same flex container classes: flex w-full flex-col gap-2 lg:w-fit lg:flex-row lg:gap-4
  • Consistent button padding: py-[11px]
  • Identical AdvancedFilterButton placement after the view toggle button
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Compare button implementations between Shifting and Resource pages
# Check for similar button container structure in ResourceList.tsx
rg -A 5 "flex.*w-full.*flex-col.*gap-2.*lg:w-fit.*lg:flex-row" src/components/Resource/

Length of output: 1211


282-283: Verify view transition behavior

The BoardView button implementation preserves query parameters during view transition, which is essential for maintaining filter state. The padding class py-[11px] ensures consistent button height.

Let's verify the view transition implementation in both components:

✅ Verification successful

View transition behavior is correctly implemented

The verification confirms consistent view transition behavior across both Shifting and Resource components:

  • Both ShiftingList and ShiftingBoard correctly preserve query parameters (qParams) during navigation
  • Navigation paths are correctly implemented as pairs:
    • /shifting/list ↔️ /shifting/board
    • /resource/list ↔️ /resource/board
  • Icon and text labels are appropriately used for view switching buttons
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check view transition implementations
# Look for navigation patterns between List and Board views
rg -A 3 "navigate\(.*/(shifting|resource)/(list|board)" src/components/

Length of output: 1396

Copy link
Contributor

@Jacobjeevan Jacobjeevan left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants