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: Organization Dashboard Page Layout Fixes #3794

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

Conversation

PratapRathi
Copy link
Contributor

@PratapRathi PratapRathi commented Mar 4, 2025

What kind of change does this PR introduce?
This PR will fix the Organization Dashboard Page Layout, fixes import of src/style/app-fixed.module.css.
Also, View All buttons are now showing toast notification.

Issue Number:
Fixes #3777

Snapshots/Videos:
Screenshot 2025-03-04 at 22 52 09

If relevant, did you update the documentation?
N/A

Summary
Does this PR introduce a breaking change?
No

Checklist

CodeRabbit AI Review

  • I have reviewed and addressed all critical issues flagged by CodeRabbit AI
  • I have implemented or provided justification for each non-critical suggestion
  • I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

Test Coverage

  • I have written tests for all new changes/features
  • I have verified that test coverage meets or exceeds 95%
  • I have run the test suite locally and all tests pass

Other information
N/A

Have you read the contributing guide?
Yes

Summary by CodeRabbit

  • Documentation
    • Updated component and interface documentation for improved reference accuracy.
  • New Features
    • Enhanced the organization dashboard buttons to now display a “Coming soon!” notification when clicked.
    • Added navigation capabilities to the buttons for viewing events and posts.
    • Introduced new translation entries for "Coming soon!" in multiple languages.
    • Added a new translation entry for "Tags" in multiple languages.
  • Style
    • Refined styling across various UI components, including profile dropdowns and card elements, for improved visual consistency and layout.

Copy link
Contributor

coderabbitai bot commented Mar 4, 2025

Walkthrough

This pull request updates documentation references for the LeftDrawerOrg and OrganizationScreen components by decrementing line numbers, adjusts a CSS import in the ProfileDropdown component, adds toast notifications on button clicks within the OrganizationDashboard, and modifies several CSS class properties including adding a new dropdown toggle style. No functional logic has been altered.

Changes

File Path(s) Change Summary
docs/.../LeftDrawerOrg/functions/default.md
docs/.../LeftDrawerOrg/interfaces/InterfaceLeftDrawerProps.md
Updated documentation line numbers for the default function and InterfaceLeftDrawerProps properties in LeftDrawerOrg.tsx.
docs/.../OrganizationScreen/functions/default.md Updated the documentation reference of the default function for OrganizationScreen.tsx (line number changed from 34 to 33).
src/components/ProfileDropdown/ProfileDropdown.tsx Updated the import statement from app.module.css to app-fixed.module.css.
src/screens/OrganizationDashboard/OrganizationDashboard.tsx Added onClick event handlers to three buttons to trigger a toast notification with the message "Coming soon!" on click.
src/style/app-fixed.module.css Modified several classes: adjusted alignment, spacing, image dimensions, text size, container width, border radii, and added a new .dropdownToggle class with hover styles.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Button
    participant Toast

    User->>Button: Click event on button (e.g., view all events)
    Button->>Toast: Invoke toast.success("Coming soon!")
    Toast-->>User: Display "Coming soon!" notification
Loading

Possibly related PRs

  • Refactor CSS for LeftDrawerOrg #3131: The changes in the main PR involve updating documentation references for the default function and InterfaceLeftDrawerProps interface in the LeftDrawerOrg component, which are related to modifications in the retrieved PR that also affect the LeftDrawerOrg component, specifically the function signature and CSS import changes in `LeftDrawerOrg.tsx.
  • fix(leftDrawer): layout and css figma changes #3782: The changes in the main PR are related to the updates in the LeftDrawerOrg component's documentation, which reflect modifications in the source file that are also addressed in the retrieved PR, specifically regarding the hideDrawer functionality and button implementations.

Suggested labels

ignore-sensitive-files-pr

Suggested reviewers

  • palisadoes

Poem

I'm a little rabbit with code in my heart,
Hopping through changes with a joyful start.
Docs updated with numbers, precise and neat,
Buttons now sing with toast on each beat.
CSS styles dance with a fresh new tone,
Cheers from this rabbit – in code, I'm never alone!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e78c9c and 05ec473.

📒 Files selected for processing (5)
  • public/locales/en/common.json (1 hunks)
  • public/locales/fr/common.json (1 hunks)
  • public/locales/hi/common.json (1 hunks)
  • public/locales/sp/common.json (1 hunks)
  • public/locales/zh/common.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Test Application
  • GitHub Check: Check Python Code Style
  • GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (5)
public/locales/sp/common.json (1)

57-57: Approval: Correct Spanish translation for "Tags".
The addition of "Tags": "etiquetas" is appropriate and consistent with similar updates in other localization files.

public/locales/hi/common.json (1)

57-57: Approval: Correct Hindi translation for "Tags".
The entry "Tags": "टैग" is succinct and clear. Consider a quick review with a native speaker if further contextual adjustments are needed.

public/locales/fr/common.json (1)

57-57: Approval: Correct French translation for "Tags".
The new key "Tags": "étiquettes" correctly translates "Tags" into French. Ensure that the lowercase usage matches the UI style guidelines.

public/locales/en/common.json (1)

57-57: Approval: Appropriate English addition for "Tags".
The addition of "Tags": "Tags" maintains consistency with the other localization files, and the key reflects the unchanged original terminology.

public/locales/zh/common.json (1)

57-57: Approval: Correct Chinese translation for "Tags".
The new entry "Tags": "标签" correctly localizes the term for Chinese and aligns with similar updates in other languages.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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 generate docstrings to generate docstrings for this 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.

Copy link

github-actions bot commented Mar 4, 2025

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

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

🧹 Nitpick comments (4)
src/style/app-fixed.module.css (3)

3437-3441: .cardItem Layout Adjustments Review
The changes correctly update the layout by setting:

  • align-items: center; (note: with row direction this vertically centers items; please update the inline comment if “left alignment” was not the intent)
  • Reduced padding to 0.75rem and gap to 1.5rem, which aligns with the new design requirements.

Suggestion: Update or remove the misleading inline comment ("Ensures left alignment") to avoid confusion since vertical centering is being applied.


3449-3454: .CardItemImage Modifications Review
The changes lower the image height from a larger value to 3.5rem and replace the fixed width with min-width: 3.5rem, improving responsiveness.
However, the declaration border: 3.25rem; is unusual since a proper border needs a style and color. Please confirm if this value is intentional or if it requires a full border shorthand (e.g. border: 3.25rem solid currentColor;).


4144-4165: New .dropdownToggle Class Implementation Review
A new class .dropdownToggle has been added along with hover and pseudo-element styles. This block establishes:

  • A flex container with zero bottom margin;
  • A background image sourced from /public/images/svg/angleDown.svg with proper repeat and positioning;
  • A forced background color via !important;
  • Adjusted border properties (no left border and rounded top-right and bottom-right corners), and a defined text color.
    On hover, the element applies a border while retaining no left border, and the pseudo-element adjustments remove top and bottom borders.

Points to consider:

  • Asset Path: Verify that the absolute path /public/images/svg/angleDown.svg is correct in the deployed environment. If assets are handled via a bundler, a relative path might be preferable.
  • Use of !important: Ensure that using !important for background-color and hover border styles is necessary; overuse can reduce maintainability.
src/screens/OrganizationDashboard/OrganizationDashboard.tsx (1)

488-490: Fix typo in the test ID for the leaderboard button.

There's a typo in the test ID for the leaderboard button: viewAllLeadeboard should be viewAllLeaderboard. This might cause issues with test selection or future maintenance.

-                  data-testid="viewAllLeadeboard"
+                  data-testid="viewAllLeaderboard"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8709ef9 and a8c2773.

📒 Files selected for processing (6)
  • docs/docs/auto-docs/components/LeftDrawerOrg/LeftDrawerOrg/functions/default.md (1 hunks)
  • docs/docs/auto-docs/components/LeftDrawerOrg/LeftDrawerOrg/interfaces/InterfaceLeftDrawerProps.md (1 hunks)
  • docs/docs/auto-docs/components/OrganizationScreen/OrganizationScreen/functions/default.md (1 hunks)
  • src/components/ProfileDropdown/ProfileDropdown.tsx (1 hunks)
  • src/screens/OrganizationDashboard/OrganizationDashboard.tsx (3 hunks)
  • src/style/app-fixed.module.css (4 hunks)
✅ Files skipped from review due to trivial changes (4)
  • src/components/ProfileDropdown/ProfileDropdown.tsx
  • docs/docs/auto-docs/components/OrganizationScreen/OrganizationScreen/functions/default.md
  • docs/docs/auto-docs/components/LeftDrawerOrg/LeftDrawerOrg/functions/default.md
  • docs/docs/auto-docs/components/LeftDrawerOrg/LeftDrawerOrg/interfaces/InterfaceLeftDrawerProps.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application
🔇 Additional comments (5)
src/style/app-fixed.module.css (1)

3456-3459: .cardItemtitle Font Size Update
The font size has been reduced to 15px, which matches the design specification outlined in the PR objectives.

src/screens/OrganizationDashboard/OrganizationDashboard.tsx (4)

340-347: Added user feedback for "View All Events" button - good addition.

Adding the toast notification provides immediate feedback to users when clicking the button that doesn't navigate anywhere yet. This matches the PR objective of ensuring "View All" buttons display toast notifications.


388-390: Appropriate replacement of commented navigation with toast notification.

You've replaced a commented-out navigation action with a toast notification that provides immediate user feedback. This is consistent with the handling of other "View All" buttons.


438-446: Ensure consistent implementation across all "View All" buttons.

I notice this button already had a toast notification implementation before the changes. Good to see that your new implementations follow the same pattern, maintaining consistency throughout the UI.


27-27: Good import addition for the toast functionality.

The import of toast from 'react-toastify' is correctly placed with the other imports, following the project's import organization pattern.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 4, 2025
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.58%. Comparing base (48804e1) to head (05ec473).
Report is 2 commits behind head on develop-postgres.

Additional details and impacted files
@@                 Coverage Diff                  @@
##           develop-postgres    #3794      +/-   ##
====================================================
+ Coverage             86.57%   86.58%   +0.01%     
====================================================
  Files                   373      373              
  Lines                  9226     9229       +3     
  Branches               1949     1949              
====================================================
+ Hits                   7987     7991       +4     
  Misses                  867      867              
+ Partials                372      371       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PratapRathi
Copy link
Contributor Author

I am writing the test for the newly added onClick function.
inside onClick should I use actual routing logic or just toast notification for now ?

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

🧹 Nitpick comments (2)
src/screens/OrganizationDashboard/OrganizationDashboard.spec.tsx (2)

118-120: Typo in test ID for leaderboard element

There's a typo in the test ID: 'viewAllLeadeboard' should be 'viewAllLeaderboard'.

-    const viewLeaderBtn = screen.getByTestId('viewAllLeadeboard');
+    const viewLeaderBtn = screen.getByTestId('viewAllLeaderboard');

105-129: Consider separating button tests for better maintainability

Currently, all button click tests are combined in a single test case. Consider splitting these into separate test cases for better readability and maintainability. This would make it easier to identify which specific functionality is failing if a test fails.

   it('shows success toast when clicking on membership requests view button', async () => {
     renderWithProviders({ mocks: MOCKS });
 
     await waitFor(() => {
       expect(
         screen.getByTestId('viewAllMembershipRequests'),
       ).toBeInTheDocument();
     });
 
     const viewRequestsBtn = screen.getByTestId('viewAllMembershipRequests');
     fireEvent.click(viewRequestsBtn);
     expect(toast.success).toHaveBeenCalledWith('Coming soon!');
+  });
+
+  it('shows success toast when clicking on leaderboard view button', async () => {
+    renderWithProviders({ mocks: MOCKS });
+
+    await waitFor(() => {
+      expect(screen.getByTestId('viewAllLeaderboard')).toBeInTheDocument();
+    });
 
-    const viewLeaderBtn = screen.getByTestId('viewAllLeadeboard');
+    const viewLeaderBtn = screen.getByTestId('viewAllLeaderboard');
     fireEvent.click(viewLeaderBtn);
     expect(toast.success).toHaveBeenCalledWith('Coming soon!');
+  });
+
+  it('navigates to events page when clicking view all events button', async () => {
+    renderWithProviders({ mocks: MOCKS });
+
+    await waitFor(() => {
+      expect(screen.getByTestId('viewAllEvents')).toBeInTheDocument();
+    });
 
     const viewEventsBtn = screen.getByTestId('viewAllEvents');
     fireEvent.click(viewEventsBtn);
     expect(mockedNavigate).toHaveBeenCalledWith('/orgevents/orgId');
+  });
+
+  it('navigates to posts page when clicking view all posts button', async () => {
+    renderWithProviders({ mocks: MOCKS });
+
+    await waitFor(() => {
+      expect(screen.getByTestId('viewAllPosts')).toBeInTheDocument();
+    });
 
     const viewPostBtn = screen.getByTestId('viewAllPosts');
     fireEvent.click(viewPostBtn);
     expect(mockedNavigate).toHaveBeenCalledWith('/orgpost/orgId');
   });
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8c2773 and 930855a.

📒 Files selected for processing (2)
  • src/screens/OrganizationDashboard/OrganizationDashboard.spec.tsx (1 hunks)
  • src/screens/OrganizationDashboard/OrganizationDashboard.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/screens/OrganizationDashboard/OrganizationDashboard.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application
🔇 Additional comments (5)
src/screens/OrganizationDashboard/OrganizationDashboard.spec.tsx (5)

116-116: Testing toast notification for membership requests view button - LGTM!

This line correctly verifies that clicking the membership requests view button shows a success toast with the message "Coming soon!".


122-125: Testing navigation for events view button - LGTM!

This test correctly verifies the navigation to the events page when clicking the "View All Events" button.


126-129: Testing navigation for posts view button - LGTM!

This test correctly verifies the navigation to the posts page when clicking the "View All Posts" button.


122-125:

✅ Verification successful

Verify consistency with the companion component file

Make sure that the navigation to '/orgevents/orgId' in the test matches the actual implementation in the OrganizationDashboard.tsx component.


🏁 Script executed:

#!/bin/bash
# Description: Look for the implementation of the viewAllEvents button in the OrganizationDashboard component
# to verify that it navigates to the correct path

# Find the event handler for viewAllEvents button
rg -A 3 -B 3 "data-testid=\"viewAllEvents\"" src/screens/OrganizationDashboard/OrganizationDashboard.tsx

# Also look for the onClick handler that might be navigating to orgevents path
rg -A 3 -B 3 "/orgevents" src/screens/OrganizationDashboard/OrganizationDashboard.tsx

Length of output: 723


Navigation Path Verified

The test expectation for navigating to /orgevents/orgId is consistent with the implementation in the OrganizationDashboard.tsx component. The component constructs the navigation path using eventsLink = /orgevents/${orgId}, which, when orgIdis set to"orgId", produces the expected /orgevents/orgId`.

No changes are required.


126-128:

✅ Verification successful

Verify consistency with the companion component file

Make sure that the navigation to '/orgpost/orgId' in the test matches the actual implementation in the OrganizationDashboard.tsx component.


🏁 Script executed:

#!/bin/bash
# Description: Look for the implementation of the viewAllPosts button in the OrganizationDashboard component
# to verify that it navigates to the correct path

# Find the event handler for viewAllPosts button
rg -A 3 -B 3 "data-testid=\"viewAllPosts\"" src/screens/OrganizationDashboard/OrganizationDashboard.tsx

# Also look for the onClick handler that might be navigating to orgpost path
rg -A 3 -B 3 "/orgpost" src/screens/OrganizationDashboard/OrganizationDashboard.tsx

Length of output: 716


Consistency Check: Navigation Route Verified

The implementation in OrganizationDashboard.tsx constructs the navigation path as:

const postsLink = `/orgpost/${orgId}`;

and the button's click handler correctly calls:

onClick={(): void => navigate(postsLink)}

The test in OrganizationDashboard.spec.tsx verifies that clicking the button triggers navigation to '/orgpost/orgId'. This is consistent—as long as the testing context assigns orgId the literal "orgId" value, both the component and the test are aligned.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 5, 2025
Copy link
Contributor

@palisadoes palisadoes left a comment

Choose a reason for hiding this comment

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

  1. Please add translations for the messages public/locales
  2. Add a video showing that the messages change when the language changes
  3. Add the appropriate tests

@PratapRathi
Copy link
Contributor Author

@palisadoes Translations added for the notification. Also test is added to check notification and routing.

Screen.Recording.mp4

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 5, 2025
@PratapRathi PratapRathi requested a review from palisadoes March 5, 2025 15:20
@PratapRathi
Copy link
Contributor Author

Patch coverage is 100%, to make the file test coverage to 100% another issue is raised.
refer #3653

@palisadoes
Copy link
Contributor

Please add functioning translations for the Tags menu item.

image

@PratapRathi
Copy link
Contributor Author

@palisadoes Translations added for the word "Tags"

Screenshot 2025-03-05 at 23 22 31

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

Successfully merging this pull request may close these issues.

2 participants