Skip to content

Conversation

@Ronan-Fernandes
Copy link
Contributor

@Ronan-Fernandes Ronan-Fernandes commented Nov 7, 2024

Context
After being able to create chats, we can now implement the active chat list to display these newly created chats. This story is about buidling a simple UI that lists all active chats. At this stage, the list might only show basic information (like the chat name and timestamp of creation), and it doesn’t need to include advanced features like unread indicators.

Business Rules - View Active Chats

  • The user should see a list of all active chat conversations upon logging in or navigating to the Active tab
  • For the Active Chat List use infinite scrolling for pagination.
  • Each item should display the contact name, the most recent message and a timestamp of the last activity.
    ** Display an avatar placeholder for the profiles image
  • The active chat list should be ordered by the most recent activity, with the most recent chat appearing on top.
  • Given no chat has been selected we should display an empty chat room image.
  • Given there is no active chats, then we should display the "no messages to be displayed" image.
  • Given the user selects an Active Chat, he should be able to write a new message and send it to the corresponding contact-
  • The new message should appear in the message history and also the latest activity on the list should be updated.

Validation Rules

  • The chat list should be responsive and display correctly on various screen sizes, from mobile to desktop.

Test Cases

  • No active chats to test the placeholder image.
  • 1 Active chat for the user
  • 5 Active chats for the user
  • Sending a new message to an existing Active Chat.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced the ChatRoomCard component for displaying chat room information.
    • Added "Active Tab" functionality to enhance user interaction in the messages module.
    • Integrated a new NoMessagesIcon for improved visual feedback.
    • Launched a Searchbar component for better search capabilities.
    • Added support for displaying unread message counts in chat rooms.
    • Enhanced the ChatRoomsList component for improved chat room management and display.
  • Bug Fixes

    • Adjusted styles in the MessageItem component to prevent overflow and improve layout.
    • Enhanced responsiveness in various components, including MessageItemContainer and MessagesGroup.
  • Updates

    • Updated dependencies across multiple packages to ensure compatibility and performance improvements.
    • Incremented version numbers for @baseapp-frontend/components (0.0.19) and @baseapp-frontend/design-system (0.0.20).
    • Updated the @baseapp-frontend/wagtail package to version 1.0.2.
    • Added new GraphQL fields and fragments to enhance data retrieval for chat rooms.

@changeset-bot
Copy link

changeset-bot bot commented Nov 7, 2024

⚠️ No Changeset found

Latest commit: 6ebe5cff087e006ea47c1dca54dc2d9801e26d6e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Ronan-Fernandes Ronan-Fernandes changed the base branch from master to BA-1746-create-new-chat November 7, 2024 04:57
@Ronan-Fernandes Ronan-Fernandes self-assigned this Nov 7, 2024
@Ronan-Fernandes Ronan-Fernandes force-pushed the BA-1733-FE-Active-chats-tab branch from 8ffb40e to b1b9805 Compare November 7, 2024 19:17
@pt-tsl pt-tsl force-pushed the BA-1746-create-new-chat branch from 53b797f to dfd3987 Compare November 8, 2024 14:24
@Ronan-Fernandes Ronan-Fernandes force-pushed the BA-1733-FE-Active-chats-tab branch from 3f0928c to b1b9805 Compare November 11, 2024 15:00
@coderabbitai
Copy link

coderabbitai bot commented Nov 11, 2024

Walkthrough

The pull request includes updates across multiple components and packages. Key changes involve the addition of new React components such as ChatRoomCard and ChatRoomsList, enhancements to existing components like MessageItem, and updates to GraphQL queries and fragments. Additionally, several package.json files have been modified to specify exact versions for dependencies, replacing previous catalog references. The changelog has been updated to reflect these changes, including new features and dependency updates.

Changes

File Path Change Summary
packages/components/package.json Updated devDependencies for @parcel/packager-ts and @parcel/transformer-typescript-types from 2.13.0 to 2.13.2.
packages/components/CHANGELOG.md Updated to include version 0.0.19, documenting changes to the messages module, including the addition of "Active Tab" functionality and style adjustments to MessageItem.
packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx Introduced ChatRoomCard component, utilizing props for room data and click handling.
packages/components/modules/messages/ChatRoomsList/ChatRoomCard/styled.tsx Added StyledChatCard styled component for layout and styling based on props.
packages/components/modules/messages/ChatRoomsList/ChatRoomCard/types.ts Added ChatRoomCardProps and StyledChatCardProps TypeScript interfaces for props typing.
packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts Introduced formatDate utility function for date formatting.
packages/components/modules/messages/ChatRoomsList/constants.ts Added constants CHAT_TAB_VALUES and CHAT_TAB_LABEL for tab management.
packages/components/modules/messages/ChatRoomsList/index.tsx Introduced ChatRoomsList component for managing and displaying chat rooms with state management and real-time updates.
packages/components/modules/messages/ChatRoomsList/types.ts Added ChatRoomsListProps interface and ChatTabValues type alias for props typing.
packages/components/modules/messages/CreateChatRoomList/ChatRoomListCard/index.tsx Removed setIsInChatRoom prop; updated URL path handling with joinWithSeparator.
packages/components/modules/messages/CreateChatRoomList/ChatRoomListCard/types.ts Updated ChatRoomListCardProps interface by removing setIsInChatRoom and PropsWithChildren.
packages/components/modules/messages/CreateChatRoomList/index.tsx Simplified rendering logic for new group chat option; removed useForm and related logic.
packages/components/modules/messages/CreateChatRoomList/types.ts Reduced complexity by removing setIsInChatRoom, noResultsImage, noConnectionsImage properties, and the Edge interface.
packages/components/modules/messages/MessageItem/index.tsx Added sx prop to Typography for layout improvements.
packages/components/modules/messages/MessageItem/styled.tsx Updated maxWidth property in MessageItemContainer for responsive design.
packages/components/modules/messages/MessagesGroup/index.tsx Added width: '100%' to Box components for layout enhancement.
packages/components/modules/messages/graphql/queries/ChatRoomQuery.ts Added unreadMessagesCount field to the ChatRoomQuery.
packages/components/modules/messages/graphql/queries/ChatRoomsQuery.ts Modified to include me { id profile { id ...RoomsListFragment } } in the query.
packages/components/modules/messages/graphql/queries/Room.ts Introduced RoomFragment for the ChatRoom type with detailed fields.
packages/components/modules/messages/graphql/queries/RoomsList.ts Added RoomsListFragment and useRoomsList hook for paginated chat room management.
packages/components/modules/messages/graphql/subscriptions/useRoomListSubscription.tsx Introduced useRoomListSubscription hook for real-time chat room updates.
packages/components/modules/messages/index.ts Added exports for ChatRoomsList and related types and queries.
packages/components/modules/profiles/index.ts Added export for CurrentProfileProvider.
packages/design-system/CHANGELOG.md Updated to include version 0.0.20, documenting the addition of Searchbar and NoMessagesIcon.
packages/design-system/components/Searchbar/index.tsx Modified to use useForm from react-hook-form, updated props for flexibility.
packages/design-system/components/Searchbar/types.ts Updated SearchbarProps to extend TextFieldProps directly, removing form and name properties.
packages/design-system/components/icons/NoMessagesIcon/index.tsx Introduced NoMessagesIcon component as a custom SVG icon.
packages/design-system/components/icons/index.ts Added export for NoMessagesIcon.
packages/design-system/components/inputs/SocialTextField/types.ts Removed TextAreaProps type declaration.
packages/design-system/components/inputs/TextField/index.tsx Updated export for PureTextField with explicit type assertion.
packages/design-system/components/inputs/TextField/types.ts Corrected Resposive to Responsive and introduced PureTextFieldProps.
packages/design-system/package.json Updated dependencies to specific versions, incremented version to 0.0.20.
packages/wagtail/CHANGELOG.md Updated to include version 1.0.2, noting the dependency update for @baseapp-frontend/design-system.
packages/wagtail/modules/components/Blocks/BannerBlock/BannerDescriptionRichText/index.tsx Reformatted JSX for improved readability without changing functionality.
packages/wagtail/package.json Incremented version to 1.0.2.

Possibly related PRs

🐰 In the meadow where changes bloom,
New components rise, dispelling gloom.
With cards and lists, our chats take flight,
Dependencies updated, all feels right!
So hop along, let’s celebrate,
For every change, we elevate! 🌼

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /packages/components/.eslintrc.js
Error: Cannot find module '@baseapp-frontend/config/.eslintrc.js'
Require stack:

  • /packages/components/.eslintrc.js
  • /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Module._load (node:internal/modules/cjs/loader:1074:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (/packages/components/.eslintrc.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)

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.

@Ronan-Fernandes Ronan-Fernandes force-pushed the BA-1733-FE-Active-chats-tab branch 2 times, most recently from a5c631f to 79bb27d Compare November 11, 2024 23:14
@pt-tsl pt-tsl force-pushed the BA-1746-create-new-chat branch from dfd3987 to 72cd96d Compare November 12, 2024 12:57
@Ronan-Fernandes Ronan-Fernandes force-pushed the BA-1733-FE-Active-chats-tab branch 4 times, most recently from f956504 to 745a334 Compare November 13, 2024 02:43
@pt-tsl pt-tsl force-pushed the BA-1746-create-new-chat branch from 72cd96d to 8190ef4 Compare November 13, 2024 13:43
@Ronan-Fernandes Ronan-Fernandes force-pushed the BA-1733-FE-Active-chats-tab branch 4 times, most recently from 07f3ae8 to ba73faa Compare November 18, 2024 14:36
@pt-tsl pt-tsl force-pushed the BA-1746-create-new-chat branch 6 times, most recently from 0232281 to f230d16 Compare November 18, 2024 21:50
@pt-tsl pt-tsl force-pushed the BA-1746-create-new-chat branch from 533c342 to 48ad490 Compare November 19, 2024 19:37
@Ronan-Fernandes Ronan-Fernandes force-pushed the BA-1733-FE-Active-chats-tab branch 3 times, most recently from 945cdb3 to 2f217a0 Compare November 19, 2024 20:52
@pt-tsl pt-tsl force-pushed the BA-1746-create-new-chat branch 6 times, most recently from 7429dbe to b4210ce Compare November 22, 2024 13:24
Base automatically changed from BA-1746-create-new-chat to master November 26, 2024 18:00
@anicioalexandre anicioalexandre changed the title Ba 1733 fe active chats tab BA-1733: active chats tab Nov 26, 2024
@anicioalexandre anicioalexandre force-pushed the BA-1733-FE-Active-chats-tab branch from 2f217a0 to 7ac4db8 Compare November 26, 2024 19:13
Copy link

@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: 14

🧹 Outside diff range and nitpick comments (36)
packages/components/modules/profiles/index.ts (1)

Line range hint 1-7: Consider organizing exports with explicit grouping

The file mixes different types of exports. Consider using a more structured approach with clear grouping comments:

-// Contexts & Providers
+// Context Hooks
 export { default as useCurrentProfile } from './context/useCurrentProfile'
+
+// Context Providers
 export { default as CurrentProfileProvider } from './context/CurrentProfileProvider'
 
-// Components
+// UI Components
 export * from './ProfilePopover'
packages/design-system/components/Searchbar/types.ts (2)

5-9: Consider adding JSDoc comments for better documentation.

While the type definition is clean, adding JSDoc comments would improve the developer experience by documenting the purpose of each prop, especially for the non-standard props like isPending, refetch, and startTransition.

Here's a suggested improvement:

+/**
+ * Props for the Searchbar component
+ * @extends TextFieldProps from TextField component
+ */
 export type SearchbarProps = TextFieldProps & {
+  /** Indicates if a search operation is in progress */
   isPending: boolean
+  /** Function to trigger a new search */
   refetch: any
+  /** React transition function for search updates */
   startTransition: TransitionStartFunction
 }

7-7: Consider typing the refetch prop more strictly.

The refetch prop is currently typed as any, which loses type safety. Consider defining a more specific type based on its expected usage pattern.

packages/components/modules/messages/ChatRoomsList/constants.ts (1)

7-11: Consider adding i18n support for tab labels

The hardcoded English labels should be moved to translation files to support internationalization. This would make the application more maintainable and accessible to users of different languages.

-export const CHAT_TAB_LABEL = {
-  [CHAT_TAB_VALUES.active]: 'Active',
-  [CHAT_TAB_VALUES.unread]: 'Unread',
-  [CHAT_TAB_VALUES.archived]: 'Archived',
-} as const
+import { useTranslation } from 'react-i18next';
+
+export const useChatTabLabel = () => {
+  const { t } = useTranslation();
+  return {
+    [CHAT_TAB_VALUES.active]: t('chat.tabs.active'),
+    [CHAT_TAB_VALUES.unread]: t('chat.tabs.unread'),
+    [CHAT_TAB_VALUES.archived]: t('chat.tabs.archived'),
+  } as const;
+};
packages/components/modules/messages/graphql/queries/ChatRoomQuery.ts (1)

7-7: Consider making unreadMessagesCount nullable

For better robustness, consider making the field nullable (i.e., unreadMessagesCount). This ensures the query won't fail if the count is temporarily unavailable or undefined.

-      unreadMessagesCount
+      unreadMessagesCount
packages/components/modules/messages/ChatRoomsList/ChatRoomCard/types.ts (1)

16-19: LGTM! Consider adding JSDoc comments

The styled props interface is well-structured and properly extends BoxProps. Consider adding JSDoc comments to document the purpose of each prop.

 export interface StyledChatCardProps extends BoxProps {
+  /** Indicates if the chat room card is currently selected */
   isCardSelected?: boolean
+  /** Controls whether to show pointer cursor on hover */
   showPointer?: boolean
 }
packages/components/modules/messages/CreateChatRoomList/ChatRoomListCard/types.ts (1)

Line range hint 8-14: Define a proper type for the item prop instead of using any

Using any defeats TypeScript's type checking capabilities and could lead to runtime errors. Consider creating a specific interface that defines the expected shape of the chat room item.

Example implementation:

interface ChatRoomItem {
  id: string
  name: string
  lastMessage?: string
  timestamp: string
  // Add other relevant fields based on your data structure
}

export interface ChatRoomListCardProps {
  item: ChatRoomItem
  // ... other props remain the same
}
packages/components/modules/messages/graphql/queries/Room.ts (2)

7-9: Consider making image dimensions configurable

The image dimensions are hardcoded to 100x100px in multiple places. This might not be optimal for different screen sizes or UI contexts.

Consider extracting these dimensions to constants or making them configurable through variables:

-    image(width: 100, height: 100) {
+    image(width: $imageSize, height: $imageSize) {
       url
     }

Also applies to: 25-27


3-34: Well-structured fragment that aligns with requirements

The fragment structure effectively supports the active chats tab requirements:

  • Includes necessary fields for chat display (title, last message, timestamp)
  • Proper pagination structure for participants
  • Includes unread message count for future enhancements
  • Follows Relay best practices for connections

A few suggestions for robustness:

  1. Consider adding @required directives for critical fields like id and title
  2. Add proper null handling for optional fields like lastMessage and image

Example enhancement:

 fragment RoomFragment on ChatRoom {
-    id
-    title
+    id @required
+    title @required
     lastMessage {
-      id
+      id @required
       content
     }
packages/components/modules/messages/MessageItem/styled.tsx (1)

23-25: LGTM! Well-implemented breakpoint handling

The media query implementation follows MUI best practices:

  • Uses the theme's breakpoint system correctly
  • 80% width for mobile is appropriate to maximize readable space while maintaining margins
  • Maintains consistent styling structure

Consider documenting these breakpoint-specific values in a central theme configuration for better maintainability across components.

packages/components/modules/messages/ChatRoomsList/ChatRoomCard/styled.tsx (1)

6-25: Consider these enhancements for better maintainability and accessibility.

The styled component implementation is solid, with good use of theme values and responsive design. However, there are some opportunities for improvement:

Consider these refinements:

 export const StyledChatCard = styled(Box)<StyledChatCardProps>(
   ({ theme, showPointer = false, isCardSelected = false }) => ({
     display: 'grid',
     height: '100%',
     width: '100%',
-    maxWidth: '390px',
+    maxWidth: theme.breakpoints.values.chatCard || '390px', // Define in theme
     gridTemplateColumns: '48px auto min-content',
+    gridTemplateAreas: `
+      "avatar content timestamp"
+    `,
     gap: theme.spacing(2.5),
     padding: theme.spacing(1.5, 3.5),
     cursor: showPointer ? 'pointer' : 'default',
     backgroundColor: isCardSelected
-      ? alpha(theme.palette.primary.main, 0.08)
+      ? alpha(theme.palette.primary.main, theme.alpha.selected || 0.08)
       : theme.palette.background.default,
     borderRight: isCardSelected ? `2px solid ${theme.palette.primary.light}` : 'none',
     [theme.breakpoints.down('sm')]: {
-      maxWidth: '600px',
+      maxWidth: theme.breakpoints.values.chatCardMobile || '600px',
       padding: theme.spacing(1.5),
     },
   }),
 )

The changes above would:

  1. Move magic numbers to theme constants for better maintainability
  2. Add named grid areas for better accessibility and maintainability
  3. Make the component more configurable through theme customization

Consider creating a theme extension file to define these constants:

declare module '@mui/material/styles' {
  interface BreakpointOverrides {
    chatCard: true;
    chatCardMobile: true;
  }
  interface Theme {
    alpha: {
      selected: number;
    }
  }
}
packages/components/modules/messages/ChatRoomsList/types.ts (1)

24-24: Add documentation for the ChatTabValues type

Consider adding JSDoc documentation to explain the purpose and possible values of this type.

+/** Type representing the possible values for chat tabs (e.g., 'active', 'archived') */
 export type ChatTabValues = ValueOf<typeof CHAT_TAB_VALUES>
packages/components/modules/messages/index.ts (1)

Line range hint 1-27: Consider adding module documentation.

The file structure is well-organized, but it would be beneficial to add JSDoc comments describing the module's purpose and the relationship between its components, especially now that it includes both chat room creation and active chats functionality.

Add documentation at the top of the file:

+/**
+ * Messages Module
+ * 
+ * This module provides components and queries for:
+ * - Creating new chat rooms
+ * - Displaying active chat rooms
+ * - Managing messages within chat rooms
+ */
 export { default as MessageItem } from './MessageItem'
packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts (3)

11-14: Consider enhancing error handling and input validation.

While the null checks are good, consider these improvements:

  1. Add explicit check for empty string
  2. Log invalid date errors for debugging
 export const formatDate = (date?: string | null) => {
-  if (!date) return ''
+  if (!date || date.trim() === '') return ''
   const dateTime = DateTime.fromISO(date)
-  if (!dateTime.isValid) return ''
+  if (!dateTime.isValid) {
+    console.warn(`Invalid date format received: ${date}`)
+    return ''
+  }

16-18: Consider adding internationalization support.

The hardcoded "Yesterday" string should be internationalized to support multiple languages, especially since this is a chat application that might be used globally.

-  if (isYesterday(date)) return 'Yesterday'
+  if (isYesterday(date)) return t('common.yesterday')

11-35: Add comprehensive unit tests.

Given the various date formatting scenarios and edge cases handled by this utility, it would be valuable to add unit tests covering:

  1. Null/empty input handling
  2. Invalid date handling
  3. Today/Yesterday cases
  4. Different time differences (months, weeks, days)
  5. Edge cases around midnight

Would you like me to help generate a comprehensive test suite for this utility?

packages/components/modules/messages/graphql/queries/RoomsList.ts (2)

10-11: Consider increasing the default page size.

The current default of 5 items might lead to frequent pagination requests during initial load and scrolling. Given that this is an infinite scroll implementation for active chats, a larger initial page size (e.g., 20) would provide a smoother user experience by reducing initial loading states.


32-36: Consider exposing error and loading states.

The hook could be enhanced to expose error handling and loading states to improve the user experience. This would allow the UI to show appropriate loading indicators and error messages during data fetching.

Example enhancement:

export const useRoomsList = (targetRef: RoomsListFragment$key) => {
  const {
    data,
    loadNext,
    hasNext,
    isLoadingNext,
    refetch,
    hasError,
  } = usePaginationFragment<chatRoomsPaginationQuery, RoomsListFragment$key>(
    RoomsListFragment,
    targetRef
  );
  
  return {
    data,
    loadNext,
    hasNext,
    isLoading: isLoadingNext,
    refetch,
    hasError,
  };
};
packages/components/modules/messages/CreateChatRoomList/ChatRoomListCard/index.tsx (2)

24-24: Great architectural improvement!

Moving from prop-based to context-based state management reduces prop drilling and improves maintainability.


Line range hint 26-61: Consider adding accessibility improvements

To enhance accessibility, consider:

  1. Adding ARIA labels to interactive elements
  2. Ensuring proper color contrast for text
  3. Adding keyboard navigation support
 <MainContainer key={`profile-${id}`}>
   <AvatarWithPlaceholder
     width={48}
     height={48}
     src={image?.url}
+    alt={`${name}'s avatar`}
     sx={{ alignSelf: 'center', justifySelf: 'center' }}
   />
   <Box
+    role="article"
+    aria-label={`Chat with ${name}`}
     sx={{ display: 'grid', gridTemplateRows: 'repeat(2, minmax(0, 1fr))' }}>
     <Typography variant="subtitle2">{name}</Typography>
     <Typography variant="caption" color="text.secondary">
       {joinWithSeparator(['@', urlPath?.path], { separator: '' })}
     </Typography>
   </Box>
   <LoadingButton
     color="inherit"
     variant="outlined"
+    aria-label={`Message ${name}`}
     onClick={() => {
packages/design-system/components/Searchbar/index.tsx (2)

22-22: Consider constraining the variant prop type

The variant prop should be typed to only allow valid MUI TextField variants ('filled' | 'outlined' | 'standard').

- variant = 'filled',
+ variant: TextFieldProps['variant'] = 'filled',

Line range hint 46-96: Consider extracting hardcoded style values

While the TextField implementation is solid, consider extracting the hardcoded style values (padding, height) to theme constants or component-level constants for better maintainability and consistency across the design system.

const SEARCHBAR_CONSTANTS = {
  INPUT_HEIGHT: '17px',
  PADDING: '14px',
} as const;

Then use these constants in your styles:

  sx: {
    '& .MuiFilledInput-input': {
-     height: '17px',
+     height: SEARCHBAR_CONSTANTS.INPUT_HEIGHT,
      paddingTop: '14px',
      paddingBottom: '14px',
      paddingRight: '14px',
-     maxHeight: '17px',
+     maxHeight: SEARCHBAR_CONSTANTS.INPUT_HEIGHT,
    },
packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx (2)

16-22: Add JSDoc comments to document the component and its props.

While the props are well-structured, adding JSDoc comments would improve maintainability and developer experience.

+/**
+ * ChatRoomCard component displays individual chat room items with participant info and unread message count
+ *
+ * @param {RoomFragment$key} roomRef - Relay fragment reference for room data
+ * @param {boolean} [isCardSelected=false] - Whether the card is currently selected
+ * @param {Function} [handleClick] - Click handler for the card
+ * @param {typeof DefaultBadge} [Badge] - Custom badge component
+ * @param {object} [BadgeProps] - Props for the badge component
+ */
 const ChatRoomCard: FC<ChatRoomCardProps> = ({

68-84: Improve message display with better truncation and localization.

The current implementation could be enhanced for better handling of long messages and localized timestamps.

-              <Typography variant="caption" color="text.secondary" noWrap>
-                {formatDate(lastMessageTime)}
+              <Typography 
+                variant="caption" 
+                color="text.secondary" 
+                noWrap
+                sx={{ minWidth: '4.5rem' }}
+              >
+                {new Intl.DateTimeFormat(undefined, {
+                  timeStyle: 'short',
+                  dateStyle: 'short'
+                }).format(new Date(lastMessageTime))}
               </Typography>
               <div className="mx-2 inline-block h-1.5 w-1.5 rounded-full bg-text-disabled" />
               <Typography
                 variant="caption"
                 color="text.secondary"
                 noWrap
-                sx={{ overflow: 'hidden', textOverflow: 'ellipsis' }}
+                sx={{ 
+                  overflow: 'hidden', 
+                  textOverflow: 'ellipsis',
+                  maxWidth: { xs: '8rem', sm: '12rem', md: '16rem' } 
+                }}
packages/components/modules/messages/CreateChatRoomList/index.tsx (4)

95-96: Implement group chat creation handler

The TODO comment indicates missing functionality for group chat creation, which is a core feature mentioned in the PR objectives.

Would you like me to help implement the group chat creation handler with proper loading and error states?


97-116: Enhance accessibility and responsiveness of group chat button

The group chat button needs improvements:

  1. Missing accessibility attributes (role, aria-label)
  2. Fixed dimensions might not be responsive
  3. Missing keyboard interaction handling

Consider these improvements:

- <GroupChatContainer onClick={() => {}}>
+ <GroupChatContainer
+   role="button"
+   aria-label="Create new group chat"
+   onClick={() => {}}
+   onKeyPress={(e) => e.key === 'Enter' && onClick()}
+   tabIndex={0}
+ >
  <AvatarWithPlaceholder
-   width={48}
-   height={48}
+   sx={{
+     width: { xs: 40, sm: 48 },
+     height: { xs: 40, sm: 48 },
+     bgcolor: theme.palette.primary.main,
+     alignSelf: 'flex-start',
+     justifySelf: 'center',
+   }}

118-132: Enhance infinite scrolling implementation

The current implementation could be improved:

  1. Make the page size configurable
  2. Add error handling for failed loads
  3. Consider adding a retry mechanism

Consider these improvements:

+ const PAGE_SIZE = 5;
+ const [loadError, setLoadError] = useState<Error | null>(null);

  <Virtuoso
    data={memoizedItems}
    overscan={1}
    itemContent={(_index, item) => renderItem(item)}
    style={{ scrollbarWidth: 'none' }}
    components={{
      Footer: renderLoadingState,
+     // Add error state component
+     Error: () => loadError && (
+       <Box sx={{ p: 2, textAlign: 'center' }}>
+         <Typography color="error">{loadError.message}</Typography>
+         <Button onClick={() => { setLoadError(null); loadNext(PAGE_SIZE); }}>
+           Retry
+         </Button>
+       </Box>
+     ),
    }}
    endReached={() => {
      if (hasNext) {
-       loadNext(5)
+       loadNext(PAGE_SIZE).catch(setLoadError);
      }
    }}

Line range hint 27-34: Implement missing requirements from PR objectives

The current implementation is missing several key requirements:

  1. Sorting chats by most recent activity
  2. Displaying the most recent message in each chat
  3. Showing timestamp of last activity

These are core requirements mentioned in the PR objectives. Consider updating the ChatRoomListCard props to include these details and implement proper sorting in the memoizedItems calculation.

packages/components/CHANGELOG.md (1)

7-8: Fix grammar and enhance change description.

The changelog entries should be more descriptive and grammatically correct:

Apply this diff to improve the entries:

-- Add Active Tab functionality to the `messages` module.
-- Tweaks on `MessageItem` styles so it have the correct `max-width`.
++ Add Active Chats tab functionality to the `messages` module, including:
++   - Infinite scrolling for chat list
++   - Chat room card with contact name and timestamp
++   - Empty state handling
++ Fix `MessageItem` styles to have the correct `max-width`.
🧰 Tools
🪛 LanguageTool

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

packages/design-system/CHANGELOG.md (2)

7-7: Consider removing duplicate Searchbar entry

The Searchbar component is mentioned in both v0.0.20 and v0.0.19. Consider removing the duplicate entry from v0.0.19 or clarifying if there are different changes between versions.

Also applies to: 3-3


3-9: Consider a minor version bump instead of patch

The changes include new components (Searchbar), new icons (NoMessagesIcon), and exported types (PureTextFieldProps). According to semantic versioning, adding new features typically warrants a minor version bump (0.1.0) rather than a patch version (0.0.20).

packages/components/package.json (1)

Line range hint 52-111: Inconsistent versioning strategy in devDependencies.

There's an inconsistent approach to version management:

  • Some dependencies use catalog references (e.g., @storybook/addon-docs: "catalog:storybook")
  • Others use specific versions (e.g., typescript: "^5.4.5")

Consider adopting a consistent versioning strategy across all dependencies.

packages/design-system/components/icons/NoMessagesIcon/index.tsx (1)

6-108: Consider optimizing the SVG implementation.

While the implementation is functional, consider these improvements:

  1. Group related paths semantically using <g> elements
  2. Add ARIA labels for accessibility
  3. Consider optimizing SVG paths to reduce bundle size

Apply these improvements:

 <SvgIcon sx={{ fontSize: 196, color: 'grey.500', ...sx }} {...props}>
+  <title>No Messages</title>
   <svg
     xmlns="http://www.w3.org/2000/svg"
     width="196"
     height="196"
     viewBox="0 0 196 196"
     fill="none"
+    role="img"
+    aria-label="No messages available"
   >
+    <g>
     {/* existing paths */}
+    </g>
   </svg>
 </SvgIcon>
packages/components/modules/messages/graphql/subscriptions/useRoomListSubscription.tsx (3)

43-43: Type the data parameter in the updater function for better type safety

The data parameter in the updater function is currently typed as any. For improved type safety and code readability, it's recommended to use the generated Relay types for the subscription response. This will help catch potential errors at compile time and provide better autocompletion support.

Apply this diff to type the data parameter:

-      updater: (store: RecordSourceSelectorProxy<unknown>, data: any) => {
+      updater: (
+        store: RecordSourceSelectorProxy<unknown>,
+        data: useRoomListSubscriptionResponse | null
+      ) => {

Ensure you import the correct type for useRoomListSubscriptionResponse from the generated Relay types:

import { useRoomListSubscriptionResponse } from './__generated__/useRoomListSubscription.graphql'

41-41: Reminder: Update to use useCurrentProfile hook when available

There's a TODO comment indicating the intent to use the useCurrentProfile hook once it's available. This will streamline the code by removing the need to pass currentProfileId as a parameter.

Consider the following change when the useCurrentProfile hook becomes available:

 const useRoomListSubscription = (nodeId: string, currentProfileId: string) => {
   const config = useMemo(
     () => ({
       subscription: RoomListSubscription,
       onError: console.error,
       variables: {
-        profileId: currentProfileId, // TODO: use currentProfile hook when available
+        profileId: currentProfileId,
       },
       updater: (
         store: RecordSourceSelectorProxy<unknown>,
         data: useRoomListSubscriptionResponse | null
       ) => {
         // ... existing code ...
       },
     }),
-    [nodeId, currentProfileId],
+    [nodeId],
   )

+  // When `useCurrentProfile` is available
+  // const { currentProfileId } = useCurrentProfile()

   return useSubscription(config)
 }

This change assumes that the useCurrentProfile hook provides currentProfileId. Adjust accordingly based on the actual implementation of the hook.


34-34: Reminder: Verify backend subscription functionality

There's a TODO comment suggesting to check if the backend subscription is working properly. Ensuring the backend subscriptions are functioning as expected is crucial for real-time updates.

Would you like me to assist in creating test cases or scripts to verify the backend subscription functionality? Alternatively, I can open a GitHub issue to track this task so it doesn't get overlooked.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 80f8d64 and 7ac4db80eb17d6bd1ecf09efa62f5bda07b55528.

⛔ Files ignored due to path filters (7)
  • packages/components/__generated__/ChatRoomQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ChatRoomsQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/RoomFragment.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/RoomsListFragment.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/chatRoomsPaginationQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/useRoomListSubscription.graphql.ts is excluded by !**/__generated__/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (37)
  • package.json (1 hunks)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/styled.tsx (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/types.ts (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/constants.ts (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/index.tsx (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/types.ts (1 hunks)
  • packages/components/modules/messages/CreateChatRoomList/ChatRoomListCard/index.tsx (3 hunks)
  • packages/components/modules/messages/CreateChatRoomList/ChatRoomListCard/types.ts (1 hunks)
  • packages/components/modules/messages/CreateChatRoomList/index.tsx (3 hunks)
  • packages/components/modules/messages/CreateChatRoomList/types.ts (0 hunks)
  • packages/components/modules/messages/MessageItem/index.tsx (1 hunks)
  • packages/components/modules/messages/MessageItem/styled.tsx (1 hunks)
  • packages/components/modules/messages/MessagesGroup/index.tsx (2 hunks)
  • packages/components/modules/messages/graphql/queries/ChatRoomQuery.ts (1 hunks)
  • packages/components/modules/messages/graphql/queries/ChatRoomsQuery.ts (1 hunks)
  • packages/components/modules/messages/graphql/queries/Room.ts (1 hunks)
  • packages/components/modules/messages/graphql/queries/RoomsList.ts (1 hunks)
  • packages/components/modules/messages/graphql/subscriptions/useRoomListSubscription.tsx (1 hunks)
  • packages/components/modules/messages/index.ts (2 hunks)
  • packages/components/modules/profiles/index.ts (1 hunks)
  • packages/components/package.json (4 hunks)
  • packages/components/schema.graphql (1 hunks)
  • packages/design-system/CHANGELOG.md (1 hunks)
  • packages/design-system/components/Searchbar/index.tsx (3 hunks)
  • packages/design-system/components/Searchbar/types.ts (1 hunks)
  • packages/design-system/components/icons/NoMessagesIcon/index.tsx (1 hunks)
  • packages/design-system/components/icons/index.ts (1 hunks)
  • packages/design-system/components/inputs/SocialTextField/types.ts (0 hunks)
  • packages/design-system/components/inputs/TextField/index.tsx (2 hunks)
  • packages/design-system/components/inputs/TextField/types.ts (1 hunks)
  • packages/design-system/package.json (2 hunks)
  • packages/wagtail/CHANGELOG.md (1 hunks)
  • packages/wagtail/modules/components/Blocks/BannerBlock/BannerDescriptionRichText/index.tsx (1 hunks)
  • packages/wagtail/package.json (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/components/modules/messages/CreateChatRoomList/types.ts
  • packages/design-system/components/inputs/SocialTextField/types.ts
✅ Files skipped from review due to trivial changes (5)
  • package.json
  • packages/components/modules/messages/MessageItem/index.tsx
  • packages/design-system/components/inputs/TextField/types.ts
  • packages/wagtail/CHANGELOG.md
  • packages/wagtail/package.json
🧰 Additional context used
🪛 LanguageTool
packages/components/CHANGELOG.md

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

🪛 Biome (1.9.4)
packages/wagtail/modules/components/Blocks/BannerBlock/BannerDescriptionRichText/index.tsx

[error] 9-9: Avoid passing content using the dangerouslySetInnerHTML prop.

Setting content using code can expose users to cross-site scripting (XSS) attacks

(lint/security/noDangerouslySetInnerHtml)

🔇 Additional comments (46)
packages/components/modules/profiles/index.ts (1)

3-3: LGTM! Provider export aligns with chat feature requirements

The addition of CurrentProfileProvider export follows React's provider pattern and complements the existing useCurrentProfile hook, which is essential for managing profile state in the chat functionality.

packages/design-system/components/Searchbar/types.ts (1)

5-9: LGTM! Improved type definition with better separation of concerns.

The simplified type definition improves the component's flexibility while maintaining a cleaner separation of concerns. The removal of form-specific properties allows the component to focus on its primary search UI responsibility.

Let's verify the impact of these type changes on existing usage:

✅ Verification successful

Type changes are safe and improve component architecture

The verification confirms that:

  1. The Searchbar component internally manages its own form state using useForm hook
  2. No consumers are passing the removed form prop - they only pass isPending, startTransition, and refetch
  3. The type changes align with the actual implementation and usage patterns

The simplified type definition is a positive change that better reflects the component's actual usage and improves separation of concerns.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for existing usages that might be affected by the removed 'form' prop

# Search for Searchbar components that pass a form prop
rg -l "form.*Searchbar" --type ts --type tsx

# Search for direct imports and usage of SearchbarProps type
rg -l "SearchbarProps.*form" --type ts --type tsx

Length of output: 154


Script:

#!/bin/bash
# Let's try with a different approach to search for Searchbar usages and imports

# Search for Searchbar component usage
rg "Searchbar.*form" 

# Search for SearchbarProps type imports and usage
rg "SearchbarProps"

# Find all TypeScript/JavaScript files that might use Searchbar
fd "\.(ts|tsx|js|jsx)$" | grep -i "searchbar"

Length of output: 1889


Script:

#!/bin/bash
# Let's check the actual implementation and usage to see how the form prop was used before

# Check the implementation file
cat packages/design-system/components/Searchbar/index.tsx

# Check one of the usage files to see the actual props being passed
cat packages/components/modules/messages/ChatRoomsList/index.tsx

Length of output: 7413

packages/components/modules/messages/graphql/queries/ChatRoomsQuery.ts (1)

6-12: LGTM! The query structure aligns with requirements.

The addition of the me field with nested profile selection provides the necessary structure for user-specific chat rooms retrieval.

Let's verify the fragment dependencies and required fields:

✅ Verification successful

The query structure and fragment dependencies are well-implemented

The verification confirms that:

  • RoomsListFragment is properly defined with pagination support (@refetchable, @connection)
  • Required fields are included through RoomFragment which contains:
    • lastMessageTime for timestamps
    • lastMessage.content for message preview
    • title for chat name
    • unreadMessagesCount for notification state
    • image for visual representation
    • participants for group chat information
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the RoomsListFragment implementation and required fields

# Check for RoomsListFragment definition
rg -A 10 "fragment RoomsListFragment" packages/components/modules/messages/graphql/

# Verify if fragment includes required fields for chat display
rg -A 15 "fragment (RoomsListFragment|RoomFragment)" packages/components/modules/messages/graphql/ | grep -E "(name|timestamp|message|createdAt)"

Length of output: 4114

packages/components/modules/messages/ChatRoomsList/constants.ts (1)

1-5: Verify scope alignment with requirements

The constants include unread and archived tabs, but the PR objectives only mention implementing the active chats tab. While this forward-thinking approach supports future extensibility, it's important to:

  1. Confirm if these additional tabs are part of the planned roadmap
  2. Consider documenting the intended usage of these tabs for future reference
packages/components/modules/messages/graphql/queries/ChatRoomQuery.ts (1)

7-7: Verify requirement alignment for unread messages feature

The addition of unreadMessagesCount appears to contradict the PR objectives which specifically mention "without advanced features such as unread indicators". Please clarify if this is an intentional scope expansion or if this field should be removed to align with the original requirements.

packages/components/modules/messages/ChatRoomsList/ChatRoomCard/types.ts (2)

1-6: LGTM! Well-organized imports with proper type definitions

The imports are clean and properly structured, with clear separation between React, MUI, and GraphQL types.


8-14: Verify GraphQL fragment contains all required fields

The interface relies on RoomFragment$key for room data. Based on the PR objectives, please verify that the GraphQL fragment includes all necessary fields for displaying:

  • Contact name
  • Most recent message
  • Timestamp of last activity
  • Avatar information
✅ Verification successful

GraphQL fragment contains all required fields

The RoomFragment contains all necessary fields for displaying chat room information:

  • Contact name: Available via participants.edges.node.profile.name
  • Most recent message: Available via lastMessage.content
  • Timestamp: Available via lastMessageTime
  • Avatar information: Available via image.url and participants.edges.node.profile.image.url

Additionally, it includes other useful fields like unreadMessagesCount and title that enhance the chat room card functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the Room fragment contains all required fields

# Search for the Room fragment definition
ast-grep --pattern 'fragment Room on Room {
  $$$
}'

# Alternatively, search for the fragment file
rg -l "fragment Room.*on Room" --type graphql

Length of output: 134


Script:

#!/bin/bash
# Let's try different approaches to find the Room fragment definition

# Search for fragment definition in all files
rg "fragment Room.*on Room"

# Search for files containing "Room" fragment
fd -e ts -e tsx -e graphql | xargs rg "fragment Room"

# Search for files that might contain the fragment definition
fd -e ts -e tsx -e graphql | xargs rg "RoomFragment"

Length of output: 9872

packages/components/modules/messages/CreateChatRoomList/ChatRoomListCard/types.ts (1)

Line range hint 8-14: Verify the impact of removing setIsInChatRoom prop

The removal of setIsInChatRoom prop suggests a shift to context-based state management. Let's verify that all components previously using this prop have been updated accordingly.

✅ Verification successful

Let me gather more context about the changes and usage patterns.


Let me try one more search with corrected file type flags:


Based on the search results, I can now provide a final response:

The removal of setIsInChatRoom prop is safe as the codebase has fully migrated to context-based state management

The codebase shows a clear pattern where:

  • The useChatRoom hook is consistently used across components to manage chat room state
  • The setChatRoom from the context is properly implemented in the components that need it
  • No remaining references to the old setIsInChatRoom prop exist in the codebase
  • The migration to context-based state management appears complete and consistent
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining usage of setIsInChatRoom to ensure complete migration
rg -l "setIsInChatRoom" --type ts --type tsx

# Search for the context implementation
ast-grep --pattern 'const { setChatRoom } = useChatRoom()'

Length of output: 375


Script:

#!/bin/bash
# Check the implementation and usage of useChatRoom hook
rg -A 5 "useChatRoom" --type ts --type tsx

# Look for any files that might be using setIsInChatRoom in a different casing
rg -i "setisinchatroom" --type ts --type tsx

# Check the ChatRoomListCard component implementation
ast-grep --pattern 'export const ChatRoomListCard = ({ $$ }: ChatRoomListCardProps) => {
  $$$
}'

Length of output: 243


Script:

#!/bin/bash
# Check the implementation and usage of useChatRoom hook
rg -A 5 "useChatRoom"

# Look for the ChatRoomListCard component implementation
rg -A 10 "ChatRoomListCard.*Props"

# Check for any remaining setIsInChatRoom references
rg -i "setisinchatroom"

Length of output: 10267

packages/components/modules/messages/graphql/queries/Room.ts (2)

1-1: LGTM!

The import statement is clean and includes only the necessary graphql tag from react-relay.


32-32: Verify MessagesListFragment import and implementation

The fragment spreads MessagesListFragment but there's no visible import. Let's verify its implementation.

✅ Verification successful

Based on the search results, I can generate the final response as we have sufficient information. The search shows that:

  1. The MessagesListFragment is properly defined in packages/components/modules/messages/graphql/queries/MessagesList.ts
  2. It's correctly imported and used across the codebase, including in the file under review
  3. The fragment is properly generated in the __generated__ directory

MessagesListFragment is properly implemented and used

The fragment is correctly defined in the codebase and its usage in Room.ts is valid. While the import might not be visible in the snippet, the fragment is properly integrated into the GraphQL schema and generated types.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find the MessagesListFragment definition and its usage
echo "Searching for MessagesListFragment definition:"
rg -l "fragment MessagesListFragment on" --type ts

echo "\nVerifying fragment usage:"
rg "...MessagesListFragment" --type ts

Length of output: 9590

packages/design-system/components/inputs/TextField/index.tsx (2)

10-10: LGTM: Clean import addition

The import statement is properly organized and necessary for the new type definitions.


23-23: Verify type compatibility and enhance documentation

While the type assertion is syntactically correct, let's ensure it's safely used across the codebase.

Run this script to verify usage patterns:

Consider enhancing the documentation comment to include:

 // exporting the TextField without the controller, it's useful when a component
 // that inherits from TextField needs to use the same controller
+// Note: PureTextField maintains all TextField props and responsive behavior
+// but skips form controller integration
✅ Verification successful

Let me gather more information about the type definitions and usage to make a more informed decision.


Let me check the type definitions to ensure type safety of this assertion.


Type assertion is safe and usage is correct

The type assertion is type-safe as PureTextField correctly inherits from the base TextField component while maintaining proper type relationships:

  • PureTextFieldProps = MUITextFieldProps & Responsive
  • TextFieldProps = MUITextFieldProps & FormControl & Responsive
  • Current usage in TextareaField styled component is correct

The existing comment adequately explains its purpose for inheritance scenarios without controller integration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for PureTextField usage and potential type mismatches

# Find all files importing PureTextField
rg -l "import.*PureTextField" 

# Check for direct usage of PureTextField
ast-grep --pattern 'PureTextField $$$'

Length of output: 199


Script:

#!/bin/bash
# Check the TextareaField implementation to understand how PureTextField is used
cat packages/design-system/components/inputs/TextareaField/styled.tsx

# Check TextField implementation and type definitions
cat packages/design-system/components/inputs/TextField/index.tsx

# Look for any PureTextFieldProps type references
rg "PureTextFieldProps"

Length of output: 2199


Script:

#!/bin/bash
# Check the type definitions
cat packages/design-system/components/inputs/TextField/types.ts

# Look for MUITextFieldProps definition usage
rg "MUITextFieldProps"

Length of output: 785

packages/components/modules/messages/MessageItem/styled.tsx (1)

18-18: LGTM! Good improvement to responsiveness

Changing from fixed width to relative width (60%) is a better approach for responsive design, ensuring the message bubbles scale appropriately with different screen sizes.

packages/components/modules/messages/ChatRoomsList/ChatRoomCard/styled.tsx (1)

1-4: LGTM! Well-organized imports.

The imports are clean and follow best practices, with proper separation of external dependencies and local types.

packages/components/modules/messages/ChatRoomsList/types.ts (2)

1-11: LGTM! Well-organized imports following best practices

The imports are properly organized and specific, showing good consideration for code organization and bundle size.


1-24: Verify feature implementation completeness

The types align well with the PR objectives, supporting infinite scrolling, customizable chat cards, and empty states. Let's verify the complete implementation.

✅ Verification successful

Let me try different commands to verify the implementation.


Let me check one more aspect to verify the complete implementation.


Based on the verification results, I can now provide a final response:

Types align with implemented features

The implementation matches the type definitions and PR objectives:

  • Virtuoso component is properly integrated with infinite scroll functionality (endReached handler, loadNext, hasNext)
  • Empty states are handled with NoMessagesIcon component (found in both types and implementation)
  • Chat tabs are implemented with active/unread/archived states
  • ChatRoomCard customization is supported through props
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of required features

# Check for infinite scroll implementation
echo "Checking infinite scroll implementation..."
rg -l "useInfiniteQuery.*chatRooms" --type ts

# Check for empty state handling
echo "Checking empty state handling..."
rg "NoMessagesIcon" --type tsx

# Check for chat room card implementation
echo "Checking chat room card features..."
ast-grep --pattern 'interface ChatRoomCardProps {
  $$$
  contactName?: $_
  lastMessage?: $_
  timestamp?: $_
  $$$
}'

Length of output: 479


Script:

#!/bin/bash
# Check for infinite scroll implementation with broader pattern
echo "Checking infinite scroll implementation..."
rg -A 5 "useInfiniteQuery" 

# Check for empty state handling (using .tsx or .ts)
echo "Checking empty state handling..."
rg "NoMessagesIcon" --type ts

# Check ChatRoomCard implementation
echo "Checking ChatRoomCard implementation..."
fd "ChatRoomCard" --type f --exec rg -l "interface ChatRoomCardProps"

# Check actual usage of Virtuoso
echo "Checking Virtuoso usage..."
rg "Virtuoso.*chatRooms" --type ts

# Check implementation of chat tabs
echo "Checking chat tabs implementation..."
rg "CHAT_TAB_VALUES" --type ts

Length of output: 2907


Script:

#!/bin/bash
# Check ChatRoomsList implementation for Virtuoso and card rendering
echo "Checking ChatRoomsList implementation..."
rg -A 10 "Virtuoso" packages/components/modules/messages/ChatRoomsList/index.tsx

# Check ChatRoomCard component structure
echo "Checking ChatRoomCard structure..."
fd ChatRoomCard.tsx --exec cat {}

# Check for infinite scroll related props/handlers
echo "Checking infinite scroll handlers..."
rg -A 5 "onEndReached|hasNextPage|fetchNextPage" packages/components/modules/messages/ChatRoomsList/

Length of output: 1896

packages/components/modules/messages/index.ts (2)

26-27: LGTM! Verify query implementations.

The query exports follow the established pattern and are appropriately placed with other GraphQL queries.

Let's verify the query implementations match the PR requirements:

✅ Verification successful

Query implementations verified and properly structured

The exported queries and their implementations are well-structured and include all necessary fields:

  • Room-related queries include:
    • Required participant information (name, image)
    • Timestamps (lastMessageTime, created)
    • Message content and metadata
    • Proper pagination setup with cursor-based connections
    • Unread message counts
  • Proper fragment composition and reusability
  • Appropriate type definitions and GraphQL directives
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Room and RoomsList queries include required fields

# Check Room query for required fields (contact name, timestamp)
rg -A 10 "query Room" packages/components/modules/messages/graphql/queries/Room.ts

# Check RoomsList query for sorting and pagination
rg -A 10 "query RoomsList" packages/components/modules/messages/graphql/queries/RoomsList.ts

# Check for timestamp/sorting fields
ast-grep --pattern 'fragment $_ on Room {
  $$$
  lastMessageAt
  $$$
}'

Length of output: 254


Script:

#!/bin/bash
# Let's try a different approach to find the query files and their content

# First, verify the files exist and get their paths
fd "Room.ts" packages/components/modules/messages/graphql/queries/

# Then check their contents
echo "=== Room.ts contents ==="
cat packages/components/modules/messages/graphql/queries/Room.ts || true

echo -e "\n=== RoomsList.ts contents ==="
cat packages/components/modules/messages/graphql/queries/RoomsList.ts || true

# Also check for any Room-related GraphQL fragments that might be used
echo -e "\n=== Looking for Room fragments ==="
fd "Room.*fragment" packages/components/modules/messages/graphql/

Length of output: 2182


Script:

#!/bin/bash
# Let's check the MessagesListFragment that's being used in RoomFragment
echo "=== MessagesListFragment contents ==="
fd "MessagesList.*" packages/components/modules/messages/graphql/ -x cat {}

# Also check if there are any query operations using these fragments
echo -e "\n=== Looking for query operations ==="
rg "query.*ChatRoom" packages/components/modules/messages/graphql/

Length of output: 2399


Script:

#!/bin/bash
# Let's check the main ChatRoomQuery that uses these fragments
echo "=== ChatRoomQuery contents ==="
cat packages/components/modules/messages/graphql/queries/ChatRoomQuery.ts

echo -e "\n=== ChatRoomsQuery contents ==="
cat packages/components/modules/messages/graphql/queries/ChatRoomsQuery.ts

Length of output: 1014


10-11: LGTM! Verify component implementation.

The exports follow the established pattern and naming conventions. The component's purpose aligns with the PR objective of implementing an active chats list.

Let's verify the component implementation:

✅ Verification successful

Component implementation verified and meets requirements

The ChatRoomsList component implementation is well-structured and includes all necessary features:

  • Handles empty state with a "No messages" placeholder
  • Implements infinite scroll using Virtuoso with proper load more functionality
  • Includes search functionality with loading states
  • Supports tab navigation (active/unread/archived)
  • Properly handles mobile responsiveness
  • Includes proper error boundaries and loading states
  • Uses proper data fetching with React Relay
  • Implements real-time updates through subscriptions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify ChatRoomsList component implementation matches requirements

# Check if the component handles empty state
ast-grep --pattern 'const ChatRoomsList = ({ $$ }: ChatRoomsListProps) => {
  $$$
}'

# Check for infinite scroll implementation
rg -A 5 "infinite.*scroll|pagination" packages/components/modules/messages/ChatRoomsList

Length of output: 177


Script:

#!/bin/bash
# Let's try a different approach to verify the component implementation

# First, check if the component file exists and see its content
fd ChatRoomsList.tsx --exec cat {} \;
fd ChatRoomsList.ts --exec cat {} \;

# If we don't find it with .tsx/.ts, let's check other extensions
if [ $? -ne 0 ]; then
    fd ChatRoomsList --exec cat {} \;
fi

# Also check for any test files to understand the component's behavior
fd ChatRoomsList.test --exec cat {} \;
fd ChatRoomsList.spec --exec cat {} \;

Length of output: 190


Script:

#!/bin/bash
# Let's try one more approach to locate and verify the component

# First, let's find the exact location of the component directory
fd -t d ChatRoomsList

# Then, let's list all files in that directory to understand its structure
fd . -t f --base-directory packages/components/modules/messages/ChatRoomsList

# Finally, let's check the contents of any index file in that directory
fd index.tsx -t f --base-directory packages/components/modules/messages/ChatRoomsList --exec cat {} \;
fd index.ts -t f --base-directory packages/components/modules/messages/ChatRoomsList --exec cat {} \;

Length of output: 16171

packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts (2)

1-9: LGTM! Imports are well organized.

The imports are properly grouped and all imported utilities are used in the implementation.


34-34: Verify the chosen date format for older messages.

Please confirm if DATE_FORMAT[2] is the most appropriate format for displaying older message dates in the chat interface.

✅ Verification successful

Let me search for the definition of DATE_FORMAT to understand the format pattern.


DATE_FORMAT[2] is the appropriate format for this context

The format 'LLL d, yyyy' (e.g., "March 15, 2024") is indeed the most suitable choice for displaying older message dates in the chat interface. This format is consistently used across the codebase for similar scenarios:

  • In the Timestamp component for non-today dates
  • In MessagesGroup for dates beyond yesterday
  • In ChatRoomCard for dates older than a few days

The format provides clear, human-readable dates that follow standard conventions for chat interfaces.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other usages of DATE_FORMAT[2] to understand the format pattern
rg "DATE_FORMAT\[2\]" -A 2 -B 2

Length of output: 1824


Script:

#!/bin/bash
# Search for DATE_FORMAT definition
rg "DATE_FORMAT\s*=|DATE_FORMAT:|const DATE_FORMAT" -A 5

Length of output: 373

packages/design-system/components/icons/index.ts (1)

17-17: LGTM! Export follows consistent patterns.

The NoMessagesIcon export is correctly added and maintains the alphabetical ordering of the barrel file.

Let's verify the NoMessagesIcon implementation:

✅ Verification successful

Export is correctly implemented and follows design system patterns

The NoMessagesIcon implementation exists at packages/design-system/components/icons/NoMessagesIcon/index.tsx and follows the established pattern:

  • Uses Material-UI's SvgIcon component
  • Implements the correct SvgIconProps interface
  • Follows the same component structure as other icons in the design system
  • Has consistent styling approach with customizable color and size via sx prop
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify NoMessagesIcon implementation exists and follows component patterns

# Check if the NoMessagesIcon implementation file exists
fd "NoMessagesIcon" --type f

# Verify the implementation follows the SvgIcon pattern
ast-grep --pattern 'const NoMessagesIcon = (props: SvgIconProps) => {
  $$$
}'

Length of output: 109


Script:

#!/bin/bash
# Let's try a different approach to verify the NoMessagesIcon implementation

# Search for NoMessagesIcon in the design system directory with ripgrep
rg "NoMessagesIcon" packages/design-system -l

# Also check the specific file that should exist based on the import
ls -l packages/design-system/components/icons/NoMessagesIcon.tsx 2>/dev/null || ls -l packages/design-system/components/icons/NoMessagesIcon.ts 2>/dev/null

# Search for any SvgIcon usage pattern in case the component name is different
rg "SvgIconProps" packages/design-system/components/icons -A 2

Length of output: 14149

packages/components/modules/messages/graphql/queries/RoomsList.ts (3)

1-5: LGTM! Well-structured imports with proper type safety.

The imports are well-organized and properly leverage TypeScript's type system through generated types.


32-36: LGTM! Well-implemented custom hook with proper type safety.

The useRoomsList hook is well-structured, leveraging React Relay's pagination capabilities while maintaining full type safety through generated types.


20-20: Verify the RoomFragment implementation.

The fragment spreads ...RoomFragment which should include essential chat room details needed for the UI (contact name, latest message, timestamp).

✅ Verification successful

RoomFragment implementation is complete and well-structured

The fragment includes all essential chat room details needed for the UI:

  • Contact information: participant names and profile images
  • Latest message: content and timestamp (lastMessageTime)
  • Room details: title, unread count, room image
  • Full messages list through ...MessagesListFragment spread
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the RoomFragment implementation contains required fields
# Expected fields: contact name, latest message, timestamp

# Search for RoomFragment definition
ast-grep --pattern 'fragment RoomFragment on ChatRoom {
  $$$
}'

Length of output: 66


Script:

#!/bin/bash
# Let's try searching for RoomFragment using ripgrep which might help locate the file containing the fragment
rg "fragment\s+RoomFragment" -A 10

Length of output: 5857

packages/components/modules/messages/CreateChatRoomList/ChatRoomListCard/index.tsx (1)

6-6: LGTM! Clean import organization

The new imports are well-organized and align with the component's requirements.

Also applies to: 11-11

packages/design-system/components/Searchbar/index.tsx (4)

25-25: LGTM! Form initialization is well implemented

The useForm hook is correctly initialized with proper typing through defaultValues.


36-38: LGTM! Reset handling is properly implemented

The reset functionality correctly handles both form state and search query reset within a transition.


40-40: LGTM! Watch implementation is clean and efficient

The direct field watching approach is more maintainable than using dynamic field names.


Line range hint 1-96: Verify search performance with large chat lists

Since this searchbar will be used with the chat list, ensure that:

  1. The debounce timing is appropriate for the expected chat list size
  2. The search performance remains smooth with the maximum expected number of chats
✅ Verification successful

Searchbar implementation has appropriate debounce handling

The search implementation uses a well-tested debounce hook with a 400ms default delay, which is a good balance between responsiveness and performance. The hook:

  • Uses lodash's debounce with trailing edge execution
  • Properly cleans up on unmount
  • Has test coverage for core functionality
  • Uses a standard delay that's commonly accepted for search inputs

Since the component:

  1. Uses proper debouncing to prevent excessive API calls
  2. Shows loading states during search
  3. Implements proper cleanup to prevent memory leaks
  4. Uses controlled inputs with proper state management

The implementation is suitable for handling chat list searches efficiently.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Look for debounce delay configuration
rg -A 1 "useDebounce.*delay|debounceTime" 

# Check for any existing performance tests
fd -e test.tsx -e spec.tsx | xargs rg "performance|debounce"

Length of output: 860


Script:

#!/bin/bash
# Let's check the useDebounce hook implementation to understand its behavior
cat packages/utils/hooks/useDebounce/index.ts

# Let's also check its tests to see the test coverage
cat packages/utils/hooks/useDebounce/__tests__/useDebounce.test.ts

# Check if there are any chat list related tests or implementations
rg -g "!*.test.*" -g "!*.spec.*" "ChatList|chat.*list" -A 5

Length of output: 1624

packages/design-system/package.json (4)

39-40: Verify React version compatibility with dependencies

React 18.3.1 is specified as an exact version in peer dependencies. This version seems unusual as the latest stable React version is 18.2.0. Please verify:

  1. If this is intentional
  2. Compatibility with other dependencies, especially @mui packages
✅ Verification successful

React 18.3.1 is a valid version and compatible with dependencies

The verification shows that:

  • React 18.3.1 exists as a valid version on npm, published 7 months ago
  • MUI's peer dependencies explicitly support React versions ^17.0.0 || ^18.0.0 || ^19.0.0, which includes React 18.3.1
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if any dependencies explicitly require different React versions
npm info react@18.3.1 2>/dev/null || echo "React 18.3.1 not found on npm"

# Check MUI's React peer dependency requirements
npm info @mui/material peerDependencies

Length of output: 1146


62-69: Review PostCSS and Tailwind configuration

Several styling-related dependencies have been updated:

  • autoprefixer: ^10.4.19
  • postcss: ^8.4.41
  • tailwindcss: ^3.4.4

Ensure that the corresponding configuration files are updated to match these versions.

✅ Verification successful

Configuration files are compatible with updated dependencies

The PostCSS and Tailwind configuration files in the design-system package are using standard configuration patterns that are compatible with the updated versions. The PostCSS config uses the basic plugin setup that works across versions, and the Tailwind config follows the current schema with no deprecated features.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for PostCSS and Tailwind config files
fd -e js -e cjs -e mjs -e ts "postcss.config|tailwind.config"

Length of output: 294


Script:

#!/bin/bash
# Check the content of PostCSS and Tailwind config files in design-system package
echo "=== packages/design-system/postcss.config.js ==="
cat packages/design-system/postcss.config.js
echo -e "\n=== packages/design-system/tailwind.config.js ==="
cat packages/design-system/tailwind.config.js

Length of output: 2973


49-57: Ensure Storybook packages are in sync

All Storybook packages have been updated to version ^8.2.8, which is good for consistency. However, this is a major version upgrade that might require migration steps.

✅ Verification successful

Let me run another script to check for the Storybook configuration files and their content, as the previous search didn't reveal any deprecated patterns.


Let me try one more search focusing on the stories format and imports to ensure compatibility with Storybook 8.


Based on the analysis of the story files, I can now provide a final response:

Storybook 8 upgrade is compatible with current codebase

The codebase is already using the modern Component Story Format (CSF) with TypeScript, and all stories are using the recommended Meta and StoryObj types from @storybook/react. No deprecated patterns like storiesOf, addDecorator, or addParameters were found. The stories are following Storybook 8 best practices with proper typing and metadata exports.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for breaking changes in Storybook 8
rg -l "storybook" . | while read -r file; do
  if [[ -f "$file" ]]; then
    echo "=== $file ==="
    # Look for potentially affected patterns
    rg -A 2 "storiesOf|addDecorator|addParameters|configure" "$file" || true
  fi
done

Length of output: 22440


Script:

#!/bin/bash
# Check Storybook configuration files
echo "=== Searching for .storybook configuration files ==="
fd -t f -p ".*\.storybook.*\.(js|ts|jsx|tsx|cjs|mjs)$"

echo -e "\n=== Checking content of main configuration files ==="
for file in $(fd -t f -p ".*\.storybook/main\.(js|ts|jsx|tsx|cjs|mjs)$"); do
  echo -e "\n--- $file ---"
  cat "$file"
done

echo -e "\n=== Checking content of preview files ==="
for file in $(fd -t f -p ".*\.storybook/preview\.(js|ts|jsx|tsx|cjs|mjs)$"); do
  echo -e "\n--- $file ---"
  cat "$file"
done

Length of output: 516


Script:

#!/bin/bash
# Check story files format and imports
echo "=== Checking story files format ==="
fd -e tsx -e ts -e jsx -e js --full-path "stories\." | while read -r file; do
  echo -e "\n=== $file ==="
  head -n 10 "$file"  # Show first 10 lines to check imports and story format
done

echo -e "\n=== Checking for CSF format ==="
rg "export default \{" -A 2 "stories\."

echo -e "\n=== Checking for meta exports ==="
rg "export const meta" -A 2 "stories\."

Length of output: 24128


21-26: Ensure MUI package versions are in sync

All MUI packages should be kept at the same version to avoid compatibility issues. Currently using:

  • @mui/icons-material: ^5.15.19
  • @mui/material: ^5.15.19
  • @mui/lab: ^5.0.0-alpha.170
  • @mui/system: ^5.15.19

The alpha version of @mui/lab might cause stability issues.

packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx (2)

1-15: LGTM! Well-organized imports following best practices.

The imports are logically grouped and properly typed, making good use of the design system components.


1-100: Verify integration with parent components and GraphQL schema.

The component implementation looks solid, but let's verify the integration points.

✅ Verification successful

Integration verified and properly implemented

The component is correctly integrated within the codebase:

  • Properly imported and used in ChatRoomsList/index.tsx
  • GraphQL fragment (RoomFragment) correctly defines all required fields including unreadMessagesCount, image, lastMessageTime, and lastMessage
  • Type definitions are properly shared between the component and its parent
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify component integration and GraphQL schema compatibility

# Check for proper import in parent components
rg -l "ChatRoomCard" --type tsx

# Verify GraphQL fragment fields usage
ast-grep --pattern 'const RoomFragment = graphql`
  $$$
  fragment Room_$_ on Room {
    $$$
    unreadMessagesCount
    $$$
  }
`'

Length of output: 193


Script:

#!/bin/bash
# Let's try with different commands to verify the integration

# Check for proper import in parent components (using just .ts and .tsx extensions)
rg -l "ChatRoomCard"

# Verify GraphQL fragment definition
rg -A 10 "RoomFragment = graphql"

# Check where the component is being used
rg "from.*ChatRoomCard"

Length of output: 1468

packages/components/modules/messages/CreateChatRoomList/index.tsx (1)

Line range hint 87-94: Fix TypeScript typing issues in Searchbar component

The @ts-ignore comment with TODO indicates unresolved typing issues that should be addressed.

Let's verify the Searchbar component's props:

packages/components/CHANGELOG.md (1)

9-10: Verify the design system dependency update.

Please ensure that the upgrade to @baseapp-frontend/design-system@0.0.20 is intentional and required for the Active Chats tab implementation.

Run the following script to check the changes in the design system package:

✅ Verification successful

Let me check the usage of the new design system components in the codebase.


Let me check the actual implementation to see how these components are used.


Design system dependency update is necessary and correctly used

The upgrade to @baseapp-frontend/design-system@0.0.20 is justified as the new components (Searchbar and NoMessagesIcon) introduced in this version are actively used in the messages module implementation, specifically in:

  • ChatRoomsList component for displaying empty states and search functionality
  • CreateChatRoomList component for search functionality
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the changelog of the design system package for version 0.0.20

# Look for the design system's changelog
fd -t f "CHANGELOG.md" | xargs rg -A 10 "0.0.20"

Length of output: 1676


Script:

#!/bin/bash
# Check for usage of new components from design-system v0.0.20
rg -l "Searchbar|NoMessagesIcon" packages/components/

# Check for any PureTextFieldProps type usage
rg "PureTextFieldProps" packages/components/

Length of output: 419


Script:

#!/bin/bash
# Check the implementation details of files using the new components
rg -A 5 "Searchbar|NoMessagesIcon" packages/components/modules/messages/ChatRoomsList/index.tsx packages/components/modules/messages/CreateChatRoomList/index.tsx

Length of output: 6396

packages/components/modules/messages/MessagesGroup/index.tsx (2)

103-107: LGTM! Outer Box width ensures proper container scaling.

The addition of width: '100%' to the outer Box component ensures proper scaling within its container, which aligns with the responsive design requirements.


109-109: Verify responsive behavior across different screen sizes.

The width changes to the inner Box component look good and should help with proper message scaling. However, since this PR emphasizes responsive design, let's verify the behavior.

Let's check for any potential responsive design issues in the codebase:

Also applies to: 128-128

✅ Verification successful

The width changes appear safe with existing responsive design patterns

Based on the codebase analysis, the component is part of a well-structured responsive system:

  • The messages module uses consistent breakpoint patterns (theme.breakpoints.down())
  • Related components like MessageItem already handle responsive widths (60% to 80% on small screens)
  • The parent ChatRoom component has responsive layout handling
  • The width: '100%' property is a safe choice as it allows the component to adapt to its container
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Look for responsive design patterns and potential issues

# Check for responsive-related props and styles
rg -A 2 "width:|maxWidth:|minWidth:|flex:|@media" packages/components/modules/messages/

# Look for existing responsive design tests
rg -A 5 "screen|viewport|resize|responsive" --type=test

Length of output: 6214


Script:

#!/bin/bash
# Let's check for responsive design tests and breakpoints more comprehensively

# Look for test files with responsive-related terms
fd -e test.tsx -e test.ts -e spec.tsx -e spec.ts | xargs rg -l "screen|viewport|resize|responsive"

# Check for breakpoint usage in the messages module
rg -A 2 "breakpoints\." packages/components/modules/messages/

# Check for media query patterns
rg -A 2 "@media" packages/components/modules/messages/

# Look for responsive utilities or hooks
rg -l "useMediaQuery|useResponsive|useBreakpoint" packages/components/

Length of output: 2832


Script:

#!/bin/bash
# Let's examine the specific responsive implementation in the MessagesGroup component and its related components

# Check MessagesGroup's responsive implementation
rg -A 5 "useMediaQuery" packages/components/modules/messages/ChatRoomsList/index.tsx

# Look at the Box component's width usage in MessagesGroup
ast-grep --pattern 'sx={{ $$$width$$$, $$$}}'  packages/components/modules/messages/MessagesGroup/index.tsx

# Check for any existing responsive styles in the component
rg -A 3 "theme\.breakpoints" packages/components/modules/messages/MessagesGroup/

Length of output: 276

packages/design-system/CHANGELOG.md (1)

7-9: LGTM - Changes align with PR objectives

The new components and icons align well with the chat UI implementation requirements:

  • NoMessagesIcon supports the "no messages" display requirement
  • Searchbar component could enhance chat list functionality
  • PureTextFieldProps type export improves component reusability
packages/components/package.json (3)

4-4: Version bump needs changelog verification.

The version bump from 0.0.18 to 0.0.19 should align with the changes described in the PR objectives for the active chats tab implementation.

✅ Verification successful

Version bump is properly documented in the changelog

The version bump from 0.0.18 to 0.0.19 is correctly documented in the CHANGELOG.md with appropriate entries describing the changes related to active chats tab implementation and message item styling improvements.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if version bump is documented in changelog
fd -t f "CHANGELOG.md" | xargs rg "0\.0\.19"

Length of output: 209


Script:

#!/bin/bash
# Check the content of the version entry in the changelog
rg -A 10 "^## 0\.0\.19" packages/components/CHANGELOG.md

Length of output: 292


48-49: Verify React 18.3.1 compatibility with other dependencies.

The peer dependencies specify React 18.3.1, which is a very recent version. This needs verification with other major dependencies like MUI and react-relay.


24-41: Review dependency version constraints and compatibility.

Several critical observations about the production dependencies:

  1. The mix of ^ (caret) version ranges could lead to unexpected updates. Consider using exact versions for critical dependencies.
  2. Some version combinations need verification:
    • react-relay@16.2.0 with relay-runtime@16.2.0
    • @mui/* packages should maintain version alignment
    • next@14.3.0-canary.24 is a pre-release version
packages/components/schema.graphql (1)

82-83: Breaking Change: Verify client-side handling of updated ChatRoom.image field

The changes look good and follow GraphQL best practices for image handling. However, the modification of the image field signature from String to File with required width/height parameters is a breaking change that requires client-side updates.

Let's verify the impact on client-side queries:

✅ Verification successful

Based on the analysis of the GraphQL queries and fragments, I can now generate the final response:

Breaking change confirmed but client code is already updated

The change to the image field in ChatRoom type is indeed a breaking change, but all client-side queries have already been updated to include the required width and height parameters:

  • ChatRoomQuery: uses image(width: 100, height: 100)
  • RoomFragment (referenced in queries): uses image(width: 100, height: 100)
  • MessagesListFragment: uses image(height: 32, width: 32)

The client code is fully compatible with the schema changes, making this a safe transition.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find GraphQL queries that need to be updated for the new image field signature

# Search for queries using the old ChatRoom.image field
rg -l "ChatRoom.*{.*\n.*image\s*[^(]" --type ts --type tsx

# Search for fragments using the old ChatRoom.image field
rg -l "fragment.*ChatRoom.*{.*\n.*image\s*[^(]" --type ts --type tsx

Length of output: 397


Script:

#!/bin/bash
# Search for ChatRoom queries and fragments using image field
rg -U "(?s)(query|fragment).*?ChatRoom.*?\{.*?image" --type ts --type tsx

# Search for direct usage of ChatRoom.image
rg "ChatRoom.*image" --type ts --type tsx

# Look for any GraphQL operations involving image field
ast-grep --pattern 'gql`
  $$$
  ChatRoom {
    $$$
    image
    $$$
  }
  $$$
`'

Length of output: 260


Script:

#!/bin/bash
# Search for any files containing GraphQL queries/fragments
fd -e ts -e js -e tsx -e jsx -x rg -l "gql|graphql|fragment.*on ChatRoom|query.*\{.*ChatRoom" {}

# Then search for image field usage in those files
fd -e ts -e js -e tsx -e jsx -x rg -l "ChatRoom.*\{[^}]*image[^}]*\}" {}

# Look for any direct references to ChatRoom type
fd -e ts -e js -e tsx -e jsx -x rg -l "ChatRoom" {}

Length of output: 11110


Script:

#!/bin/bash
# Check the content of generated GraphQL files that use ChatRoom.image
cat ./packages/components/__generated__/ChatRoomQuery.graphql.ts
cat ./packages/components/__generated__/ChatRoomsQuery.graphql.ts
cat ./packages/components/__generated__/chatRoomsPaginationQuery.graphql.ts

# Check the actual GraphQL queries that generate these files
cat ./packages/components/modules/messages/graphql/queries/ChatRoomQuery.ts
cat ./packages/components/modules/messages/graphql/queries/ChatRoomsQuery.ts

Length of output: 56989


Script:

#!/bin/bash
# Check the fragments that are used in the queries
cat ./packages/components/modules/messages/graphql/queries/RoomFragment.ts
cat ./packages/components/modules/messages/graphql/queries/RoomsList.ts
cat ./packages/components/modules/messages/graphql/queries/MessagesList.ts

Length of output: 2153

packages/design-system/components/icons/NoMessagesIcon/index.tsx (2)

1-5: LGTM! Well-structured component declaration.

The component follows React and Material-UI best practices with proper TypeScript typing and prop handling.


110-110: LGTM! Appropriate export pattern.

The default export is suitable for this single-component file.

Comment on lines +13 to +22
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider improving type safety and documentation

  1. The VirtuosoProps generic type parameters should be properly typed instead of using any
  2. The targetRef prop name could be more descriptive (e.g., chatRoomsData)
  3. Missing JSDoc documentation for the interface and its properties

Consider applying these improvements:

+/**
+ * Props for the ChatRoomsList component
+ */
 export interface ChatRoomsListProps {
-  targetRef: ChatRoomsQuery$data
+  /** The chat rooms data from GraphQL query */
+  chatRoomsData: ChatRoomsQuery$data
   Searchbar?: FC<SearchbarProps>
   SearchbarProps?: Partial<SearchbarProps>
   ChatRoomCard?: FC<ChatRoomCardProps>
   ChatRoomCardProps?: Partial<ChatRoomCardProps>
   NoMessagesIcon?: FC<SvgIconProps>
   NoMessagesIconProps?: Partial<SvgIconProps>
-  VirtuosoProps?: Partial<VirtuosoProps<any, any>>
+  VirtuosoProps?: Partial<VirtuosoProps<ChatRoomsQuery$data['chatRooms'], unknown>>
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export interface ChatRoomsListProps {
targetRef: ChatRoomsQuery$data
Searchbar?: FC<SearchbarProps>
SearchbarProps?: Partial<SearchbarProps>
ChatRoomCard?: FC<ChatRoomCardProps>
ChatRoomCardProps?: Partial<ChatRoomCardProps>
NoMessagesIcon?: FC<SvgIconProps>
NoMessagesIconProps?: Partial<SvgIconProps>
VirtuosoProps?: Partial<VirtuosoProps<any, any>>
}
/**
* Props for the ChatRoomsList component
*/
export interface ChatRoomsListProps {
/** The chat rooms data from GraphQL query */
chatRoomsData: ChatRoomsQuery$data
Searchbar?: FC<SearchbarProps>
SearchbarProps?: Partial<SearchbarProps>
ChatRoomCard?: FC<ChatRoomCardProps>
ChatRoomCardProps?: Partial<ChatRoomCardProps>
NoMessagesIcon?: FC<SvgIconProps>
NoMessagesIconProps?: Partial<SvgIconProps>
VirtuosoProps?: Partial<VirtuosoProps<ChatRoomsQuery$data['chatRooms'], unknown>>
}

Comment on lines +20 to +32
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Optimize the time difference calculations.

The current implementation has some repetitive patterns that could be simplified:

  1. Repeated Math.abs() calls
  2. Similar plural handling logic
  3. Unnecessary toFixed(0) for integer values
 const diff = dateTime.diffNow(['years', 'months', 'weeks', 'days']).toObject()
+const getTimeAgo = (value: number, unit: string) => {
+  const absValue = Math.abs(value)
+  return absValue === 1 ? `1 ${unit} ago` : `${absValue} ${unit}s ago`
+}

-  if (diff.months && Math.abs(diff.months) > 0) {
-    if (Math.abs(diff.months) > 1) return `${Math.abs(diff.months).toFixed(0)} months ago`
-    return '1 month ago'
+  if (diff.months && Math.abs(diff.months) > 0) {
+    return getTimeAgo(diff.months, 'month')
   }

-  if (diff.weeks && Math.abs(diff.weeks) > 0) {
-    if (Math.abs(diff.weeks) > 1) return `${Math.abs(diff.weeks).toFixed(0)} weeks ago`
-    return '1 week ago'
+  if (diff.weeks && Math.abs(diff.weeks) > 0) {
+    return getTimeAgo(diff.weeks, 'week')
   }

-  if (diff.days && Math.abs(diff.days) > 0) return `${Math.abs(diff.days).toFixed(0)} days ago`
+  if (diff.days && Math.abs(diff.days) > 0) {
+    return getTimeAgo(diff.days, 'day')
+  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const diff = dateTime.diffNow(['years', 'months', 'weeks', 'days']).toObject()
if (diff.months && Math.abs(diff.months) > 0) {
if (Math.abs(diff.months) > 1) return `${Math.abs(diff.months).toFixed(0)} months ago`
return '1 month ago'
}
if (diff.weeks && Math.abs(diff.weeks) > 0) {
if (Math.abs(diff.weeks) > 1) return `${Math.abs(diff.weeks).toFixed(0)} weeks ago`
return '1 week ago'
}
if (diff.days && Math.abs(diff.days) > 0) return `${Math.abs(diff.days).toFixed(0)} days ago`
const diff = dateTime.diffNow(['years', 'months', 'weeks', 'days']).toObject()
const getTimeAgo = (value: number, unit: string) => {
const absValue = Math.abs(value)
return absValue === 1 ? `1 ${unit} ago` : `${absValue} ${unit}s ago`
}
if (diff.months && Math.abs(diff.months) > 0) {
return getTimeAgo(diff.months, 'month')
}
if (diff.weeks && Math.abs(diff.weeks) > 0) {
return getTimeAgo(diff.weeks, 'week')
}
if (diff.days && Math.abs(diff.days) > 0) {
return getTimeAgo(diff.days, 'day')
}

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add null check for urlPath

The current implementation might break if urlPath is null. Consider adding a null check:

-{joinWithSeparator(['@', urlPath?.path], { separator: '' })}
+{urlPath?.path ? joinWithSeparator(['@', urlPath.path], { separator: '' }) : '@'}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{joinWithSeparator(['@', urlPath?.path], { separator: '' })}
{urlPath?.path ? joinWithSeparator(['@', urlPath.path], { separator: '' }) : '@'}

Comment on lines +49 to 52
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling and type safety to mutation handler

The mutation completion handler lacks error handling and type checking.

 onCompleted: (data) => {
+  const roomId = data?.chatRoomCreate?.room?.node?.id
+  if (!roomId) {
+    console.error('Failed to create chat room: Invalid response')
+    return
+  }
-  setChatRoom({ id: data?.chatRoomCreate?.room?.node?.id })
+  setChatRoom({ id: roomId })
   setIsInExistingChatRoomsView(true)
 },
+onError: (error) => {
+  console.error('Failed to create chat room:', error)
+},
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onCompleted: (data) => {
setChatRoom({ id: data?.chatRoomCreate?.room?.node?.id })
setIsInExistingChatRoomsView(true)
},
onCompleted: (data) => {
const roomId = data?.chatRoomCreate?.room?.node?.id
if (!roomId) {
console.error('Failed to create chat room: Invalid response')
return
}
setChatRoom({ id: roomId })
setIsInExistingChatRoomsView(true)
},
onError: (error) => {
console.error('Failed to create chat room:', error)
},

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Avoid using canary versions in production dependencies

The Next.js version 14.3.0-canary.24 is a pre-release version that may contain unstable features or breaking changes. Consider using a stable version instead.

-    "next": "14.3.0-canary.24",
+    "next": "14.0.4",

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +65 to +66
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Include all relevant dependencies in the useMemo dependency array

Currently, the useMemo dependency array includes only nodeId. Since currentProfileId is used within the memoized value (specifically in variables.profileId), it should be added to the dependency array to ensure that config updates when currentProfileId changes.

Apply this diff to include currentProfileId in the dependency array:

     }),
-    [nodeId],
+    [nodeId, currentProfileId],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[nodeId],
)
[nodeId, currentProfileId],
)

Comment on lines +54 to +55
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Avoid using any; specify the correct type for room parameter

Using any defeats TypeScript's type safety. Replace any with the appropriate type for room to enhance type checking and code readability.

Apply this diff:

- const renderChatCard = useCallback(
-   (room: any) => {
+ const renderChatCard = useCallback(
+   (room: RoomType) => {

Ensure that RoomType is correctly imported or defined.

Committable suggestion skipped: line range outside the PR's diff.

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Check for undefined data.id and profile.id before subscribing

data?.id and profile?.id might be undefined, which could cause runtime errors. Ensure they are defined before calling useRoomListSubscription.

Apply this diff:

- useRoomListSubscription(data?.id as string, profile?.id as string)
+ if (data?.id && profile?.id) {
+   useRoomListSubscription(data.id, profile.id)
+ }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useRoomListSubscription(data?.id as string, profile?.id as string)
if (data?.id && profile?.id) {
useRoomListSubscription(data.id, profile.id)
}

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Resolve TypeScript types instead of using @ts-ignore

Using @ts-ignore suppresses TypeScript errors and can hide potential issues. It's better to fix the typing problem with the Searchbar component.

Apply this diff to fix the issue:

- {/* @ts-ignore TODO: Check typing */}

Consider updating the types for Searchbar so that TypeScript properly recognizes it.

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +41 to +43
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Type newTab parameter as ChatTabValues to eliminate type assertions

By typing newTab as ChatTabValues, you can avoid unnecessary type casting when updating the tab state.

Apply this diff:

- const handleChange = (event: React.SyntheticEvent, newTab: string) => {
-   setTab(newTab as ChatTabValues)
+ const handleChange = (event: React.SyntheticEvent, newTab: ChatTabValues) => {
+   setTab(newTab)
  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleChange = (event: React.SyntheticEvent, newTab: string) => {
setTab(newTab as ChatTabValues)
}
const handleChange = (event: React.SyntheticEvent, newTab: ChatTabValues) => {
setTab(newTab)
}

@anicioalexandre anicioalexandre force-pushed the BA-1733-FE-Active-chats-tab branch from 7ac4db8 to ad97e7e Compare November 26, 2024 19:32
Copy link

@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

🧹 Outside diff range and nitpick comments (3)
packages/components/CHANGELOG.md (2)

8-8: Fix grammar in changelog entry

The sentence has incorrect verb agreement.

- Tweaks on `MessageItem` styles so it have the correct `max-width`.
+ Tweaks on `MessageItem` styles so it has the correct `max-width`.
🧰 Tools
🪛 LanguageTool

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)


7-8: Consider adding more detailed changelog entries

The current entries could better reflect the full scope of changes described in the PR objectives, including:

  • Implementation of chat list with infinite scrolling
  • Chat room display functionality
  • Message sending capabilities

Consider expanding the changelog entry to something like:

- Add Active Tab functionality to the `messages` module.
+ Add Active Tab functionality to the `messages` module:
+   - Implement chat list with infinite scrolling
+   - Add chat room display with contact information
+   - Enable message sending in active chats
🧰 Tools
🪛 LanguageTool

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

packages/components/package.json (1)

38-38: Maintain consistency in dependency versioning

Some dependencies still use catalog references (e.g., relay-runtime, babel-plugin-relay) while related packages have been updated to specific versions. Consider updating these for consistency:

  • relay-runtime (line 38) should match react-relay's version
  • GraphQL-related dev dependencies should be aligned with the main GraphQL version

Also applies to: 81-87

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7ac4db80eb17d6bd1ecf09efa62f5bda07b55528 and ad97e7ec9114d533c2d35f61df0df3517286dfc4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts (1 hunks)
  • packages/components/package.json (5 hunks)
  • packages/design-system/CHANGELOG.md (1 hunks)
  • packages/design-system/package.json (2 hunks)
  • packages/wagtail/CHANGELOG.md (1 hunks)
  • packages/wagtail/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts
  • packages/design-system/CHANGELOG.md
  • packages/wagtail/CHANGELOG.md
  • packages/wagtail/package.json
🧰 Additional context used
🪛 LanguageTool
packages/components/CHANGELOG.md

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

🔇 Additional comments (6)
packages/design-system/package.json (2)

4-4: LGTM: Version bump is appropriate

The version increment from 0.0.19 to 0.0.20 aligns with the added features mentioned in the changelog.


43-70: LGTM: Dev dependencies are well-maintained

The development dependencies are using stable versions and maintain consistency across related packages (e.g., all Storybook packages at 8.2.8).

packages/components/CHANGELOG.md (1)

3-10: LGTM! Version entry is well-structured and appropriate.

The version bump and changes are well-documented and align with the PR objectives for implementing the active chats tab functionality.

🧰 Tools
🪛 LanguageTool

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

packages/components/package.json (3)

4-4: LGTM: Version bump and script update

Version bump and migration to pnpm for the relay-update-schema script look good. This maintains consistency with the package manager.

Also applies to: 13-13


12-12: Environment variable configuration still missing in CI/CD

The previous review comment about missing NEXT_PUBLIC_RELAY_ENDPOINT configuration in CI/CD workflows is still valid.


24-41: Verify compatibility of dependency versions

While updating from catalog references to specific versions is good for reproducibility, please ensure:

  1. The specified versions are compatible with each other
  2. No known vulnerabilities exist in these versions

Let's check for any known vulnerabilities in the specified versions:

✅ Verification successful

The previous results showed that Next.js version 14.3.0-canary.24 might have vulnerabilities based on the patterns from earlier versions. We need to verify the actual package dependencies and their relationships since we couldn't access node_modules (as expected in a sandbox). This new script will help us analyze the dependencies directly from package.json files and any potential security audit information.


Dependencies have been updated with compatible versions

Based on the analysis of package.json files across the monorepo:

  1. The Next.js version 14.3.0-canary.24 is newer than the versions with known vulnerabilities (last vulnerability was in 14.2.10)
  2. All MUI packages (@mui/material, @mui/system, @mui/lab) are using the same version series (5.15.19)
  3. React peer dependency is explicitly set to 18.3.1, which is compatible with all the updated dependencies
  4. The dependencies that were moved from catalog references to specific versions are using stable releases

The mixed use of catalog references and specific versions is intentional, as seen in other packages in the monorepo, where some dependencies are managed through a central catalog while others are explicitly versioned.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for known vulnerabilities in key dependencies
gh api graphql -f query='
{
  securityVulnerabilities(first: 10, ecosystem: NPM, package: "next") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}
'

# Check for compatibility between React and MUI versions
rg "peerDependencies.*react" -A 5 "node_modules/@mui/**/package.json"

Length of output: 2689


Script:

#!/bin/bash
# Let's check package versions and dependencies directly from package.json files
# First, find all package.json files
fd package.json --type f --exec sh -c 'echo "=== $1 ==="; cat "$1"' sh {} \;

# Additionally, let's check for any npm audit reports
npm audit --json || true

Length of output: 25943

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Avoid using alpha versions in production dependencies

The MUI Lab package version 5.0.0-alpha.170 is a pre-release version that may contain unstable features or breaking changes. Consider using a stable version instead.

-    "@mui/lab": "^5.0.0-alpha.170",
+    "@mui/lab": "^5.15.19",

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines 39 to 40
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using a more conservative React version range

React 18.3.1 is a very recent version. To improve compatibility with other packages, consider using a more conservative version range:

-    "react": "18.3.1",
-    "react-dom": "18.3.1"
+    "react": "^18.2.0",
+    "react-dom": "^18.2.0"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"react": "18.3.1",
"react-dom": "18.3.1"
"react": "^18.2.0",
"react-dom": "^18.2.0"

@anicioalexandre anicioalexandre force-pushed the BA-1733-FE-Active-chats-tab branch from ad97e7e to 6ebe5cf Compare November 26, 2024 19:42
Copy link

@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)
packages/components/CHANGELOG.md (2)

7-7: Consider adding more details about the Active Tab functionality.

The changelog entry could be more descriptive about the Active Tab feature. Consider expanding it to include key functionality such as:

  • Chat list with infinite scrolling
  • Sorting by recent activity
  • Empty states handling
-Add Active Tab functionality to the `messages` module.
+Add Active Tab functionality to the `messages` module:
+- Display list of active chats with infinite scrolling
+- Sort chats by most recent activity
+- Show empty states for no chats/messages

8-8: Fix grammar and add context for the style change.

There's a grammar issue, and the max-width change could benefit from more context about its purpose.

-Tweaks on `MessageItem` styles so it have the correct `max-width`.
+Adjust `MessageItem` styles to ensure it has the correct `max-width` for responsive layouts.
🧰 Tools
🪛 LanguageTool

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ad97e7ec9114d533c2d35f61df0df3517286dfc4 and 6ebe5cff087e006ea47c1dca54dc2d9801e26d6e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts (1 hunks)
  • packages/components/package.json (4 hunks)
  • packages/design-system/CHANGELOG.md (1 hunks)
  • packages/design-system/package.json (1 hunks)
  • packages/wagtail/CHANGELOG.md (1 hunks)
  • packages/wagtail/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts
  • packages/components/package.json
  • packages/design-system/CHANGELOG.md
  • packages/design-system/package.json
  • packages/wagtail/CHANGELOG.md
  • packages/wagtail/package.json
🧰 Additional context used
🪛 LanguageTool
packages/components/CHANGELOG.md

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

🔇 Additional comments (1)
packages/components/CHANGELOG.md (1)

9-10: LGTM: Dependency update is properly documented.

The dependency update is clearly documented with the specific version bump.

@anicioalexandre anicioalexandre force-pushed the BA-1733-FE-Active-chats-tab branch from 6ebe5cf to 67ccab3 Compare November 26, 2024 19:48
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
7.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@anicioalexandre anicioalexandre merged commit dab4645 into master Nov 26, 2024
6 of 8 checks passed
Copy link

@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)
packages/components/CHANGELOG.md (1)

8-8: Fix grammar in the changelog entry.

There's a grammatical error in the sentence.

- Tweaks on `MessageItem` styles so it have the correct `max-width`.
+ Tweaks on `MessageItem` styles so it has the correct `max-width`.
🧰 Tools
🪛 LanguageTool

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6ebe5cff087e006ea47c1dca54dc2d9801e26d6e and 67ccab3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts (1 hunks)
  • packages/components/package.json (4 hunks)
  • packages/design-system/CHANGELOG.md (1 hunks)
  • packages/design-system/package.json (1 hunks)
  • packages/wagtail/CHANGELOG.md (1 hunks)
  • packages/wagtail/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/index.tsx
  • packages/components/modules/messages/ChatRoomsList/ChatRoomCard/utils.ts
  • packages/components/package.json
  • packages/design-system/CHANGELOG.md
  • packages/design-system/package.json
  • packages/wagtail/CHANGELOG.md
  • packages/wagtail/package.json
🧰 Additional context used
🪛 LanguageTool
packages/components/CHANGELOG.md

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

🔇 Additional comments (1)
packages/components/CHANGELOG.md (1)

3-10: LGTM! Changelog entries accurately reflect the PR changes.

The version bump and changelog entries appropriately document the implementation of the active chats tab functionality, style fixes, and dependency updates.

🧰 Tools
🪛 LanguageTool

[grammar] ~8-~8: After ‘it’, use the third-person verb form “has”.
Context: ... - Tweaks on MessageItem styles so it have the correct max-width. - Updated depe...

(IT_VBZ)

@anicioalexandre anicioalexandre deleted the BA-1733-FE-Active-chats-tab branch November 26, 2024 19:50
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