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

Fixes: #2071 - Misplaced Screen Title & Fix Layout Structure #2356

Conversation

VanshikaSabharwal
Copy link
Contributor

@VanshikaSabharwal VanshikaSabharwal commented Oct 26, 2024

What kind of change does this PR introduce?

bugfix

Issue Number:

Fixes #2071

Did you add tests for your changes?
No

Snapshots/Videos:

image
Screenshot 2024-10-25 205443
Screenshot 2024-10-25 210519
Screenshot 2024-10-25 210748

Summary

Does this PR introduce a breaking change?
No

Other information

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • New Features
    • Enhanced GraphQL schema for better readability and formatting.
  • Bug Fixes
    • Corrected title rendering logic in the UserScreen component.
    • Updated test cases for clarity and correctness in the UserScreen, Chat, and OrganizationCard components.
  • Refactor
    • Streamlined type definitions and data handling in the Posts, CreateDirectChat, and CreateGroupChat components.
  • Chores
    • Updated development dependencies in the project configuration.

Copy link
Contributor

coderabbitai bot commented Oct 26, 2024

Walkthrough

The pull request includes updates to the package.json file, primarily adjusting the devDependencies and resolutions for specific packages. Additionally, several TypeScript files have been modified to reflect changes in data structures and types, particularly in the Posts.tsx, UserScreen.tsx, and various test files. Changes include the removal of certain interfaces, updates to type definitions, and adjustments to test cases for clarity and correctness. The GraphQL schema has also been reformatted for better readability, with some field type changes.

Changes

File Change Summary
package.json Downgraded jest-preview from ^0.3.1 to ^0.2.3; updated resolutions for @types/react and @types/react-dom to 17.0.2.
src/screens/UserPortal/Posts/Posts.tsx Removed InterfaceAdContent and AdvertisementsConnection; updated InterfacePostComments to replace _id with id and modified array creation logic.
src/screens/UserPortal/UserScreen/UserScreen.tsx Changed title rendering logic to always display title using t('title').
src/screens/UserPortal/UserScreen/UserScreen.test.tsx Updated title assertions and clarified test descriptions for UserScreen component.
src/components/UserPortal/CreateDirectChat/CreateDirectChat.test.tsx Removed useTranslation hook import; tests focus on rendering and interactions.
src/components/UserPortal/CreateDirectChat/CreateDirectChat.tsx Updated chatsListRefetch method signature for type constraints; commented out useTranslation hook.
src/components/UserPortal/CreateGroupChat/CreateGroupChat.tsx Updated chatsListRefetch return type for specificity; commented out useTranslation hook.
src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx Consolidated import statements; maintained test coverage for rendering and functionality.
src/components/UserPortal/UserSidebar/UserSidebar.test.tsx Removed waitFor import; maintained core functionality and coverage of tests.
src/screens/UserPortal/Chat/Chat.test.tsx Renamed test cases for clarity; maintained structure and mock data usage.
schema.graphql Reformatted method signatures for readability; changed imageUrl and videoUrl from URL to String type.

Assessment against linked issues

Objective Addressed Explanation
Move screen titles to parent outlet container (#2071) The changes do not address the issue of misplaced screen titles as described.

Possibly related issues

Possibly related PRs

Suggested labels

no-pr-activity

Suggested reviewers

  • palisadoes
  • pranshugupta54
  • DMills27

Poem

🐰 In the code where rabbits play,
Changes hop in a bright array.
Titles shift and types align,
Tests now clearer, all will shine.
With each line, we build and grow,
In our burrow, progress flows! 🌼


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6894029 and b942e30.

📒 Files selected for processing (2)
  • schema.graphql (5 hunks)
  • src/screens/UserPortal/UserScreen/UserScreen.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • schema.graphql
  • src/screens/UserPortal/UserScreen/UserScreen.tsx

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.

Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

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: 3

🧹 Outside diff range and nitpick comments (2)
src/screens/UserPortal/UserScreen/UserScreen.tsx (1)

133-134: Remove redundant comments

The before/after comments don't provide any value and should be removed for cleaner code.

package.json (1)

49-49: Document the reason for the dependency update.

Please add a note in the PR description explaining why this react-icons update was necessary for the post title fix. This will help with future maintenance and understanding of the changes.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6393648 and b4a147c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • package.json (1 hunks)
  • src/screens/UserPortal/Posts/Posts.tsx (2 hunks)
  • src/screens/UserPortal/UserScreen/UserScreen.tsx (1 hunks)
🔇 Additional comments (3)
package.json (1)

49-49: Verify if this dependency update is required.

The update of react-icons from ^5.2.1 to ^5.3.0 appears to be a safe minor version bump. However, since the PR's main objective is to fix the misplaced post title issue, please verify if this update is necessary for the layout changes.

src/screens/UserPortal/Posts/Posts.tsx (2)

211-215: LGTM! Improved mapping logic for likes.

The change to using map instead of mutation-based approach is a good improvement for readability and maintainability.


Line range hint 1-400: Verify title removal aligns with parent container implementation.

The removal of the screen title from this component aligns with the PR objective of moving titles to the Parent Outlet Container. However, we should verify that the parent container properly displays the title for this route.

✅ Verification successful

Title handling is properly implemented in the parent container

The title removal from Posts.tsx is correct as the parent container (UserScreen.tsx) already handles the title display. The code shows:

  1. UserScreen.tsx maps routes to title keys and renders the title in its layout:
const titleKey: string | undefined = map[location.pathname.split('/')[2]];
// ...
<h1>{titleKey !== 'home' ? t('title') : 'Posts'}</h1>
  1. The title specifically handles the 'home' route (Posts screen) by displaying "Posts" and other routes by using translated titles.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the parent container implementation
rg -l "Parent.*Outlet.*Container" --type typescript

Length of output: 88


Script:

#!/bin/bash
# Search for files containing "Outlet" component usage
rg -l "Outlet"

# Search for layout or parent container components
rg -l "Layout|Container" --type ts --type tsx

Length of output: 425


Script:

#!/bin/bash
# Check the UserScreen component since it's in the same directory hierarchy
cat src/screens/UserPortal/UserScreen/UserScreen.tsx

# Check SecuredRouteForUser since it's in the UserPortal context
cat src/components/UserPortal/SecuredRouteForUser/SecuredRouteForUser.tsx

Length of output: 5544

src/screens/UserPortal/UserScreen/UserScreen.tsx Outdated Show resolved Hide resolved
src/screens/UserPortal/Posts/Posts.tsx Outdated Show resolved Hide resolved
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: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b4a147c and f09e77d.

📒 Files selected for processing (2)
  • src/screens/UserPortal/Posts/Posts.tsx (2 hunks)
  • src/screens/UserPortal/UserScreen/UserScreen.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/screens/UserPortal/UserScreen/UserScreen.tsx
🔇 Additional comments (1)
src/screens/UserPortal/Posts/Posts.tsx (1)

Line range hint 1-400: Title changes align with PR objectives.

The removal of the screen title from this child container aligns with the PR objective of moving titles to the Parent Outlet Container.

src/screens/UserPortal/Posts/Posts.tsx Show resolved Hide resolved
src/screens/UserPortal/Posts/Posts.tsx Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 26, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 26, 2024
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.

Please fix the failing tests

@palisadoes palisadoes changed the title Solved Misplaced Post title issue #2071 Fixes: #2071 - Misplaced Screen Title & Fix Layout Structure Oct 27, 2024
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.

Please fix the failing tests

@VanshikaSabharwal
Copy link
Contributor Author

Please fix the failing tests

Okay

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.30%. Comparing base (3694271) to head (b942e30).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
src/screens/UserPortal/Posts/Posts.tsx 87.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2356      +/-   ##
===========================================
- Coverage    98.31%   98.30%   -0.02%     
===========================================
  Files          283      283              
  Lines         8207     8200       -7     
  Branches      2351     2382      +31     
===========================================
- Hits          8069     8061       -8     
- Misses         129      130       +1     
  Partials         9        9              

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

@VanshikaSabharwal
Copy link
Contributor Author

Please fix the failing tests

i have fixed the failed tests issue.

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/screens/UserPortal/UserScreen/UserScreen.test.tsx (2)

Line range hint 113-143: Consider improving the test case name for clarity.

The current test name "Testing LeftDrawer in page functionality" could be more descriptive. Consider renaming it to something like "LeftDrawer should toggle correctly based on window size and user interaction" to better reflect what's being tested.

-  test('Testing LeftDrawer in page functionality', async () => {
+  test('LeftDrawer should toggle correctly based on window size and user interaction', async () => {

Line range hint 145-161: Consider using React Router's utilities for navigation testing.

While the test correctly verifies the redirection behavior, using window.location directly can be fragile. React Router provides utilities specifically designed for testing navigation.

Consider refactoring to use React Router's testing utilities:

-  test('should be redirected to / if orgId is undefined', async () => {
+  test('should be redirected to root when orgId is undefined', async () => {
     mockID = undefined;
+    const navigate = jest.fn();
+    jest.spyOn(require('react-router-dom'), 'useNavigate').mockReturnValue(navigate);
     render(
       <MockedProvider addTypename={false} link={link}>
         <BrowserRouter>
           <Provider store={store}>
             <I18nextProvider i18n={i18nForTest}>
               <UserScreen />
             </I18nextProvider>
           </Provider>
         </BrowserRouter>
       </MockedProvider>,
     );
-    expect(window.location.pathname).toEqual('/');
+    expect(navigate).toHaveBeenCalledWith('/');
   });
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e46ca48 and aae4495.

📒 Files selected for processing (2)
  • src/GraphQl/Mutations/OrganizationMutations.ts (0 hunks)
  • src/screens/UserPortal/UserScreen/UserScreen.test.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/GraphQl/Mutations/OrganizationMutations.ts
🔇 Additional comments (3)
src/screens/UserPortal/UserScreen/UserScreen.test.tsx (3)

90-90: LGTM! Test assertion aligns with the new title rendering behavior.

The updated assertion correctly verifies that the screen title is now properly displayed as 'Posts', which aligns with the PR's objective of fixing the screen title placement and rendering.


Line range hint 92-111: LGTM! Good coverage of dynamic title rendering.

The test case effectively verifies that screen titles are correctly rendered based on different routes, which is crucial for validating the title placement fix across various screens in the User Portal.


Line range hint 1-161: Verify test coverage for all title-related edge cases.

While the current tests cover the main scenarios, consider adding test cases for:

  1. Routes that don't have a corresponding title mapping
  2. Title updates when navigating between routes
  3. Special characters or long titles in different locales

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 30, 2024
@palisadoes
Copy link
Contributor

Please fix the failing Code Coverage test.

@VanshikaSabharwal
Copy link
Contributor Author

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
src/screens/UserPortal/UserScreen/UserScreen.test.tsx (2)
📜 Review details
Configuration used: .coderabbit.yaml Review profile: CHILL

📥 Commits
📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🔇 Additional comments (3)

Did the recommended changes.

@palisadoes
Copy link
Contributor

Please fix the failing tests

@VanshikaSabharwal
Copy link
Contributor Author

Please fix the failing tests

Yes

coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 2, 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: 4

🧹 Outside diff range and nitpick comments (8)
src/components/UserPortal/CreateDirectChat/CreateDirectChat.tsx (1)

Line range hint 119-124: Enhance accessibility for modal and table elements.

Consider the following accessibility improvements:

  1. Add aria-labelledby to the modal
  2. Translate the search input placeholder
  3. Add meaningful aria-labels to table headers
- <Modal
+ <Modal
+   aria-labelledby="direct-chat-modal-title"
    data-testid="createDirectChatModal"
    show={createDirectChatModalisOpen}
    onHide={toggleCreateDirectChatModal}
    contentClassName={styles.modalContent}
  >
    <Modal.Header closeButton data-testid="createDirectChat">
-     <Modal.Title>{'Chat'}</Modal.Title>
+     <Modal.Title id="direct-chat-modal-title">{'Chat'}</Modal.Title>
    </Modal.Header>

    // ... later in the code ...
    
    <TableHead>
      <TableRow>
-       <StyledTableCell>#</StyledTableCell>
+       <StyledTableCell aria-label="Index">#</StyledTableCell>
-       <StyledTableCell align="center">{'user'}</StyledTableCell>
+       <StyledTableCell align="center" aria-label="User Details">{'user'}</StyledTableCell>
-       <StyledTableCell align="center">{'Chat'}</StyledTableCell>
+       <StyledTableCell align="center" aria-label="Chat Actions">{'Chat'}</StyledTableCell>
      </TableRow>
    </TableHead>

Also applies to: 144-150

src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx (1)

Line range hint 108-114: Consider using waitFor instead of custom wait function.

The current implementation uses a fixed delay which could make tests fragile. Consider using @testing-library/react's built-in waitFor utility for more reliable async testing:

-async function wait(ms = 100): Promise<void> {
-  await act(() => {
-    return new Promise((resolve) => {
-      setTimeout(resolve, ms);
-    });
-  });
-}

Replace wait calls with:

import { waitFor } from '@testing-library/react';

// Usage
await waitFor(() => {
  // assertions here
});

This approach is more robust as it automatically retries assertions until they pass or timeout.

src/components/UserPortal/CreateDirectChat/CreateDirectChat.test.tsx (3)

Line range hint 1-800: Improve mock data consistency and maintainability.

Consider the following improvements to the mock data:

  1. Use ISO date strings instead of numeric strings for timestamps
  2. Standardize ID formats across mock objects
  3. Extract common mock data into shared fixtures

Example refactor for timestamps:

-createdAt: '2345678903456',
+createdAt: '2024-01-15T10:30:00.000Z',

Line range hint 801-810: Consider making wait utility more flexible.

The wait utility could be more configurable by:

  1. Adding a default export
  2. Using a constant for the default delay
+const DEFAULT_WAIT_DELAY = 100;
-async function wait(ms = 100): Promise<void> {
+export default async function wait(ms = DEFAULT_WAIT_DELAY): Promise<void> {
   await act(() => {
     return new Promise((resolve) => {
       setTimeout(resolve, ms);
     });
   });
 }

Line range hint 811-940: Enhance test coverage with additional test cases.

The current test suite is missing coverage for:

  1. Error handling (network errors, validation errors)
  2. Search functionality validation
  3. Empty states and edge cases
  4. Modal content verification

Consider adding these test cases:

test('should handle network error when creating chat', async () => {
  // Mock with network error
  // Verify error handling
});

test('should validate search results', async () => {
  // Test search functionality
  // Verify filtered results
});

test('should handle empty search results', async () => {
  // Test with no matching users
  // Verify empty state
});

test('should validate modal content', async () => {
  // Verify modal title
  // Verify form elements
  // Verify button states
});
src/screens/UserPortal/Chat/Chat.test.tsx (3)

Line range hint 1548-1587: Enhance test coverage for direct chat creation.

The current test only verifies the presence of UI elements without testing the actual chat creation functionality. Consider adding test cases for:

  • Successful chat creation with form submission
  • Error handling scenarios
  • Validation of created chat data

Example test structure:

test('create new direct chat', async () => {
  // ... existing setup ...

  // Test form submission
  const nameInput = screen.getByTestId('chatName');
  fireEvent.change(nameInput, { target: { value: 'Test Chat' } });
  
  // Select a contact
  const contactSelect = screen.getByTestId('contactSelect');
  fireEvent.click(contactSelect);
  
  // Submit and verify
  fireEvent.click(submitBtn);
  expect(await screen.findByText('Chat created successfully')).toBeInTheDocument();
  
  // Verify error case
  fireEvent.click(submitBtn);
  expect(await screen.findByText('Error creating chat')).toBeInTheDocument();
});

Line range hint 1588-1631: Improve group chat creation test coverage.

The test only verifies basic UI rendering without testing group-specific functionality. Consider adding:

  • Group name validation
  • Member selection and validation
  • Group size limits
  • Error scenarios

Example implementation:

test('create new group chat', async () => {
  // ... existing setup ...

  // Test group name validation
  const nameInput = screen.getByTestId('groupName');
  fireEvent.change(nameInput, { target: { value: '' } });
  expect(screen.getByText('Group name is required')).toBeInTheDocument();

  // Test member selection
  const memberSelect = screen.getByTestId('memberSelect');
  fireEvent.click(memberSelect);
  const members = await screen.findAllByTestId('member-option');
  fireEvent.click(members[0]);
  
  // Test minimum member validation
  fireEvent.click(submitBtn);
  expect(screen.getByText('Minimum 2 members required')).toBeInTheDocument();
});

Line range hint 1632-1722: Clean up and enhance sidebar tests.

A few improvements needed for the sidebar tests:

  1. Remove screen.debug() as it's typically used for development
  2. Enhance error message for better debugging
  3. Add more test cases for different screen sizes

Apply these changes:

- screen.debug();
- throw new Error('Close menu button not found');
+ throw new Error('Close menu button not found. This might indicate a rendering issue with the sidebar component or a timing problem with the test.');

// Add comprehensive resize tests
test('Testing sidebar at various screen sizes', async () => {
  const screenSizes = [400, 820, 1024];
  for (const size of screenSizes) {
    resizeWindow(size);
    // Test sidebar behavior
  }
});
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 307c432 and 864cb77.

📒 Files selected for processing (7)
  • src/components/UserPortal/CreateDirectChat/CreateDirectChat.test.tsx (1 hunks)
  • src/components/UserPortal/CreateDirectChat/CreateDirectChat.tsx (2 hunks)
  • src/components/UserPortal/CreateGroupChat/CreateGroupChat.tsx (2 hunks)
  • src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx (1 hunks)
  • src/components/UserPortal/UserSidebar/UserSidebar.test.tsx (1 hunks)
  • src/screens/UserPortal/Chat/Chat.test.tsx (2 hunks)
  • src/screens/UserPortal/UserScreen/UserScreen.test.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/screens/UserPortal/UserScreen/UserScreen.test.tsx
🔇 Additional comments (5)
src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx (2)

2-2: LGTM! Clean import consolidation.

The consolidation of testing library imports improves code organization.


Line range hint 142-270: Consider adding layout structure tests.

Given that this PR addresses screen title placement and layout structure issues, consider adding test cases to verify:

  1. The correct positioning of components within the card
  2. The absence of unnecessary empty spaces
  3. Proper alignment with the parent container

This would help ensure the layout fixes are maintained.

src/components/UserPortal/UserSidebar/UserSidebar.test.tsx (2)

3-3: LGTM: Removed unused import.

The removal of the unused waitFor import is appropriate as the test suite successfully handles asynchronous operations using act and the custom wait function.


1-1: Consider adding tests for screen title placement.

While the UserSidebar tests are comprehensive, the PR's main objective of fixing screen title placement (moving from child containers to Parent Outlet Container) isn't covered in the test suite. Consider adding test cases to verify the correct positioning of screen titles in the appropriate test file (e.g., UserScreen.test.tsx).

Let's check if there are any existing tests for screen title placement:

Would you like help creating test cases to verify the screen title placement?

src/components/UserPortal/CreateDirectChat/CreateDirectChat.test.tsx (1)

Line range hint 811-940: Verify screen title placement changes.

The test suite should include specific tests to verify the screen title placement fixes mentioned in PR #2071.

Would you like me to help create test cases specifically for verifying the screen title placement fixes?

coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 5, 2024
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.

Make sure code rabbit approves your changes.

Please fix the failing tests. Our test code coverage system will fail if any of these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. The code does not comply with our linting check or other related formatting requirements

We do this to ensure the overall reliability of the code base is maintained. This is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

package.json Outdated Show resolved Hide resolved
@pranshugupta54
Copy link
Member

Hey @VanshikaSabharwal ,

Please include a screenshot or video of the result. This is a frontend issue, so it would be easier to address with a visual representation rather than code snippets. We can already see the modified files.

@VanshikaSabharwal
Copy link
Contributor Author

Hey @VanshikaSabharwal ,

Please include a screenshot or video of the result. This is a frontend issue, so it would be easier to address with a visual representation rather than code snippets. We can already see the modified files.

Okay I'll keep this in mind

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: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 864cb77 and 3cc7e7d.

📒 Files selected for processing (1)
  • schema.graphql (6 hunks)
🔇 Additional comments (5)
schema.graphql (5)

697-702: LGTM! Well-structured mutation definition.

The sendMessageToChat mutation is properly formatted with parameters on separate lines, improving readability. The optional replyTo parameter correctly allows for message threading.


1033-1038: LGTM! Standard connection pattern implementation.

The advertisementsConnection query follows the Relay connection specification with proper pagination parameters.


1095-1095: LGTM! Consistent query definition.

The venue query is properly typed and consistent with the Venue type definition.


1398-1398: LGTM! Required field properly typed.

The selectedOrganization field in UserInput is correctly typed as a required ID.


1544-1544: LGTM! Well-structured input type.

The chatInput type contains all necessary fields for chat creation with proper typing.

schema.graphql Outdated Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 6, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 6, 2024
@VanshikaSabharwal
Copy link
Contributor Author

Hey @pranshugupta54 . I tried to solve as much failing tests as possible but i feel stuck now. Can you or anyone help me??

@pranshugupta54
Copy link
Member

@VanshikaSabharwal, this PR is not even solving the issue at all. Please read the issue again.

@VanshikaSabharwal
Copy link
Contributor Author

VanshikaSabharwal commented Nov 6, 2024

@VanshikaSabharwal, this PR is not even solving the issue at all. Please read the issue again.

@pranshugupta54 It does fix the issue. see
Before
image
After
image

@pranshugupta54
Copy link
Member

Okay, does it work for all pages?

@@ -138,7 +138,7 @@
"jest": "^27.4.5",
"jest-localstorage-mock": "^2.4.19",
"jest-location-mock": "^2.0.0",
"jest-preview": "^0.3.1",
"jest-preview": "^0.2.3",
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this change here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not made any changes here see.
image

Copy link
Member

Choose a reason for hiding this comment

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

It's 0.3.1 on develop and your PR is making it 0.2.3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, got it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did it.
image

Copy link
Member

Choose a reason for hiding this comment

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

Revert the changes in this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted the changes and updated the package.json according to current code of develop branch.
image

Copy link
Member

Choose a reason for hiding this comment

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

This file shouldn't require any change too

Copy link
Contributor Author

@VanshikaSabharwal VanshikaSabharwal Nov 6, 2024

Choose a reason for hiding this comment

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

i was trying to pass the failed tests. so, i did changes thinking it would pass tests but still the tests failed. So i think i should revert changes
Runs Introspection on the GitHub talawa-api repo on the schema.graphql file
failed 6 hours ago in 25s

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i reverted all changes.
image

src/GraphQl/Mutations/OrganizationMutations.ts Outdated Show resolved Hide resolved
src/screens/UserPortal/UserScreen/UserScreen.tsx Outdated Show resolved Hide resolved
@VanshikaSabharwal
Copy link
Contributor Author

Okay, does it work for all pages?

Yes, It work for all pages

@varshith257
Copy link
Member

@VanshikaSabharwal Can you open a new PR? I think there are more unrelated changes of what actually needed maybe it due to eslint errors or something. It's getting hard to review this PR.

But remember eslint errors occurs only to your code that modified and can be safely mitigated for other unrelated code. The introspection workflow may fail due to other prs too.

@varshith257
Copy link
Member

Reach out on Slack if you got stuck anywhere

@varshith257 varshith257 closed this Nov 7, 2024
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.

4 participants