Skip to content

Mxwar 70 client action buttons#83

Open
samruddhikasar05-bit wants to merge 5 commits into
openMF:devfrom
samruddhikasar05-bit:MXWAR-70-client-action-buttons
Open

Mxwar 70 client action buttons#83
samruddhikasar05-bit wants to merge 5 commits into
openMF:devfrom
samruddhikasar05-bit:MXWAR-70-client-action-buttons

Conversation

@samruddhikasar05-bit
Copy link
Copy Markdown

@samruddhikasar05-bit samruddhikasar05-bit commented Mar 14, 2026

Description

Describe the changes made and why they were made instead of how they were made. List any dependencies that are required for this change.

Related issues and discussion

#{Issue Number}

Screenshots, if any

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • If you have multiple commits please combine them into one commit by squashing them.

  • Read and understood the contribution guidelines at CONTRIBUTING.md.

Summary by CodeRabbit

  • New Features
    • Sidebar menu now shows items based on user permissions.
    • Sidebar header displays the current user's name and office.
    • Client action dropdown dynamically filters options by user permissions and client status.
    • Client view shows additional header fields (Member Of, Client #, Mobile Number, Staff) and clearer status text.
    • Client view adds extra top-level tabs (Address, Family Members, Identities, Documents, Notes).

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 14, 2026

📝 Walkthrough

Walkthrough

Adds Redux-backed permission checks to sidebar and client-view action menus; sidebar header now shows username / officeName. Dropdown options in ClientsView are computed from client status and required-permission metadata and are filtered by the user’s permissions. Some unintended tokens were introduced into the sidebar items array.

Changes

Cohort / File(s) Summary
Sidebar — permission gating, header, and accidental tokens
src/components/custom/sidebar/AppSidebar.tsx
Reads user via useAppSelector, derives permissions, displays `{user.username
Clients view — status+permission-driven dropdowns & UI tweaks
src/pages/clients/clients-view/ClientsView.tsx
Adds useAppSelector sourcing of permissions and hasAllFunctions; builds dropdownOptions based on client.status.id and item requiredPermission, filters by permissions (including ALL_FUNCTIONS), updates header fields (Member Of, Client #, Mobile Number, Staff, Status) and expands tabs. Note: original hard-coded options remains present in the diff alongside the new dropdownOptions.
Formatting only
src/pages/clients/Clients.tsx
Removed/changed trailing newline only; no behavioral changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ClientsView
    participant Store as ReduxStore
    participant Sidebar as AppSidebar

    User->>ClientsView: open client page
    ClientsView->>ReduxStore: read current user & permissions
    ClientsView-->>ClientsView: compute dropdownOptions (status + requiredPermission)
    ClientsView->>ClientsView: filter dropdownOptions by permissions (or ALL_FUNCTIONS)
    ClientsView-->>User: render allowed dropdown actions and updated header/tabs

    User->>Sidebar: open sidebar
    Sidebar->>ReduxStore: read current user & permissions
    Sidebar-->>Sidebar: filter sidebar items by permission (or ALL_FUNCTIONS)
    Sidebar-->>User: render permitted menu items and username/officeName header
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I nibbled through reducers, sniffed each flag and key,
I hopped past status gates to see what you can be.
Menu leaves rustle only for what you own,
Watch out for stray tokens that wandered off alone.
A tiny rabbit cheer — permissions set, now go!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Mxwar 70 client action buttons' directly references the feature branch name and describes the main functionality added (client action buttons), which aligns with the commit message mentioning 'implement client action buttons for MXWAR-70' and the changes that introduce permission-based dropdown action items in ClientsView.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/custom/sidebar/AppSidebar.tsx`:
- Around line 43-46: The selector is using the wrong Redux slice key; update the
useAppSelector call in AppSidebar to read the auth slice instead of login so it
correctly retrieves the user and permissions (change useAppSelector((state) =>
state.login) to useAppSelector((state) => state.auth)); ensure the local const
user and const permissions = user?.permissions || [] now receive real data so
permission checks (permissions usage) and username/office rendering use the
actual user object.

In `@src/pages/clients/clients-view/ClientsView.tsx`:
- Around line 62-66: The current menu options filtering only checks top-level
items (the array assigned to options) and ignores nested children under
option.children, so child items with requiredPermission (e.g., CREATE_LOAN,
CLOSE_CLIENT) still appear; implement a recursive filter (e.g., create a helper
like filterMenuOptions or filterChildren) that walks each option, removes
children that fail the permission check (using option.requiredPermission,
permissions, and hasAllFunctions), and drops parent items that become empty
unless they themselves pass; apply this recursive filter where the existing
].filter(...) is used so both top-level and nested menu children are filtered by
permissions.
- Around line 31-33: The menu items in ClientsView.tsx for "New Share Account",
"New Recurring Deposit Account", and "New Fixed Deposit Account" use a
placeholder path 'signature' which can cause incorrect navigation if the
disabled flag is ever bypassed; update those entries (the objects with label
'New Share Account', 'New Recurring Deposit Account', 'New Fixed Deposit
Account') to use either their real route names or set path to null/undefined and
ensure the rendering/navigation logic (where the menu consumes item.path) guards
against falsy paths so clicks do nothing when disabled or path is absent.
- Around line 1-6: The file currently only defines dropdownOptions and is
missing the ClientsView React component, necessary imports, hooks and variable
definitions; restore or reimplement the full component by adding React and
router imports, declare the ClientsView function/component, initialize state and
hooks (useState, useEffect, useParams) to populate client and permissions,
implement or import hasAllFunctions helper and ensure client, permissions are
defined before building dropdownOptions, and return the JSX wrapper rendering
the dropdownOptions; ensure symbols referenced (dropdownOptions, client,
permissions, hasAllFunctions, ClientsView) are defined and wired into the
component lifecycle so the file compiles and behaves like the previous version.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0ab95abb-aade-427f-bccc-5fd4f801dfa8

📥 Commits

Reviewing files that changed from the base of the PR and between 1d69ff7 and ff17a32.

📒 Files selected for processing (3)
  • src/components/custom/sidebar/AppSidebar.tsx
  • src/pages/clients/Clients.tsx
  • src/pages/clients/clients-view/ClientsView.tsx

Comment thread src/components/custom/sidebar/AppSidebar.tsx
Comment thread src/pages/clients/clients-view/ClientsView.tsx Outdated
Comment on lines +31 to +33
{ label: 'New Share Account', path: 'signature', disabled: true },
{ label: 'New Recurring Deposit Account', path: 'signature', disabled: true },
{ label: 'New Fixed Deposit Account', path: 'signature', disabled: true },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Placeholder paths may cause confusion or navigation bugs.

These disabled items use path: 'signature' which appears to be a placeholder. If these items are accidentally enabled (or the disabled check fails), users would navigate to an incorrect route.

💡 Suggested improvement
-        { label: 'New Share Account', path: 'signature', disabled: true },
-        { label: 'New Recurring Deposit Account', path: 'signature', disabled: true },
-        { label: 'New Fixed Deposit Account', path: 'signature', disabled: true },
+        { label: 'New Share Account', path: `clients/${client?.id}/new-share`, disabled: true }, // TODO: Implement share account creation
+        { label: 'New Recurring Deposit Account', path: `clients/${client?.id}/new-recurring-deposit`, disabled: true }, // TODO: Implement recurring deposit
+        { label: 'New Fixed Deposit Account', path: `clients/${client?.id}/new-fixed-deposit`, disabled: true }, // TODO: Implement fixed deposit
📝 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
{ label: 'New Share Account', path: 'signature', disabled: true },
{ label: 'New Recurring Deposit Account', path: 'signature', disabled: true },
{ label: 'New Fixed Deposit Account', path: 'signature', disabled: true },
{ label: 'New Share Account', path: `clients/${client?.id}/new-share`, disabled: true }, // TODO: Implement share account creation
{ label: 'New Recurring Deposit Account', path: `clients/${client?.id}/new-recurring-deposit`, disabled: true }, // TODO: Implement recurring deposit
{ label: 'New Fixed Deposit Account', path: `clients/${client?.id}/new-fixed-deposit`, disabled: true }, // TODO: Implement fixed deposit
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/clients/clients-view/ClientsView.tsx` around lines 31 - 33, The
menu items in ClientsView.tsx for "New Share Account", "New Recurring Deposit
Account", and "New Fixed Deposit Account" use a placeholder path 'signature'
which can cause incorrect navigation if the disabled flag is ever bypassed;
update those entries (the objects with label 'New Share Account', 'New Recurring
Deposit Account', 'New Fixed Deposit Account') to use either their real route
names or set path to null/undefined and ensure the rendering/navigation logic
(where the menu consumes item.path) guards against falsy paths so clicks do
nothing when disabled or path is absent.

Comment thread src/pages/clients/clients-view/ClientsView.tsx Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/pages/clients/clients-view/ClientsView.tsx (1)

107-111: ⚠️ Potential issue | 🟠 Major

Nested children items bypass permission filtering.

The .filter() at lines 107-111 only evaluates requiredPermission on top-level items. Children within Applications, Actions, and More have requiredPermission fields (e.g., CREATE_LOAN, CLOSE_CLIENT) that are never checked. Users without these permissions will still see the child menu items.

🐛 Proposed fix: Filter nested children recursively
-  ].filter(option => 
-    !option.requiredPermission || 
-    permissions.includes(option.requiredPermission) || 
-    hasAllFunctions
-  )
+  ].map(option => {
+    if (option.children) {
+      return {
+        ...option,
+        children: option.children.filter(child =>
+          child.disabled ||
+          !child.requiredPermission ||
+          permissions.includes(child.requiredPermission) ||
+          hasAllFunctions
+        ),
+      }
+    }
+    return option
+  }).filter(option => {
+    // Filter top-level items by permission
+    if (option.requiredPermission) {
+      return permissions.includes(option.requiredPermission) || hasAllFunctions
+    }
+    // Filter out parent items with no remaining children
+    if (option.children) {
+      return option.children.length > 0
+    }
+    return true
+  })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/clients/clients-view/ClientsView.tsx` around lines 107 - 111, The
top-level filtering of the menu `options` in ClientsView.tsx only checks
`requiredPermission` for parent items and does not remove child entries that
have their own `requiredPermission`; modify the logic so each menu item is
processed recursively: keep the current check for `option.requiredPermission`
using `permissions` or `hasAllFunctions`, and if `option.children` exists,
replace it with a filtered version that applies the same permission check to
each child (and recurses for nested children), and only include parent items
whose filtered `children` array is non-empty or that themselves pass the
permission check; implement this as a small helper (e.g., `filterMenuOptions` or
`filterOption`) and use it instead of the current inline `.filter(...)` on
`options`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/clients/clients-view/ClientsView.tsx`:
- Around line 47-52: The dropdownOptions array is building route strings using
client?.id which yields "clients/undefined/edit" while client data is loading;
update ClientsView to avoid constructing or rendering the dropdown until client
is defined—either return early from the component or conditionally render the
dropdown/menu (or provide disabled items) so dropdownOptions is only created
when client is non-null; locate the dropdownOptions declaration and the
component render that consumes it and wrap that logic with a guard like if
(!client) return null or render a loading/disabled state.

---

Duplicate comments:
In `@src/pages/clients/clients-view/ClientsView.tsx`:
- Around line 107-111: The top-level filtering of the menu `options` in
ClientsView.tsx only checks `requiredPermission` for parent items and does not
remove child entries that have their own `requiredPermission`; modify the logic
so each menu item is processed recursively: keep the current check for
`option.requiredPermission` using `permissions` or `hasAllFunctions`, and if
`option.children` exists, replace it with a filtered version that applies the
same permission check to each child (and recurses for nested children), and only
include parent items whose filtered `children` array is non-empty or that
themselves pass the permission check; implement this as a small helper (e.g.,
`filterMenuOptions` or `filterOption`) and use it instead of the current inline
`.filter(...)` on `options`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eb74d347-f691-4f7d-a9ad-cdac7fc805fe

📥 Commits

Reviewing files that changed from the base of the PR and between ff17a32 and 628512e.

📒 Files selected for processing (1)
  • src/pages/clients/clients-view/ClientsView.tsx

Comment thread src/pages/clients/clients-view/ClientsView.tsx
@DavidH-1
Copy link
Copy Markdown
Contributor

CLA Check = Passed

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/pages/clients/clients-view/ClientsView.tsx (2)

319-345: ⚠️ Potential issue | 🔴 Critical

Duplicate tabs in AppTabs will render twice.

The tabs array contains both hardcoded labels ("General", "Address", etc. on lines 319-324) and translated labels (lines 325-345) for the same tabs. This will display 12 tabs instead of 6. Remove the duplicates and use only the translated versions.

🐛 Proposed fix: Remove duplicate tabs
       <AppTabs
         tabs={[
-          { label: 'General', href: `clients/${client?.id}/general` },
-          { label: 'Address', href: `clients/${client?.id}/address` },
-          { label: 'Family Members', href: `clients/${client?.id}/family-members` },
-          { label: 'Identities', href: `clients/${client?.id}/identities` },
-          { label: 'Documents', href: `clients/${client?.id}/documents` },
-          { label: 'Notes', href: `clients/${client?.id}/notes` },
           {
             label: t('view.tabs.general'),
             href: `clients/${client?.id}/general`,
           },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/clients/clients-view/ClientsView.tsx` around lines 319 - 345, The
tabs array in ClientsView.tsx currently defines each tab twice (hardcoded labels
and translated labels), causing duplicate tabs in AppTabs; remove the first set
of hardcoded entries and keep only the translated entries (the objects using
t('view.tabs.*')) so that the tabs array used by AppTabs contains a single entry
per tab (refer to the tabs array in ClientsView and the AppTabs consumer to
verify).

199-305: ⚠️ Potential issue | 🔴 Critical

Duplicate options prop on Dropdown causes syntax error or unexpected behavior.

The Dropdown component receives options twice: first with the permission-filtered dropdownOptions (line 199), then immediately with a hardcoded static array (lines 200-304). This is invalid JSX—the second prop will override the first, negating all permission filtering work. Remove the old static options array.

🐛 Proposed fix: Remove duplicate options prop
             <Dropdown
               name={
                 <span className="flex items-center gap-2">
                   <Menu />
                 </span>
               }
               options={dropdownOptions}
-              options={[
-                {
-                  label: t('view.menu.edit'),
-                  path: `clients/${client?.id}/edit`,
-                },
-                {
-                  label: t('view.menu.applications'),
-                  children: [
-                    ...
-                  ],
-                },
-                ...
-              ]}
             />

Remove lines 200-304 entirely.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/clients/clients-view/ClientsView.tsx` around lines 199 - 305, The
Dropdown component is being passed the options prop twice, first as
dropdownOptions and then again as a hardcoded array—remove the duplicate
hardcoded options array so Dropdown only receives options={dropdownOptions};
locate the JSX where Dropdown is rendered in ClientsView (reference: Dropdown
and the dropdownOptions variable) and delete the entire second options=[...]
block so permission-filtering via dropdownOptions is preserved and no duplicate
prop remains.
src/components/custom/sidebar/AppSidebar.tsx (1)

117-131: ⚠️ Potential issue | 🔴 Critical

Stray tokens and duplicate items cause syntax errors and build failure.

Lines 117 and 131 contain stray text (MXWAR-70-client-action-buttons and dev) that appear to be leftover merge conflict markers or branch names. These cause the ESLint parsing errors shown in the pipeline. Additionally, Dashboard and Navigation items are duplicated (lines 118-119 duplicate 121-130).

🐛 Proposed fix: Remove stray tokens and duplicates
           <SidebarMenu>
             {[
-        MXWAR-70-client-action-buttons
-              { icon: <Gauge />, label: t('nav.dashboard'), route: 'dashboard', permission: 'ALL_FUNCTIONS' },
-              { icon: <Send />, label: t('nav.navigation'), route: 'navigation', permission: 'ALL_FUNCTIONS' },
-
               {
                 icon: <Gauge />,
                 label: t('nav.dashboard'),
                 route: 'dashboard',
+                permission: 'ALL_FUNCTIONS',
               },
               {
                 icon: <Send />,
                 label: t('nav.navigation'),
                 route: 'navigation',
+                permission: 'ALL_FUNCTIONS',
               },
-         dev
               {
                 icon: <Check />,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/custom/sidebar/AppSidebar.tsx` around lines 117 - 131, The
sidebar items array in AppSidebar.tsx contains stray tokens
("MXWAR-70-client-action-buttons" and "dev") and duplicated menu objects (two
entries each for Gauge/Send with labels t('nav.dashboard') and
t('nav.navigation')), causing parse errors; remove the stray tokens and keep
only one instance of each menu object (the entries with icon <Gauge />, label
t('nav.dashboard'), route 'dashboard' and icon <Send />, label
t('nav.navigation', route 'navigation')) so the items list is clean and valid,
and ensure any surrounding comma/array syntax remains correct.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/clients/clients-view/ClientsView.tsx`:
- Around line 147-159: The JSX in ClientsView contains duplicated label blocks
(hardcoded "Member Of", "Client #", "Mobile Number", "Staff" and their
translated counterparts like t('view.memberOf') and t('view.missingInOpenAPI'))
— remove the duplicate/hardcoded label elements and keep a single label per
field using the translation keys (e.g., use t('view.memberOf') etc.), ensure
each field (client?.accountNo, client?.mobileNo, staff info) renders only once
with its translated header, and also remove the stray t('view.missingInOpenAPI')
placeholder so the grid does not show duplicated headers (same fix for the other
duplicate block later in the same ClientsView component).
- Around line 309-312: In ClientsView, the status is rendered twice
(client?.status?.value and client?.status?.code), likely a merge artifact;
decide which representation you want and remove the other: if you want a single
human-friendly badge keep the line using client?.status?.value (or its localized
form via t) and delete the duplicate line displaying client?.status?.code,
otherwise keep both but rename or reformat one (e.g., label as "Code") so it’s
clear. Update the JSX in ClientsView where the two <div> lines appear to reflect
that choice.
- Around line 33-36: The selector is reading the wrong slice (state.login) so
user will be undefined; update the useAppSelector call in ClientsView (the const
{ user } = useAppSelector(...) line) to read from state.auth instead of
state.login, keep the rest (permissions and hasAllFunctions) unchanged so
permissions = user?.permissions || [] and hasAllFunctions =
permissions.includes('ALL_FUNCTIONS') will work correctly.

In `@src/pages/clients/Clients.tsx`:
- Line 262: The file ends with "export default Clients" but is missing a
trailing newline which breaks Prettier; open the Clients component file (the
symbol/export "export default Clients"), add a single newline character at
end-of-file so the file ends with a blank line, save and re-run formatting/lint
checks.

---

Outside diff comments:
In `@src/components/custom/sidebar/AppSidebar.tsx`:
- Around line 117-131: The sidebar items array in AppSidebar.tsx contains stray
tokens ("MXWAR-70-client-action-buttons" and "dev") and duplicated menu objects
(two entries each for Gauge/Send with labels t('nav.dashboard') and
t('nav.navigation')), causing parse errors; remove the stray tokens and keep
only one instance of each menu object (the entries with icon <Gauge />, label
t('nav.dashboard'), route 'dashboard' and icon <Send />, label
t('nav.navigation', route 'navigation')) so the items list is clean and valid,
and ensure any surrounding comma/array syntax remains correct.

In `@src/pages/clients/clients-view/ClientsView.tsx`:
- Around line 319-345: The tabs array in ClientsView.tsx currently defines each
tab twice (hardcoded labels and translated labels), causing duplicate tabs in
AppTabs; remove the first set of hardcoded entries and keep only the translated
entries (the objects using t('view.tabs.*')) so that the tabs array used by
AppTabs contains a single entry per tab (refer to the tabs array in ClientsView
and the AppTabs consumer to verify).
- Around line 199-305: The Dropdown component is being passed the options prop
twice, first as dropdownOptions and then again as a hardcoded array—remove the
duplicate hardcoded options array so Dropdown only receives
options={dropdownOptions}; locate the JSX where Dropdown is rendered in
ClientsView (reference: Dropdown and the dropdownOptions variable) and delete
the entire second options=[...] block so permission-filtering via
dropdownOptions is preserved and no duplicate prop remains.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6bd8c098-51d6-41fb-893f-5f9d9df51019

📥 Commits

Reviewing files that changed from the base of the PR and between 628512e and bed91bf.

📒 Files selected for processing (3)
  • src/components/custom/sidebar/AppSidebar.tsx
  • src/pages/clients/Clients.tsx
  • src/pages/clients/clients-view/ClientsView.tsx

Comment on lines +33 to +36
// WEB-812: Fetch user permissions from Redux
const { user } = useAppSelector((state) => state.login)
const permissions = user?.permissions || []
const hasAllFunctions = permissions.includes('ALL_FUNCTIONS')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Incorrect Redux state path: state.login should be state.auth.

Same issue as in AppSidebar.tsx. The store mounts auth under auth, not login. This will cause user to be undefined and all permission checks to fail.

🐛 Proposed fix
   // WEB-812: Fetch user permissions from Redux
-  const { user } = useAppSelector((state) => state.login)
+  const { user } = useAppSelector(state => state.auth)
   const permissions = user?.permissions || []
   const hasAllFunctions = permissions.includes('ALL_FUNCTIONS')
🧰 Tools
🪛 GitHub Check: Run Lint, Build and Deploy

[failure] 34-34:
Replace (state) with state

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/clients/clients-view/ClientsView.tsx` around lines 33 - 36, The
selector is reading the wrong slice (state.login) so user will be undefined;
update the useAppSelector call in ClientsView (the const { user } =
useAppSelector(...) line) to read from state.auth instead of state.login, keep
the rest (permissions and hasAllFunctions) unchanged so permissions =
user?.permissions || [] and hasAllFunctions =
permissions.includes('ALL_FUNCTIONS') will work correctly.

Comment on lines +147 to 159
<div className="font-semibold">Member Of</div>
<div>{'—'}</div>
</div>
<div>
<div className="font-semibold">Client #</div>
<div>{client?.accountNo ?? '—'}</div>
</div>
<div>
<div className="font-semibold">Mobile Number</div>
<div>{client?.mobileNo ?? '—'}</div>
<div className="font-semibold">{t('view.memberOf')}</div>
<div>{t('view.missingInOpenAPI')}</div>
</div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Duplicate header fields will render twice in the UI.

The client info grid contains duplicate blocks: hardcoded labels ("Member Of", "Client #", "Mobile Number", "Staff") followed by translated labels for the same fields. This appears to be leftover from an incomplete merge.

🐛 Proposed fix: Remove duplicates and use translations
             <div>
-              <div className="font-semibold">Member Of</div>
-              <div>{'—'}</div>
-            </div>
-            <div>
-              <div className="font-semibold">Client #</div>
-              <div>{client?.accountNo ?? '—'}</div>
-            </div>
-            <div>
-              <div className="font-semibold">Mobile Number</div>
-              <div>{client?.mobileNo ?? '—'}</div>
               <div className="font-semibold">{t('view.memberOf')}</div>
               <div>{t('view.missingInOpenAPI')}</div>
             </div>
...
             <div>
-              <div className="font-semibold">Staff</div>
-              <div>{client?.staffName ?? '—'}</div>
               <div className="font-semibold">{t('view.staff')}</div>
               <div>{t('view.missingInOpenAPI')}</div>
             </div>

Also applies to: 183-186

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/clients/clients-view/ClientsView.tsx` around lines 147 - 159, The
JSX in ClientsView contains duplicated label blocks (hardcoded "Member Of",
"Client #", "Mobile Number", "Staff" and their translated counterparts like
t('view.memberOf') and t('view.missingInOpenAPI')) — remove the
duplicate/hardcoded label elements and keep a single label per field using the
translation keys (e.g., use t('view.memberOf') etc.), ensure each field
(client?.accountNo, client?.mobileNo, staff info) renders only once with its
translated header, and also remove the stray t('view.missingInOpenAPI')
placeholder so the grid does not show duplicated headers (same fix for the other
duplicate block later in the same ClientsView component).

Comment on lines +309 to 312
<div>Status: {client?.status?.value ?? '—'}</div>
<div>
{t('view.status')} {client?.status?.code ?? '—'}
</div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Duplicate status display in the status badge.

Lines 309 and 311 both display status information. Line 309 shows client?.status?.value while line 311 shows client?.status?.code. If both are intended, this is fine, but appears to be another merge artifact.

💡 Suggested cleanup

If only one status line is needed:

           <div className="mt-30 bg-[`#0662a3`] px-4 py-2 rounded-md text-sm font-medium text-white">
-            <div>Status: {client?.status?.value ?? '—'}</div>
             <div>
               {t('view.status')} {client?.status?.code ?? '—'}
             </div>
           </div>

Or keep both if showing value and code is intentional.

📝 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
<div>Status: {client?.status?.value ?? '—'}</div>
<div>
{t('view.status')} {client?.status?.code ?? '—'}
</div>
<div className="mt-30 bg-[`#0662a3`] px-4 py-2 rounded-md text-sm font-medium text-white">
<div>
{t('view.status')} {client?.status?.code ?? '—'}
</div>
</div>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/clients/clients-view/ClientsView.tsx` around lines 309 - 312, In
ClientsView, the status is rendered twice (client?.status?.value and
client?.status?.code), likely a merge artifact; decide which representation you
want and remove the other: if you want a single human-friendly badge keep the
line using client?.status?.value (or its localized form via t) and delete the
duplicate line displaying client?.status?.code, otherwise keep both but rename
or reformat one (e.g., label as "Code") so it’s clear. Update the JSX in
ClientsView where the two <div> lines appear to reflect that choice.

}

export default Clients
export default Clients No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add missing trailing newline to fix Prettier check.

The pipeline is failing because the file is missing a trailing newline at the end. This is required by Prettier formatting rules.

🔧 Proposed fix
 export default Clients
+
📝 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 default Clients
export default Clients
🧰 Tools
🪛 GitHub Actions: build-run

[error] 262-262: Prettier check failed (ESLint rule prettier/prettier): Insert

🪛 GitHub Check: Run Lint, Build and Deploy

[failure] 262-262:
Insert

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/clients/Clients.tsx` at line 262, The file ends with "export
default Clients" but is missing a trailing newline which breaks Prettier; open
the Clients component file (the symbol/export "export default Clients"), add a
single newline character at end-of-file so the file ends with a blank line, save
and re-run formatting/lint checks.

Copy link
Copy Markdown
Collaborator

@gkbishnoi07 gkbishnoi07 left a comment

Choose a reason for hiding this comment

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

check code rabbit comments some are critical

@gkbishnoi07
Copy link
Copy Markdown
Collaborator

your one workflow is failing

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