Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BA-2226 Three dot menu cleanup #210

Merged
merged 2 commits into from
Feb 12, 2025
Merged

Conversation

tsl-ps2
Copy link
Collaborator

@tsl-ps2 tsl-ps2 commented Feb 6, 2025

Acceptance Criteria

  • Given I am in an 1 on 1 Chat Room (which is a chat room that is not a group chat), when I open the 3 Dot menu, then I should not see the following options:

    • Leave Group

    • Group Details

  • Given I am on any type of Chat room (1 on 1 or Group chat), when I click an option on the3 Dot menu then the menu should disappear.

  • Implement the Archive behavior on the Archive Chat option in the 3 Dot Menu

Current behavior
Loom: https://www.loom.com/share/64f71a85d88f46c69e3a79eed133efe0

Approvd
https://app.approvd.io/silverlogic/BA/stories/38916

Summary by CodeRabbit

  • New Features

    • Introduced enhanced chat room archiving functionality. Users can now archive or unarchive chat rooms directly from the chat room header with clear visual feedback.
    • The options menu has been updated to dynamically reflect the room's current state, including a disabled indicator during in-progress actions.
    • Enhanced group chat controls now provide refined options for managing group details, ensuring a more seamless and intuitive user experience.
    • Added a new field to display whether a chat room is archived, improving user awareness of chat room status.
  • Bug Fixes

    • Improved error handling during chat room archiving to ensure a smoother user experience.

Copy link

changeset-bot bot commented Feb 6, 2025

⚠️ No Changeset found

Latest commit: 1530cd5

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

Copy link

coderabbitai bot commented Feb 6, 2025

Walkthrough

The pull request enhances the chat room archiving functionality by adding an isArchived field to GraphQL queries and mutations. The useArchiveChatRoomMutation hook is updated to improve error handling and store management. Components related to the chat room header, options, and list are modified to accommodate the new archive state, while connection update logic is removed from the chat room item component.

Changes

File(s) Change Summary
packages/.../graphql/mutations/ArchiveChatRoom.ts
packages/.../graphql/queries/ChatRoomQuery.ts
• Added isArchived field to the mutation response and query selection set.
• Updated the useArchiveChatRoomMutation hook with new error handling and updater logic.
packages/.../ChatRoom/ChatRoomHeader/ChatRoomOptions/index.tsx
packages/.../ChatRoom/ChatRoomHeader/ChatRoomOptions/types.ts
• Extended the ChatRoomOptions component and its props interface with isArchived, isArchiveMutationInFlight, and isGroup.
• Adjusted rendering logic for archive-related menu items.
packages/.../ChatRoom/ChatRoomHeader/index.tsx
packages/.../ChatRoom/ChatRoomHeader/types.ts
• Integrated the useArchiveChatRoomMutation hook and added the toggleArchiveChatroom function.
• Introduced the isArchived prop and simplified group determination logic.
packages/.../ChatRoom/index.tsx • Passed the new boolean isArchived prop to the ChatRoomHeader derived from the query data.
packages/.../ChatRoomsList/ChatRoomItem/index.tsx • Removed the updater function and eliminated unused imports (ConnectionHandler, getChatRoomConnections), simplifying connection store management.
packages/components/CHANGELOG.md • Updated version to 1.0.5 and documented changes related to chat header options.
packages/components/package.json • Updated version from "1.0.4" to "1.0.5".

Possibly related PRs

Suggested reviewers

  • Ronan-Fernandes
  • anicioalexandre
  • pt-tsl

Poem

In a burrow of code where changes reside,
I hop with joy as new features abide.
Archiving made clearer with a twist in the flow,
Each chat room update now clearly on show.
With a twitch of my nose and code running bright,
I celebrate changes—hoping all bugs take flight!
🐰💻

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/common/graphql/queries/ChatRoomQuery.ts

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-with-restricted-paths.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)
packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/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-with-restricted-paths.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)
packages/components/modules/messages/common/graphql/mutations/ArchiveChatRoom.ts

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-with-restricted-paths.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)
  • 5 others
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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 comments (1)
packages/components/modules/messages/ChatRoomsList/ChatRoomItem/index.tsx (1)

83-95: Maintain consistent error handling across components.

Apply the same error handling pattern used in ChatRoomHeader for consistency.

-            if (currentProfile?.id) {
-              commit({
-                variables: {
-                  input: {
-                    roomId: roomRef.id,
-                    profileId: currentProfile.id,
-                    archive: !isInArchivedTab,
-                  },
-                },
-              })
+            if (!currentProfile?.id) {
+              sendToast('Unable to archive chat room. Please try again.', { type: 'error' })
+              return
             }
+            commit({
+              variables: {
+                input: {
+                  roomId: roomRef.id,
+                  profileId: currentProfile.id,
+                  archive: !isInArchivedTab,
+                },
+              },
+              onCompleted: () => {
+                sendToast(`Chat room ${!isInArchivedTab ? 'archived' : 'unarchived'} successfully`, {
+                  type: 'success',
+                })
+              },
+            })
🧹 Nitpick comments (2)
packages/components/modules/messages/ChatRoom/index.tsx (1)

46-46: Consider using explicit Boolean conversion.

Instead of using double negation (!!), consider using Boolean(chatRoom.isArchived) for better readability.

-        isArchived={!!chatRoom.isArchived}
+        isArchived={Boolean(chatRoom.isArchived)}
packages/components/modules/messages/graphql/mutations/ArchiveChatRoom.ts (1)

47-59: Enhance updater function robustness.

The updater function could benefit from early returns and more explicit error handling.

       updater: (store, data) => {
-        if (!data?.chatRoomArchive?.errors && currentProfile?.id) {
+        if (data?.chatRoomArchive?.errors || !currentProfile?.id) {
+          config?.updater?.(store, data)
+          return
+        }
+
+        const roomId = data?.chatRoomArchive?.room?.id
+        if (!roomId) {
+          config?.updater?.(store, data)
+          return
+        }
+
         getChatRoomConnections(
           store,
           currentProfile.id,
           ({ archived }) => archived === !data?.chatRoomArchive?.room?.isArchived,
         ).forEach((connectionRecord) => {
-            if (data?.chatRoomArchive?.room?.id)
-              ConnectionHandler.deleteNode(connectionRecord, data?.chatRoomArchive?.room?.id)
+          ConnectionHandler.deleteNode(connectionRecord, roomId)
         })
-        }
         config?.updater?.(store, data)
       },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8de60b1 and 766d399.

⛔ Files ignored due to path filters (4)
  • packages/components/__generated__/ActivityLogsFragment.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ActivityLogsPaginationQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ActivityLogsQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ChatRoomQuery.graphql.ts is excluded by !**/__generated__/**
📒 Files selected for processing (8)
  • packages/components/modules/messages/ChatRoom/ChatRoomHeader/ChatRoomOptions/index.tsx (1 hunks)
  • packages/components/modules/messages/ChatRoom/ChatRoomHeader/ChatRoomOptions/types.ts (1 hunks)
  • packages/components/modules/messages/ChatRoom/ChatRoomHeader/index.tsx (5 hunks)
  • packages/components/modules/messages/ChatRoom/ChatRoomHeader/types.ts (1 hunks)
  • packages/components/modules/messages/ChatRoom/index.tsx (1 hunks)
  • packages/components/modules/messages/ChatRoomsList/ChatRoomItem/index.tsx (2 hunks)
  • packages/components/modules/messages/graphql/mutations/ArchiveChatRoom.ts (3 hunks)
  • packages/components/modules/messages/graphql/queries/ChatRoomQuery.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
packages/components/modules/messages/ChatRoom/ChatRoomHeader/ChatRoomOptions/types.ts (1)

2-4: LGTM! Props align well with PR objectives.

The new boolean props effectively support the required functionality:

  • isArchived for archive/unarchive state
  • isArchiveMutationInFlight for mutation state handling
  • isGroup for conditional rendering of group options
packages/components/modules/messages/graphql/queries/ChatRoomQuery.ts (1)

7-7: LGTM! Query updated to support archive functionality.

The isArchived field is correctly added to fetch the chat room's archived state.

packages/components/modules/messages/ChatRoom/ChatRoomHeader/types.ts (1)

6-6: LGTM! Header props updated for archive support.

The isArchived boolean prop is correctly added to support archive state in the header.

packages/components/modules/messages/ChatRoom/ChatRoomHeader/ChatRoomOptions/index.tsx (2)

16-18: LGTM! Archive option implementation looks good.

The archive menu item correctly:

  • Disables during mutation with isArchiveMutationInFlight
  • Toggles text between "Archive Chat" and "Unarchive Chat"

19-30: LGTM! Group options correctly hidden for one-on-one chats.

The implementation aligns with PR requirements by conditionally rendering group-specific options only when isGroup is true.

Copy link
Contributor

@pt-tsl pt-tsl left a comment

Choose a reason for hiding this comment

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

Left a small comment, but nothing that would block approval

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 comments (1)
packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx (1)

80-98: ⚠️ Potential issue

Add closeOnClick to archive action to meet PR requirements.

The PR objectives specify that the three-dot menu should disappear after selecting any option. While this is implemented for the "Mark as Unread" action, it's missing for the archive action.

 {
   disabled: isMutationInFlight,
   icon: !isInArchivedTab ? <ArchiveIcon /> : <UnarchiveIcon />,
   label: !isInArchivedTab ? 'Archive Chat' : 'Unarchive Chat',
   onClick: () => {
     if (currentProfile?.id) {
       commit({
         variables: {
           input: {
             roomId: roomRef.id,
             profileId: currentProfile.id,
             archive: !isInArchivedTab,
           },
         },
       })
     }
   },
   hasPermission: true,
+  closeOnClick: true,
 },
🧹 Nitpick comments (3)
packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/index.tsx (1)

16-18: Consider enhancing UX during archive operation.

While disabling the menu item during mutation is good, consider adding a loading indicator to provide better feedback to users.

-    <MenuItem onClick={onArchiveClicked} disabled={isArchiveMutationInFlight}>
-      <Typography variant="body2">{isArchived ? 'Unarchive Chat' : 'Archive Chat'}</Typography>
+    <MenuItem onClick={onArchiveClicked} disabled={isArchiveMutationInFlight}>
+      <Box display="flex" alignItems="center" gap={1}>
+        <Typography variant="body2">{isArchived ? 'Unarchive Chat' : 'Archive Chat'}</Typography>
+        {isArchiveMutationInFlight && <CircularProgress size={16} />}
+      </Box>
+    </MenuItem>
packages/components/modules/messages/web/ChatRoom/index.tsx (1)

46-46: Consider more explicit boolean conversion.

While !! works, consider using Boolean() for more explicit type conversion.

-        isArchived={!!chatRoom.isArchived}
+        isArchived={Boolean(chatRoom.isArchived)}
packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx (1)

73-94: Add error handling for archive/unarchive operations.

While the archive functionality is well-implemented, consider adding error handling and user feedback for failed operations.

 const [commit, isMutationInFlight] = useArchiveChatRoomMutation()
+const [error, setError] = useState<Error | null>(null)

 // ... in onClick handler
 commit({
   variables: {
     input: {
       roomId: roomRef.id,
       profileId: currentProfile.id,
       archive: !isInArchivedTab,
     },
   },
+  onError: (error) => {
+    setError(error)
+    // Show error toast/notification
+  },
 })
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 766d399 and 438228f.

📒 Files selected for processing (8)
  • packages/components/modules/messages/common/graphql/mutations/ArchiveChatRoom.ts (3 hunks)
  • packages/components/modules/messages/common/graphql/queries/ChatRoomQuery.ts (1 hunks)
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/index.tsx (1 hunks)
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/types.ts (1 hunks)
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/index.tsx (6 hunks)
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/types.ts (1 hunks)
  • packages/components/modules/messages/web/ChatRoom/index.tsx (1 hunks)
  • packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Build and Lint Packages
🔇 Additional comments (8)
packages/components/modules/messages/common/graphql/mutations/ArchiveChatRoom.ts (2)

1-1: Imports look correct
These new imports (useCurrentProfile, ConnectionHandler, etc.) appear properly scoped and logically placed. No issues noted.

Also applies to: 4-4, 7-7


32-32: Consider a fallback for missing profile
If currentProfile is ever undefined, mutation logic may unintentionally skip essential store updates. Ensure that currentProfile is reliably present, or handle that fallback scenario gracefully.

packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/types.ts (1)

2-4: New props align well with archiving & group handling
These boolean props are clear and descriptive, helping manage distinct menu behavior effectively.

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

7-7: “isArchived” field aligns with archiving logic
Adding isArchived ensures you can accurately fetch and handle this state in the client.

packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/types.ts (1)

6-6: LGTM! Clean type addition.

The new isArchived boolean property is well-defined and supports the archive functionality requirement.

packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/index.tsx (1)

7-14: Well-structured implementation of menu options!

The changes perfectly align with the PR requirements:

  • Group-specific options ("Group Details" and "Leave Group") are only shown for group chats
  • Archive option adapts based on the current state
packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/index.tsx (1)

125-134: LGTM! Menu properly closes after selection.

The implementation correctly handles the requirement to close the three-dot menu after any option is selected.

packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx (1)

12-12: LGTM! Import changes align with the new architecture.

The removal of connection-related imports and addition of useFragment aligns well with moving the connection management responsibility to the mutation hook.

@tsl-ps2 tsl-ps2 force-pushed the BA-2226-three-dot-menu-cleanup branch from 438228f to 1530cd5 Compare February 12, 2025 15:36
@tsl-ps2 tsl-ps2 merged commit a0d1a3b into master Feb 12, 2025
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

🧹 Nitpick comments (1)
packages/components/modules/messages/common/graphql/mutations/ArchiveChatRoom.ts (1)

24-46: Add success notification for archive action.

Consider adding a success toast notification to provide feedback when the chat room is successfully archived/unarchived.

 onCompleted: (response, errors) => {
   errors?.forEach((error) => {
     sendToast(error.message, { type: 'error' })
   })
+  if (!errors?.length && response?.chatRoomArchive?.room) {
+    sendToast(
+      `Chat room ${response.chatRoomArchive.room.isArchived ? 'archived' : 'unarchived'} successfully`,
+      { type: 'success' }
+    )
+  }
   config?.onCompleted?.(response, errors)
 },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 438228f and 1530cd5.

📒 Files selected for processing (10)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/messages/common/graphql/mutations/ArchiveChatRoom.ts (3 hunks)
  • packages/components/modules/messages/common/graphql/queries/ChatRoomQuery.ts (1 hunks)
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/index.tsx (1 hunks)
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/types.ts (1 hunks)
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/index.tsx (6 hunks)
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/types.ts (1 hunks)
  • packages/components/modules/messages/web/ChatRoom/index.tsx (1 hunks)
  • packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx (1 hunks)
  • packages/components/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/components/package.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/components/modules/messages/common/graphql/queries/ChatRoomQuery.ts
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/types.ts
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/types.ts
  • packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx
  • packages/components/modules/messages/web/ChatRoom/index.tsx
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/ChatRoomOptions/index.tsx
🔇 Additional comments (5)
packages/components/modules/messages/common/graphql/mutations/ArchiveChatRoom.ts (2)

1-22: LGTM!

The imports and mutation structure are well-organized, and the isArchived field is correctly added to the mutation response.


47-59: Clarify deletion logic for archived chat rooms.

Deleting the node from all matching connections could result in unexpected behavior or UI inconsistencies if multiple views reference the same room. Consider either separating the archived node into its own connection or ensuring this deletion reflects the intended user experience. Adding a success toast may also help confirm the action.

packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/index.tsx (2)

47-60: Add error handling for archive operation.

The archive mutation lacks error handling. Consider adding error handling and user feedback.


90-134: LGTM!

The UI changes correctly implement the PR objectives:

  • Group details are only accessible in group chats
  • Three-dot menu options are properly handled with close actions
packages/components/CHANGELOG.md (1)

3-8: LGTM!

The changelog entry accurately describes the changes made to the three-dot menu functionality.

Ronan-Fernandes pushed a commit that referenced this pull request Feb 13, 2025
* BA-2226

* BA-2226 Versioning
Ronan-Fernandes pushed a commit that referenced this pull request Feb 13, 2025
* BA-2226

* BA-2226 Versioning
pt-tsl pushed a commit that referenced this pull request Feb 14, 2025
* BA-2226

* BA-2226 Versioning
Ronan-Fernandes pushed a commit that referenced this pull request Feb 14, 2025
* BA-2226

* BA-2226 Versioning
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.

3 participants