-
Notifications
You must be signed in to change notification settings - Fork 3
pos-filter-ui #366
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
base: main
Are you sure you want to change the base?
pos-filter-ui #366
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
Reviewer's GuideThis PR adds a new filtering UI to the POS index page, introduces supporting modules for record counts, routing paths, and session key management, and updates project tooling with formatting scripts. Class diagram for new POS UI modulesclassDiagram
class PosTotalCount {
+posTotalCountAtom: number | null
+render(): JSX.Element
}
class posTotalCountAtom {
<<atom>>
value: number | null
}
class PosPath {
<<enum>>
Index: string
Customers: string
Leads: string
Companies: string
Vendors: string
Clients: string
}
class PosCursorSessionKey {
+POS_CURSOR_SESSION_KEY: string
+LEADS_CURSOR_SESSION_KEY: string
}
class useIsPosLeadSessionKey {
+isLead: boolean
+sessionKey: string
+useLocation(): Location
}
PosTotalCount --> posTotalCountAtom
useIsPosLeadSessionKey --> PosPath
useIsPosLeadSessionKey --> PosCursorSessionKey
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThis PR introduces POS Orders listing in sales_ui with new routes, navigation, data hooks, and table components. It refactors sales module exposure and navigation, adds POS-related types, atoms, and filters, adjusts pages accordingly, and makes minor config/formatting edits and a route removal in operation_ui. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Router as Sales UI Router
participant Nav as PosOrderNavigation
participant OrdersPage
participant Hook as useOrdersList
participant API as GraphQL API
User->>Router: Navigate to /sales/pos/:posId/orders
Router-->>OrdersPage: Render
OrdersPage->>Hook: useOrdersList({ page/perPage })
Hook->>API: Query orders (POS)
API-->>Hook: Orders data + pageInfo
Hook-->>OrdersPage: { ordersList, loading, pageInfo, handleFetchMore }
OrdersPage-->>User: OrderRecordTable (skeleton/data)
Note over OrdersPage,Hook: handleFetchMore appends on pagination
User->>Nav: Expand POS list
Nav->>API: Query POS list
API-->>Nav: POS items
Nav-->>User: Links to POS and Orders
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `frontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsx:10-14` </location>
<code_context>
+ {isUndefinedOrNull(totalCount) ? (
+ <Skeleton className="w-20 h-4 inline-block mt-1.5" />
+ ) : (
+ `${totalCount} records found`
+ )}
+ </div>
</code_context>
<issue_to_address>
**suggestion:** Consider pluralization for record count display.
Handle singular form when totalCount is 1 to avoid awkward phrasing.
```suggestion
{isUndefinedOrNull(totalCount) ? (
<Skeleton className="w-20 h-4 inline-block mt-1.5" />
) : (
`${totalCount} record${totalCount === 1 ? '' : 's'} found`
)}
```
</issue_to_address>
### Comment 2
<location> `frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx:9` </location>
<code_context>
+export const useIsPosLeadSessionKey = () => {
+ const { pathname } = useLocation();
+
+ const isLead = pathname.includes(PosPath.Leads);
+ return {
+ isLead,
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Pathname matching may cause false positives if route substrings overlap.
Consider replacing 'includes' with strict equality or a regular expression to avoid matching unintended routes.
```suggestion
const isLead = new RegExp(`(^|/)${PosPath.Leads}(/|$)`).test(pathname);
```
</issue_to_address>
### Comment 3
<location> `package.json:10-11` </location>
<code_context>
"dev:uis": "dotenv -e .env -- node scripts/start-ui-dev.js",
- "create-plugin": "node scripts/create-plugin.js"
+ "create-plugin": "node scripts/create-plugin.js",
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\""
},
"engines": {
</code_context>
<issue_to_address>
**suggestion:** Consider excluding lock files and build artifacts from formatting scripts.
Excluding lock files and build outputs from the glob pattern will prevent unnecessary formatting and potential issues.
```suggestion
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\" \"!**/package-lock.json\" \"!**/pnpm-lock.yaml\" \"!**/yarn.lock\" \"!dist/**\" \"!build/**\" \"!.next/**\" \"!.out/**\"",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\" \"!**/package-lock.json\" \"!**/pnpm-lock.yaml\" \"!**/yarn.lock\" \"!dist/**\" \"!build/**\" \"!.next/**\" \"!.out/**\""
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 files reviewed, 8 comments
.env.sample
Outdated
| MONGO_URL=mongodb://localhost:27017/erxes?directConnection=true | ||
| MONGO_URL=mongodb+srv://enkhtuvshinej:[email protected]/erxes_local?retryWrites=true&w=majority&appName=erxes-local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Duplicate MONGO_URL variables will cause configuration issues. Only the last one (line 3) will be used. Remove one of these.
| MONGO_URL=mongodb://localhost:27017/erxes?directConnection=true | |
| MONGO_URL=mongodb+srv://enkhtuvshinej:[email protected]/erxes_local?retryWrites=true&w=majority&appName=erxes-local | |
| MONGO_URL=mongodb://localhost:27017/erxes?directConnection=true |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .env.sample
Line: 2:3
Comment:
**logic:** Duplicate `MONGO_URL` variables will cause configuration issues. Only the last one (line 3) will be used. Remove one of these.
```suggestion
MONGO_URL=mongodb://localhost:27017/erxes?directConnection=true
```
How can I resolve this? If you propose a fix, please make it concise.
.env.sample
Outdated
| NODE_ENV=development | ||
| MONGO_URL=mongodb://localhost:27017/erxes | ||
| MONGO_URL=mongodb://localhost:27017/erxes?directConnection=true | ||
| MONGO_URL=mongodb+srv://enkhtuvshinej:[email protected]/erxes_local?retryWrites=true&w=majority&appName=erxes-local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Production MongoDB credentials with username enkhtuvshinej and password are exposed in the sample file. This is a critical security vulnerability - remove these credentials immediately.
| MONGO_URL=mongodb+srv://enkhtuvshinej:[email protected]/erxes_local?retryWrites=true&w=majority&appName=erxes-local | |
| MONGO_URL=mongodb://localhost:27017/erxes?directConnection=true |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .env.sample
Line: 3:3
Comment:
**logic:** Production MongoDB credentials with username `enkhtuvshinej` and password are exposed in the sample file. This is a critical security vulnerability - remove these credentials immediately.
```suggestion
MONGO_URL=mongodb://localhost:27017/erxes?directConnection=true
```
How can I resolve this? If you propose a fix, please make it concise.| export enum PosPath { | ||
| Index = '/contacts', | ||
| Customers = '/customers', | ||
| Leads = '/leads', | ||
| Companies = '/companies', | ||
| Vendors = '/vendors', | ||
| Clients = '/clients', | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Replace enum with const object map according to project guidelines. Enums are explicitly avoided in favor of maps.
| export enum PosPath { | |
| Index = '/contacts', | |
| Customers = '/customers', | |
| Leads = '/leads', | |
| Companies = '/companies', | |
| Vendors = '/vendors', | |
| Clients = '/clients', | |
| } | |
| export const PosPath = { | |
| Index: '/contacts', | |
| Customers: '/customers', | |
| Leads: '/leads', | |
| Companies: '/companies', | |
| Vendors: '/vendors', | |
| Clients: '/clients', | |
| } as const; | |
| export type PosPath = typeof PosPath[keyof typeof PosPath]; |
Context Used: Context from dashboard - .cursorrules (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx
Line: 1:8
Comment:
**style:** Replace enum with const object map according to project guidelines. Enums are explicitly avoided in favor of maps.
```suggestion
export const PosPath = {
Index: '/contacts',
Customers: '/customers',
Leads: '/leads',
Companies: '/companies',
Vendors: '/vendors',
Clients: '/clients',
} as const;
export type PosPath = typeof PosPath[keyof typeof PosPath];
```
**Context Used:** Context from `dashboard` - .cursorrules ([source](https://app.greptile.com/review/custom-context?memory=bf691a04-8aaa-40fe-8db5-b17d5fe3755f))
How can I resolve this? If you propose a fix, please make it concise.| import { SelectMember, TagsFilter, SelectBrand } from 'ui-modules'; | ||
| import { PosTotalCount } from './PosTotalCount'; | ||
| import { PosHotKeyScope } from '../types/posHotkeyScope'; | ||
| import { useIsPosLeadSessionKey } from '../pos-detail/hooks/UsePosLeadSessionKey'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Use absolute import paths instead of relative paths per coding standards
Context Used: Rule from dashboard - Use absolute import paths instead of relative paths when importing modules in TypeScript/JavaScript ... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx
Line: 16:19
Comment:
**style:** Use absolute import paths instead of relative paths per coding standards
**Context Used:** Rule from `dashboard` - Use absolute import paths instead of relative paths when importing modules in TypeScript/JavaScript ... ([source](https://app.greptile.com/review/custom-context?memory=c22f4dca-4fa7-48c2-911a-3f50a8f6d5a8))
How can I resolve this? If you propose a fix, please make it concise.| export const useIsPosLeadSessionKey = () => { | ||
| const { pathname } = useLocation(); | ||
|
|
||
| const isLead = pathname.includes(PosPath.Leads); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Using pathname.includes() could match unintended routes - consider using exact path matching or startsWith() for more precise routing logic
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx
Line: 9:9
Comment:
**logic:** Using `pathname.includes()` could match unintended routes - consider using exact path matching or startsWith() for more precise routing logic
How can I resolve this? If you propose a fix, please make it concise.| import { PosCreate } from '@/create-pos/components/index/pos-create'; | ||
| import { PosEdit } from '@/pos-detail/components/posDetail'; | ||
| import { renderingPosCreateAtom } from '@/create-pos/states/renderingPosCreateAtom'; | ||
| import { PosFilter } from '@/pos/PosFilter'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Extra trailing spaces after the import statement
| import { PosFilter } from '@/pos/PosFilter'; | |
| import { PosFilter } from '@/pos/PosFilter'; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx
Line: 10:10
Comment:
**style:** Extra trailing spaces after the import statement
```suggestion
import { PosFilter } from '@/pos/PosFilter';
```
How can I resolve this? If you propose a fix, please make it concise.| }; | ||
| return ( | ||
| <div className="flex flex-col h-full"> | ||
| <div className="flex flex-col h-full"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Line contains excessive trailing whitespace that should be removed for cleaner code
| <div className="flex flex-col h-full"> | |
| <div className="flex flex-col h-full"> |
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx
Line: 22:22
Comment:
**style:** Line contains excessive trailing whitespace that should be removed for cleaner code
```suggestion
<div className="flex flex-col h-full">
```
How can I resolve this? If you propose a fix, please make it concise.| </PageHeader.End> | ||
| </PageHeader> | ||
| <PageSubHeader> | ||
| <PosFilter /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Missing proper indentation - should align with parent component structure
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx
Line: 54:54
Comment:
**style:** Missing proper indentation - should align with parent component structure
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Changes requested ❌
Reviewed everything up to f627fca in 2 minutes and 39 seconds. Click for details.
- Reviewed
321lines of code in9files - Skipped
1files when reviewing. - Skipped posting
9draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsx:1
- Draft comment:
Constants are clearly defined; no issues here. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx:9
- Draft comment:
Using 'pathname.includes(PosPath.Leads)' might catch unintended paths. Consider a more specific route matching if needed. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While the comment raises a valid point about includes() potentially matching unintended paths, we don't have enough context about PosPath.Leads or the routing structure to know if this is actually a problem. The code seems intentionally simple and may be sufficient for the use case. Without seeing evidence of actual problematic path matches, this feels more speculative. The comment could be correct - includes() is generally less precise than exact path matching. There could be paths that contain "leads" that shouldn't match. However, without concrete evidence of problematic paths or knowledge of the routing structure, this comment is speculative and may lead to unnecessary complexity. Delete the comment as it's speculative without clear evidence of an actual problem. The simple includes() check may be perfectly sufficient for this use case.
3. frontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsx:9
- Draft comment:
PosTotalCount component correctly renders the total count with a skeleton placeholder when data is null. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
4. frontend/plugins/pos_ui/src/modules/states/PosCount.tsx:1
- Draft comment:
The jotai atom for posTotalCount is properly initialized. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
5. frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx:1
- Draft comment:
Path enum is clearly defined and self-explanatory. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
6. frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx:10
- Draft comment:
PosFilter is correctly imported and integrated within the PageSubHeader component. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
7. package.json:10
- Draft comment:
New Prettier formatting scripts have been added. Ensure these settings align with your project’s formatting standards. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
8. frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx:10
- Draft comment:
There appears to be trailing whitespace at the end of line 10. Please remove the extra spaces to maintain consistency. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment is technically correct about the trailing whitespace, this is an extremely minor formatting issue that would typically be handled automatically by code formatters or linters. It doesn't affect functionality and is not a significant code quality issue. The rules specifically say not to make comments that are obvious or unimportant. The trailing whitespace could be a sign that code formatting tools aren't properly configured, which could lead to inconsistencies across the codebase. While consistent formatting is important, this is too minor of an issue to warrant a PR comment. It should be handled by automated tools rather than manual review comments. Delete this comment as it violates the rule about not making obvious or unimportant comments. This kind of minor formatting issue should be handled by automated tools.
9. frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx:22
- Draft comment:
There's extraneous trailing whitespace at the end of this line that should be removed. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =20%<= threshold50%The comment is pointing out a minor formatting issue, which is not a significant concern in terms of functionality or logic. It doesn't provide a suggestion for improvement or highlight a potential issue with the code's behavior. Therefore, it doesn't align with the rules for useful comments.
Workflow ID: wflow_V9er8EI3KGLYqtcT
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
.env.sample
Outdated
| NODE_ENV=development | ||
| MONGO_URL=mongodb://localhost:27017/erxes | ||
| MONGO_URL=mongodb://localhost:27017/erxes?directConnection=true | ||
| MONGO_URL=mongodb+srv://enkhtuvshinej:[email protected]/erxes_local?retryWrites=true&w=majority&appName=erxes-local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple MONGO_URL definitions and embedded credentials detected. Use only one MONGO_URL and avoid hardcoding sensitive credentials in sample files.
| MONGO_URL=mongodb+srv://enkhtuvshinej:[email protected]/erxes_local?retryWrites=true&w=majority&appName=erxes-local |
| updated: string; | ||
| lastSeen: string; | ||
| brand: string; | ||
| }>(['tags', 'searchValue', 'created', 'updated', 'lastSeen', 'brand']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'birthday' filter UI is defined later but not included in the useMultiQueryState keys. Verify if this omission is intentional.
There was a problem hiding this 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
🧹 Nitpick comments (1)
frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx (1)
1-8: Prefer const object over enum per coding guidelines.The codebase guidelines state: "Avoid enums; use maps instead." Consider refactoring to a const object for better TypeScript alignment and maintainability.
Additionally, the naming
Index = '/contacts'is potentially confusing—consider renaming toContactsfor clarity.As per coding guidelines.
Apply this diff:
-export enum PosPath { - Index = '/contacts', - Customers = '/customers', - Leads = '/leads', - Companies = '/companies', - Vendors = '/vendors', - Clients = '/clients', - } +export const PosPath = { + Contacts: '/contacts', + Customers: '/customers', + Leads: '/leads', + Companies: '/companies', + Vendors: '/vendors', + Clients: '/clients', +} as const; + +export type PosPath = typeof PosPath[keyof typeof PosPath];If you need to keep the
Indexkey for backward compatibility, the refactor would be:-export enum PosPath { - Index = '/contacts', - Customers = '/customers', - Leads = '/leads', - Companies = '/companies', - Vendors = '/vendors', - Clients = '/clients', - } +export const PosPath = { + Index: '/contacts', + Customers: '/customers', + Leads: '/leads', + Companies: '/companies', + Vendors: '/vendors', + Clients: '/clients', +} as const; + +export type PosPath = typeof PosPath[keyof typeof PosPath];
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
.env.sample(1 hunks)frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsx(1 hunks)frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx(1 hunks)frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx(1 hunks)frontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsx(1 hunks)frontend/plugins/pos_ui/src/modules/states/PosCount.tsx(1 hunks)frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx(1 hunks)frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx(3 hunks)package.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Use functional and declarative programming patterns; avoid classes.
Use TypeScript for all code; prefer interfaces over types.
Avoid enums; use maps instead.
Files:
frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos/PosFilter.tsxfrontend/plugins/pos_ui/src/modules/types/path/PosPath.tsxfrontend/plugins/pos_ui/src/pages/PosIndexPage.tsxfrontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsxfrontend/plugins/pos_ui/src/modules/states/PosCount.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Avoid console logs.
Always use absolute paths when importing.
Use the "function" keyword for pure functions.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
**/*.{ts,tsx,js,jsx}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use the "function" keyword for pure functions.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
Use absolute path when import.
Files:
frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos/PosFilter.tsxfrontend/plugins/pos_ui/src/modules/types/path/PosPath.tsxfrontend/plugins/pos_ui/src/pages/PosIndexPage.tsxfrontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsxfrontend/plugins/pos_ui/src/modules/states/PosCount.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{tsx,jsx}: Favor named exports for components.
Use declarative JSX.
Use Shadcn UI, Radix, and Tailwind for components and styling.
Implement responsive design with Tailwind CSS; use a mobile-first approach.
**/*.{tsx,jsx}: Structure files: exported component, subcomponents, helpers, static content, types.
Favor named exports for components.
Use declarative JSX.
Use Shadcn UI, Radix, and Tailwind for components and styling.
Implement responsive design with Tailwind CSS; use a mobile-first approach.
Files:
frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos/PosFilter.tsxfrontend/plugins/pos_ui/src/modules/types/path/PosPath.tsxfrontend/plugins/pos_ui/src/pages/PosIndexPage.tsxfrontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsxfrontend/plugins/pos_ui/src/modules/states/PosCount.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursorrules)
**/*.tsx: Use functional components with TypeScript interfaces.
Minimize 'useEffect', and 'setState'.
Wrap client components in Suspense with fallback.
Use dynamic loading for non-critical components.
Limit 'use client': Favor server components and Next.js SSR. Use only for Web API access in small components. Avoid for data fetching or state management.
Files:
frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos/PosFilter.tsxfrontend/plugins/pos_ui/src/modules/types/path/PosPath.tsxfrontend/plugins/pos_ui/src/pages/PosIndexPage.tsxfrontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsxfrontend/plugins/pos_ui/src/modules/states/PosCount.tsx
**/*.{webp,tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Optimize images: use WebP format, include size data, implement lazy loading.
Files:
frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos/PosFilter.tsxfrontend/plugins/pos_ui/src/modules/types/path/PosPath.tsxfrontend/plugins/pos_ui/src/pages/PosIndexPage.tsxfrontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsxfrontend/plugins/pos_ui/src/modules/states/PosCount.tsx
🧬 Code graph analysis (4)
frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx (1)
frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsx (2)
LEADS_CURSOR_SESSION_KEY(2-2)POS_CURSOR_SESSION_KEY(1-1)
frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx (9)
frontend/libs/erxes-ui/src/hooks/use-query-state.tsx (1)
useMultiQueryState(57-98)frontend/libs/erxes-ui/src/modules/filter/components/Filter.tsx (1)
Filter(493-512)frontend/libs/erxes-ui/src/components/combobox.tsx (1)
Combobox(200-208)frontend/libs/erxes-ui/src/components/command.tsx (1)
Command(223-233)frontend/libs/ui-modules/src/modules/tags/components/TagsFilter.tsx (1)
TagsFilter(81-84)frontend/libs/ui-modules/src/modules/team-members/components/SelectMember.tsx (1)
SelectMember(463-475)frontend/libs/ui-modules/src/modules/brands/components/SelectBrand.tsx (1)
SelectBrand(344-353)frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx (1)
useIsPosLeadSessionKey(6-16)frontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsx (1)
PosTotalCount(6-17)
frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx (1)
frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx (1)
PosFilter(115-167)
frontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsx (2)
frontend/plugins/pos_ui/src/modules/states/PosCount.tsx (1)
posTotalCountAtom(3-3)frontend/libs/erxes-ui/src/components/skeleton.tsx (1)
Skeleton(3-13)
🪛 dotenv-linter (3.3.0)
.env.sample
[warning] 2-2: [UnorderedKey] The MONGO_URL key should go before the NODE_ENV key
(UnorderedKey)
[warning] 3-3: [DuplicatedKey] The MONGO_URL key is duplicated
(DuplicatedKey)
[warning] 3-3: [UnorderedKey] The MONGO_URL key should go before the MONGO_URL key
(UnorderedKey)
[warning] 5-5: [UnorderedKey] The ENABLED_PLUGINS key should go before the MONGO_URL key
(UnorderedKey)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Sourcery review
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
package.json (1)
9-11: Excellent addition of formatting scripts!The new
formatandformat:checkscripts will help maintain consistent code style across the project. The file patterns cover all relevant source files.frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx (3)
2-2: LGTM!The addition of
PageSubHeaderimport is appropriate for the new filter UI layout.
10-10: LGTM!The
PosFilterimport uses the absolute path alias pattern, which is consistent with the codebase's import strategy.
53-55: LGTM!The integration of
PosFilterwithinPageSubHeaderfollows proper React composition patterns and maintains a clean layout structure.frontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsx (1)
6-17: LGTM!The component correctly:
- Uses
useAtomValuefor read-only access to the atom- Provides a Skeleton loading state for better UX
- Displays the count with clear messaging
The implementation is clean and follows React best practices.
frontend/plugins/pos_ui/src/modules/states/PosCount.tsx (1)
1-3: LGTM!The atom declaration is correctly typed and initialized. The
number | nulltype appropriately handles both the loaded state (count value) and the initial/loading state (null).frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsx (1)
1-2: LGTM!The session key constants are well-named and follow naming conventions. Using constants for session keys helps prevent typos and makes refactoring easier.
frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx (1)
10-15: LGTM!The return structure is clear and provides both the boolean flag and the appropriate session key for downstream consumers.
.env.sample (1)
5-5: Tourism plugin directories detected
Verified thatbackend/plugins/tourism_apiandfrontend/plugins/tourism_uiexist and contain implementation code. EnablingtourisminENABLED_PLUGINSis safe.frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx (1)
1-19: LGTM!Import statements follow the coding guidelines correctly, using absolute paths for external packages and appropriate relative paths for local modules. All imports are utilized in the component.
frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx
Outdated
Show resolved
Hide resolved
| const PosFilterPopover = () => { | ||
| const [queries] = useMultiQueryState<{ | ||
| tags: string[]; | ||
| searchValue: string; | ||
| created: string; | ||
| updated: string; | ||
| lastSeen: string; | ||
| brand: string; | ||
| }>(['tags', 'searchValue', 'created', 'updated', 'lastSeen', 'brand']); | ||
|
|
||
| const hasFilters = Object.values(queries || {}).some( | ||
| (value) => value !== null, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add 'birthday' to the query keys array.
The birthday filter is defined in the UI (lines 70-73, 89-91, 107-109) but is missing from the useMultiQueryState query keys array. This causes hasFilters to not detect when the birthday filter is active, resulting in the Filter.Trigger not showing as filtered despite the filter being applied.
Apply this diff to fix the issue:
const [queries] = useMultiQueryState<{
tags: string[];
searchValue: string;
created: string;
updated: string;
lastSeen: string;
brand: string;
- }>(['tags', 'searchValue', 'created', 'updated', 'lastSeen', 'brand']);
+ birthday: string;
+ }>(['tags', 'searchValue', 'created', 'updated', 'lastSeen', 'brand', 'birthday']);📝 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.
| const PosFilterPopover = () => { | |
| const [queries] = useMultiQueryState<{ | |
| tags: string[]; | |
| searchValue: string; | |
| created: string; | |
| updated: string; | |
| lastSeen: string; | |
| brand: string; | |
| }>(['tags', 'searchValue', 'created', 'updated', 'lastSeen', 'brand']); | |
| const hasFilters = Object.values(queries || {}).some( | |
| (value) => value !== null, | |
| ); | |
| const PosFilterPopover = () => { | |
| const [queries] = useMultiQueryState<{ | |
| tags: string[]; | |
| searchValue: string; | |
| created: string; | |
| updated: string; | |
| lastSeen: string; | |
| brand: string; | |
| birthday: string; | |
| }>(['tags', 'searchValue', 'created', 'updated', 'lastSeen', 'brand', 'birthday']); | |
| const hasFilters = Object.values(queries || {}).some( | |
| (value) => value !== null, | |
| ); |
🤖 Prompt for AI Agents
In frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx around lines 20 to 32,
the 'birthday' query key is missing from the useMultiQueryState keys array so
hasFilters doesn't detect the birthday filter; add 'birthday' to the array of
keys passed to useMultiQueryState (i.e., include 'birthday' alongside 'tags',
'searchValue', 'created', 'updated', 'lastSeen', 'brand') so the birthday filter
state is tracked and hasFilters reflects it.
| export const PosFilter = () => { | ||
| const [searchValue] = useFilterQueryState<string>('searchValue'); | ||
| const { sessionKey } = useIsPosLeadSessionKey(); | ||
|
|
||
| return ( | ||
| <Filter id="pos-filter" sessionKey={sessionKey}> | ||
| <Filter.Bar> | ||
| <Filter.BarItem queryKey="searchValue"> | ||
| <Filter.BarName> | ||
| <IconSearch /> | ||
| Search | ||
| </Filter.BarName> | ||
| <Filter.BarButton filterKey="searchValue" inDialog> | ||
| {searchValue} | ||
| </Filter.BarButton> | ||
| </Filter.BarItem> | ||
| <TagsFilter.Bar tagType="core:pos" /> | ||
| <Filter.BarItem queryKey="created"> | ||
| <Filter.BarName> | ||
| <IconCalendarPlus /> | ||
| Created At | ||
| </Filter.BarName> | ||
| <Filter.Date filterKey="created" /> | ||
| </Filter.BarItem> | ||
| <Filter.BarItem queryKey="updated"> | ||
| <Filter.BarName> | ||
| <IconCalendarUp /> | ||
| Updated At | ||
| </Filter.BarName> | ||
| <Filter.Date filterKey="updated" /> | ||
| </Filter.BarItem> | ||
| <Filter.BarItem queryKey="lastSeen"> | ||
| <Filter.BarName> | ||
| <IconCalendarTime /> | ||
| Last Seen At | ||
| </Filter.BarName> | ||
| <Filter.Date filterKey="lastSeen" /> | ||
| </Filter.BarItem> | ||
| <Filter.BarItem queryKey="birthday"> | ||
| <Filter.BarName> | ||
| <IconCalendar /> | ||
| Birthday | ||
| </Filter.BarName> | ||
| <Filter.Date filterKey="birthday" /> | ||
| </Filter.BarItem> | ||
| <SelectMember.FilterBar /> | ||
| <SelectBrand.FilterBar /> | ||
| <PosFilterPopover /> | ||
| <PosTotalCount /> | ||
| </Filter.Bar> | ||
| </Filter> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
LGTM! Consider verifying SelectMember filter detection.
The component structure is well-organized and follows coding guidelines correctly. The use of sessionKey from useIsPosLeadSessionKey ensures proper filter state management between POS and Leads views.
One additional consideration: SelectMember.FilterBar (line 160) may have its own query key (e.g., assignedUserId) that might also be missing from PosFilterPopover's hasFilters check. If SelectMember's filter state doesn't trigger the filtered indicator on the Filter.Trigger, you'll need to add its query key to the array in PosFilterPopover as well.
Run the following script to check what query key SelectMember uses:
🏁 Script executed:
#!/bin/bash
# Description: Find the query key used by SelectMember.FilterBar
# Search for the query key definition in SelectMember components
ast-grep --pattern 'useFilterQueryState$$$' frontend/libs/ui-modules/src/modules/team-members/components/SelectMember.tsx
# Also search for any hardcoded query key strings
rg -n "queryKey.*=" frontend/libs/ui-modules/src/modules/team-members/components/SelectMember.tsxLength of output: 60
Add 'assignedTo' to PosFilterPopover.hasFilters
PosFilterPopover currently doesn’t include the SelectMember default queryKey ('assignedTo') in its hasFilters array, so member selections won’t trigger the active-filter indicator. Update hasFilters in PosFilterPopover to include 'assignedTo'.
🤖 Prompt for AI Agents
In frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx around lines 115 to
167, PosFilterPopover's hasFilters array is missing the SelectMember default
queryKey 'assignedTo', so selecting a member doesn't mark the filter as active;
update the PosFilterPopover component to include 'assignedTo' in its hasFilters
array (add 'assignedTo' alongside the existing keys) so member selections
trigger the active-filter indicator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed d12ba73 in 1 minute and 42 seconds. Click for details.
- Reviewed
69lines of code in4files - Skipped
0files when reviewing. - Skipped posting
4draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .env.sample:3
- Draft comment:
Removed hardcoded production credentials; ensure only safe development values are exposed in the sample. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx:8
- Draft comment:
Using a RegExp with boundary checks improves accuracy over simple substring matching. Consider memoizing the RegExp if this hook is rendered frequently. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
3. frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx:1
- Draft comment:
Refactoring from an enum to a constant object adheres to project standards and improves maintainability. This change looks good. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
4. package.json:9
- Draft comment:
The PR description mentions adding Prettier format scripts, but they were removed here. Confirm if this removal is intentional. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% This comment violates several rules. It's asking for confirmation of intention ("Confirm if this removal is intentional"). It's also making assumptions about what should be in the PR description. The removal of formatting scripts is a straightforward change that the author clearly intended to make. Perhaps the removal of formatting scripts could break the development workflow if other parts of the system depend on these scripts being present. Even if there are dependencies on these scripts, asking for confirmation of intention is not helpful - the author clearly made this change deliberately. If there are actual broken dependencies, they would be caught during testing/CI. This comment should be deleted as it violates the rules against asking for confirmation of intention and making assumptions about PR descriptions.
Workflow ID: wflow_CJI7c3S2QWPsG3Hc
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.env.sample(1 hunks)frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx(1 hunks)frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx(1 hunks)package.json(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Use functional and declarative programming patterns; avoid classes.
Use TypeScript for all code; prefer interfaces over types.
Avoid enums; use maps instead.
Files:
frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Avoid console logs.
Always use absolute paths when importing.
Use the "function" keyword for pure functions.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
**/*.{ts,tsx,js,jsx}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use the "function" keyword for pure functions.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
Use absolute path when import.
Files:
frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{tsx,jsx}: Favor named exports for components.
Use declarative JSX.
Use Shadcn UI, Radix, and Tailwind for components and styling.
Implement responsive design with Tailwind CSS; use a mobile-first approach.
**/*.{tsx,jsx}: Structure files: exported component, subcomponents, helpers, static content, types.
Favor named exports for components.
Use declarative JSX.
Use Shadcn UI, Radix, and Tailwind for components and styling.
Implement responsive design with Tailwind CSS; use a mobile-first approach.
Files:
frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursorrules)
**/*.tsx: Use functional components with TypeScript interfaces.
Minimize 'useEffect', and 'setState'.
Wrap client components in Suspense with fallback.
Use dynamic loading for non-critical components.
Limit 'use client': Favor server components and Next.js SSR. Use only for Web API access in small components. Avoid for data fetching or state management.
Files:
frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx
**/*.{webp,tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Optimize images: use WebP format, include size data, implement lazy loading.
Files:
frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx
🧠 Learnings (1)
📚 Learning: 2025-07-21T06:10:08.710Z
Learnt from: CR
PR: erxes/erxes-next#0
File: .windsurfrules:0-0
Timestamp: 2025-07-21T06:10:08.710Z
Learning: Applies to **/*.{ts,tsx} : Avoid enums; use maps instead.
Applied to files:
frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Sourcery review
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
frontend/plugins/pos_ui/src/modules/types/path/PosPath.tsx (1)
1-9: LGTM! Correctly follows coding guidelines.The implementation correctly uses a const object with
as constinstead of an enum, adhering to the project's coding guidelines. The pattern of using the same name for both the const and the type is a common TypeScript idiom that provides good ergonomics.Based on learnings and coding guidelines.
| @@ -1,4 +1,4 @@ | |||
| REACT_APP_API_URL=http://localhost:4000 | |||
| REACT_APP_API_URL=http://localhost:4000/ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Verify trailing slash handling in API URL usage.
The trailing slash added to REACT_APP_API_URL could cause double-slash issues (e.g., http://localhost:4000//api/endpoint) if the code concatenates paths without accounting for it. Ensure all API calls handle this correctly.
Run the following script to check how the API URL is used throughout the codebase:
🏁 Script executed:
#!/bin/bash
# Description: Find usages of REACT_APP_API_URL to verify trailing slash handling
# Search for direct usage of REACT_APP_API_URL
rg -n "REACT_APP_API_URL" --type ts --type tsx --type js --type jsx -C3
# Search for common API call patterns that might concatenate URLs
rg -n "process\.env\.REACT_APP_API_URL\s*\+\s*['\"]/" --type ts --type tsx --type js --type jsx -C3Length of output: 55
🏁 Script executed:
#!/bin/bash
# Broad search for REACT_APP_API_URL usages
rg -n "REACT_APP_API_URL" -C3
# Search for concatenation patterns
rg -n "process\.env\.REACT_APP_API_URL\s*\+" -C3
# Search for template literal usage
rg -n "\`.*process\.env\.REACT_APP_API_URL.*\`" -C3Length of output: 16087
Normalize or remove trailing slash in REACT_APP_API_URL
.env.sample currently defines REACT_APP_API_URL=http://localhost:4000/, which leads to URLs like http://localhost:4000//upload-file when concatenated. Either drop the trailing slash in .env.sample or strip it at runtime (e.g. envApiUrl.replace(/\/$/, '')) before appending paths.
🤖 Prompt for AI Agents
In .env.sample around line 1, REACT_APP_API_URL includes a trailing slash which
can produce double-slash URLs when concatenating paths; remove the trailing
slash from the sample value (change to http://localhost:4000) or, alternatively,
ensure the app normalizes the env value at startup by stripping any trailing
slash (e.g., call a single-strip operation like replace(/\/$/, '') on the loaded
REACT_APP_API_URL) before using it to build endpoint paths so concatenation
never produces duplicate slashes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ene odoo yajiinaa mi hu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ene odoo yajiinaa mi hu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KhBaterdene Thank you for confirming! If you've verified that the trailing slash works correctly with your API endpoint handling, that's great. The change looks good to proceed.
Just for future reference, if you notice any double-slash issues in API URLs (like http://localhost:4000//api/...), you'll know the trailing slash in the .env file is the place to adjust. ✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KhBaterdene Glad to hear it's working well now! 🎉
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed 9544c7a in 1 minute and 25 seconds. Click for details.
- Reviewed
273lines of code in7files - Skipped
0files when reviewing. - Skipped posting
5draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx:1
- Draft comment:
Consider importing useLocation from 'react-router-dom' rather than 'react-router' for consistency with other routing hooks. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While the suggestion might be valid, we don't have strong evidence that 'react-router-dom' is actually the standard in this codebase. The comment is speculative without showing examples of other files using react-router-dom. Additionally, both packages would work since react-router-dom re-exports from react-router. The import from react-router will work perfectly fine technically. Without seeing other files in the codebase, we can't verify if this consistency suggestion is valid. Even if other files use react-router-dom, this is a minor consistency issue that doesn't affect functionality, and we don't have strong evidence it's actually inconsistent. Delete the comment as it makes a consistency suggestion without providing concrete evidence that there's actually an inconsistency.
2. frontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsx:8
- Draft comment:
Consider memoizing the regex (or moving it outside the hook) to avoid recreating it on every render, since PosPath.Leads is constant. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
3. frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx:30
- Draft comment:
Consider using a less strict null check (e.g. 'value != null') so that both null and undefined values are handled. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
4. frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx:19
- Draft comment:
Avoid using relative imports (e.g. '../pos-detail/hooks/UsePosLeadSessionKey') if project standards require absolute imports. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment makes a speculative assumption about project standards without clear evidence. Looking at the imports in this file, there seems to be a mix of both relative and absolute imports being used, suggesting there may not be a strict standard. Without access to project documentation or clear evidence of the required import style, this comment is making assumptions. The project could have a documented standard for imports that I don't have access to. The mix of import styles in the file could actually be a problem that needs to be fixed. Even if there is a standard, this comment is speculative ("if project standards require"). We should only keep comments that have clear evidence of being correct. Delete this comment as it makes assumptions about project standards without clear evidence, and the existing code shows mixed usage of import styles.
5. frontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsx:2
- Draft comment:
There's an extra trailing whitespace at the end of the line. Consider removing it for consistency. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment is technically correct about the trailing whitespace, this is an extremely minor formatting issue that would typically be handled by automated formatting tools or linters. It doesn't affect functionality and is not a significant code quality issue. Most IDEs automatically trim trailing whitespace on save. The comment is factually accurate and does promote consistent code formatting. Some teams might consider whitespace consistency important for their codebase. However, this is too minor of an issue to warrant a PR comment. This kind of formatting should be handled by automated tools rather than manual review comments. Delete this comment as it addresses an extremely minor formatting issue that doesn't warrant manual intervention in code review.
Workflow ID: wflow_tjInak9o1wGjHvIq
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 15
♻️ Duplicate comments (1)
frontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/OrderCommandBar.tsx (1)
17-21: Depends on broken delete wiring.This builds the
orderIdsstring for<OrderDelete />, but sinceOrderDeletecurrently calls the POS deletion mutation, the whole action is broken. Please fix the delete component as noted so this command bar performs an order deletion.
🧹 Nitpick comments (8)
frontend/plugins/pos_ui/tsconfig.app.json (1)
22-22: Avoid hard-coding cross-project file paths ininclude.Listing individual files from
../sales_ui/...makes this config brittle—any file move or addition forces a tsconfig edit, and Nx/TypeScript can’t treat the shared code as a proper dependency. Please promote the shared pieces into a workspace library (or at least reference the containing directory/glob) so both plugins resolve them via a stable path alias instead of per-file includes.frontend/plugins/sales_ui/src/modules/pos/types/path/PosPath.tsx (1)
1-9: Consider renaming for clarity.The constant name
PosPathmight be misleading. The paths defined here ('/contacts', '/customers', '/leads', etc.) appear to be contact/customer management routes rather than Point of Sale (POS) routes. Consider renaming to something likeContactPathorContactManagementPathto better reflect the actual purpose.frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsx (1)
92-99: Consider expanding query parameters for filtering.The current
commonParamDefsonly includes pagination parameters (page,perPage). Comparing with other queries in the codebase (e.g.,StagesQueries.ts), you might want to add common filtering parameters such assearch,customerIds,assignedUserIds, date filters, etc., to enable more comprehensive POS filtering in the UI.frontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsx (1)
1-1: Note: Filename typo.The directory name "breadcumb" should be "breadcrumb". While this doesn't affect functionality, it may cause confusion for developers. Consider renaming the directory for correctness.
frontend/plugins/sales_ui/src/pages/PosIndexPage.tsx (1)
5-11: Standardize import aliases
tsconfig.json maps both@/and~/; consolidate all imports in this file to a single alias for consistency.frontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsx (1)
164-168: Surface the actual error message in the toast.
description: e as stringcoerces Error objects to[object Object], so the failure toast is unhelpful. Convert to a string safely (e.g.e instanceof Error ? e.message : String(e)) so the toast shows the real error.- toast({ - variant: 'destructive', - title: 'Failed to copy link', - description: e as string, - }); + toast({ + variant: 'destructive', + title: 'Failed to copy link', + description: e instanceof Error ? e.message : String(e), + });frontend/plugins/sales_ui/src/config.tsx (2)
9-9: Use absolute imports instead of relative paths.The import paths use relative references (
./modules/navigation/...). Per coding guidelines, absolute paths should be used for all imports.Example:
- import('./modules/navigation/SalesNavigation').then((module) => ({ + import('@/plugins/sales_ui/src/modules/navigation/SalesNavigation').then((module) => ({Similarly for PosOrderNavigation on line 15.
Also applies to: 15-15
20-57: Add TypeScript interface for CONFIG.The
CONFIGobject lacks a type annotation. Per coding guidelines, TypeScript should be used for all code with interfaces preferred over types. Consider defining an interface for the configuration structure to improve type safety.Example:
interface PluginConfig { name: string; icon: React.ComponentType; hasRelationWidget: boolean; widgetsIcon: React.ComponentType; navigationGroup: { name: string; icon: React.ComponentType; content: () => JSX.Element; subGroups?: () => JSX.Element; }; modules: Array<{ name: string; icon: React.ComponentType; path: string; hasSettings: boolean; hasRelationWidget: boolean; hasFloatingWidget: boolean; }>; } export const CONFIG: PluginConfig = { // ... existing config };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (36)
frontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsx(1 hunks)frontend/plugins/operation_ui/module-federation.config.ts(1 hunks)frontend/plugins/operation_ui/src/modules/main/Main.tsx(0 hunks)frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx(2 hunks)frontend/plugins/pos_ui/tsconfig.app.json(1 hunks)frontend/plugins/sales_ui/module-federation.config.ts(1 hunks)frontend/plugins/sales_ui/src/config.tsx(2 hunks)frontend/plugins/sales_ui/src/modules/SalesNavigation.tsx(0 hunks)frontend/plugins/sales_ui/src/modules/deals/Main.tsx(0 hunks)frontend/plugins/sales_ui/src/modules/main/Main.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/navigation/SalesNavigation.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/orders/components/OrderRecordTable.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/orders/components/columns.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/OrderCommandBar.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/delete/delete.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/orders/components/ordersMoreColumn.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/orders/hooks/useOrdersList.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/PosNavigation.tsx(0 hunks)frontend/plugins/sales_ui/src/modules/pos/constants/PosCursorSessionKey.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/graphql/queries.ts(2 hunks)frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/hooks/useGetCurrentUsersPos.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/hooks/useGetPos.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/pos-detail/hooks/UsePosLeadSessionKey.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/pos/PosTotalCount.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/states/PosCount.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/states/orderDetail.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/types/order.ts(1 hunks)frontend/plugins/sales_ui/src/modules/pos/types/path/PosPath.tsx(1 hunks)frontend/plugins/sales_ui/src/modules/pos/types/pos.ts(1 hunks)frontend/plugins/sales_ui/src/pages/OrdersPage.tsx(1 hunks)frontend/plugins/sales_ui/src/pages/PosIndexPage.tsx(2 hunks)frontend/plugins/sales_ui/src/pages/SalesIndexPage.tsx(0 hunks)
💤 Files with no reviewable changes (5)
- frontend/plugins/sales_ui/src/pages/SalesIndexPage.tsx
- frontend/plugins/operation_ui/src/modules/main/Main.tsx
- frontend/plugins/sales_ui/src/modules/pos/PosNavigation.tsx
- frontend/plugins/sales_ui/src/modules/deals/Main.tsx
- frontend/plugins/sales_ui/src/modules/SalesNavigation.tsx
✅ Files skipped from review due to trivial changes (1)
- frontend/plugins/operation_ui/module-federation.config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Use functional and declarative programming patterns; avoid classes.
Use TypeScript for all code; prefer interfaces over types.
Avoid enums; use maps instead.
Files:
frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsxfrontend/plugins/sales_ui/src/modules/pos/types/pos.tsfrontend/plugins/sales_ui/src/modules/pos/states/PosCount.tsxfrontend/plugins/sales_ui/src/modules/navigation/SalesNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosTotalCount.tsxfrontend/plugins/sales_ui/src/modules/orders/components/OrderRecordTable.tsxfrontend/plugins/sales_ui/src/modules/pos/types/path/PosPath.tsxfrontend/plugins/sales_ui/src/modules/pos/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsxfrontend/plugins/sales_ui/module-federation.config.tsfrontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsxfrontend/plugins/sales_ui/src/modules/orders/hooks/useOrdersList.tsxfrontend/plugins/sales_ui/src/modules/pos/types/order.tsfrontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/delete/delete.tsxfrontend/plugins/sales_ui/src/pages/OrdersPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/ordersMoreColumn.tsxfrontend/plugins/sales_ui/src/modules/pos/constants/PosCursorSessionKey.tsxfrontend/plugins/sales_ui/src/modules/main/Main.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetPos.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetCurrentUsersPos.tsxfrontend/plugins/sales_ui/src/modules/orders/components/columns.tsxfrontend/plugins/sales_ui/src/pages/PosIndexPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/OrderCommandBar.tsxfrontend/plugins/sales_ui/src/modules/pos/graphql/queries.tsfrontend/plugins/sales_ui/src/modules/pos/states/orderDetail.tsxfrontend/plugins/sales_ui/src/config.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Avoid console logs.
Always use absolute paths when importing.
Use the "function" keyword for pure functions.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
**/*.{ts,tsx,js,jsx}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use the "function" keyword for pure functions.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
Use absolute path when import.
Files:
frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsxfrontend/plugins/sales_ui/src/modules/pos/types/pos.tsfrontend/plugins/sales_ui/src/modules/pos/states/PosCount.tsxfrontend/plugins/sales_ui/src/modules/navigation/SalesNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosTotalCount.tsxfrontend/plugins/sales_ui/src/modules/orders/components/OrderRecordTable.tsxfrontend/plugins/sales_ui/src/modules/pos/types/path/PosPath.tsxfrontend/plugins/sales_ui/src/modules/pos/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsxfrontend/plugins/sales_ui/module-federation.config.tsfrontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsxfrontend/plugins/sales_ui/src/modules/orders/hooks/useOrdersList.tsxfrontend/plugins/sales_ui/src/modules/pos/types/order.tsfrontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/delete/delete.tsxfrontend/plugins/sales_ui/src/pages/OrdersPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/ordersMoreColumn.tsxfrontend/plugins/sales_ui/src/modules/pos/constants/PosCursorSessionKey.tsxfrontend/plugins/sales_ui/src/modules/main/Main.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetPos.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetCurrentUsersPos.tsxfrontend/plugins/sales_ui/src/modules/orders/components/columns.tsxfrontend/plugins/sales_ui/src/pages/PosIndexPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/OrderCommandBar.tsxfrontend/plugins/sales_ui/src/modules/pos/graphql/queries.tsfrontend/plugins/sales_ui/src/modules/pos/states/orderDetail.tsxfrontend/plugins/sales_ui/src/config.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{tsx,jsx}: Favor named exports for components.
Use declarative JSX.
Use Shadcn UI, Radix, and Tailwind for components and styling.
Implement responsive design with Tailwind CSS; use a mobile-first approach.
**/*.{tsx,jsx}: Structure files: exported component, subcomponents, helpers, static content, types.
Favor named exports for components.
Use declarative JSX.
Use Shadcn UI, Radix, and Tailwind for components and styling.
Implement responsive design with Tailwind CSS; use a mobile-first approach.
Files:
frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsxfrontend/plugins/sales_ui/src/modules/pos/states/PosCount.tsxfrontend/plugins/sales_ui/src/modules/navigation/SalesNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosTotalCount.tsxfrontend/plugins/sales_ui/src/modules/orders/components/OrderRecordTable.tsxfrontend/plugins/sales_ui/src/modules/pos/types/path/PosPath.tsxfrontend/plugins/sales_ui/src/modules/pos/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsxfrontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsxfrontend/plugins/sales_ui/src/modules/orders/hooks/useOrdersList.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/delete/delete.tsxfrontend/plugins/sales_ui/src/pages/OrdersPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/ordersMoreColumn.tsxfrontend/plugins/sales_ui/src/modules/pos/constants/PosCursorSessionKey.tsxfrontend/plugins/sales_ui/src/modules/main/Main.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetPos.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetCurrentUsersPos.tsxfrontend/plugins/sales_ui/src/modules/orders/components/columns.tsxfrontend/plugins/sales_ui/src/pages/PosIndexPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/OrderCommandBar.tsxfrontend/plugins/sales_ui/src/modules/pos/states/orderDetail.tsxfrontend/plugins/sales_ui/src/config.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursorrules)
**/*.tsx: Use functional components with TypeScript interfaces.
Minimize 'useEffect', and 'setState'.
Wrap client components in Suspense with fallback.
Use dynamic loading for non-critical components.
Limit 'use client': Favor server components and Next.js SSR. Use only for Web API access in small components. Avoid for data fetching or state management.
Files:
frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsxfrontend/plugins/sales_ui/src/modules/pos/states/PosCount.tsxfrontend/plugins/sales_ui/src/modules/navigation/SalesNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosTotalCount.tsxfrontend/plugins/sales_ui/src/modules/orders/components/OrderRecordTable.tsxfrontend/plugins/sales_ui/src/modules/pos/types/path/PosPath.tsxfrontend/plugins/sales_ui/src/modules/pos/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsxfrontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsxfrontend/plugins/sales_ui/src/modules/orders/hooks/useOrdersList.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/delete/delete.tsxfrontend/plugins/sales_ui/src/pages/OrdersPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/ordersMoreColumn.tsxfrontend/plugins/sales_ui/src/modules/pos/constants/PosCursorSessionKey.tsxfrontend/plugins/sales_ui/src/modules/main/Main.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetPos.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetCurrentUsersPos.tsxfrontend/plugins/sales_ui/src/modules/orders/components/columns.tsxfrontend/plugins/sales_ui/src/pages/PosIndexPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/OrderCommandBar.tsxfrontend/plugins/sales_ui/src/modules/pos/states/orderDetail.tsxfrontend/plugins/sales_ui/src/config.tsx
**/*.{webp,tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Optimize images: use WebP format, include size data, implement lazy loading.
Files:
frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsxfrontend/plugins/sales_ui/src/modules/pos/states/PosCount.tsxfrontend/plugins/sales_ui/src/modules/navigation/SalesNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosTotalCount.tsxfrontend/plugins/sales_ui/src/modules/orders/components/OrderRecordTable.tsxfrontend/plugins/sales_ui/src/modules/pos/types/path/PosPath.tsxfrontend/plugins/sales_ui/src/modules/pos/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsxfrontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsxfrontend/plugins/sales_ui/src/modules/orders/hooks/useOrdersList.tsxfrontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/delete/delete.tsxfrontend/plugins/sales_ui/src/pages/OrdersPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/ordersMoreColumn.tsxfrontend/plugins/sales_ui/src/modules/pos/constants/PosCursorSessionKey.tsxfrontend/plugins/sales_ui/src/modules/main/Main.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetPos.tsxfrontend/plugins/sales_ui/src/modules/pos/hooks/useGetCurrentUsersPos.tsxfrontend/plugins/sales_ui/src/modules/orders/components/columns.tsxfrontend/plugins/sales_ui/src/pages/PosIndexPage.tsxfrontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/OrderCommandBar.tsxfrontend/plugins/sales_ui/src/modules/pos/states/orderDetail.tsxfrontend/plugins/sales_ui/src/config.tsx
🧬 Code graph analysis (21)
frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsx (1)
frontend/plugins/sales_ui/src/modules/deals/graphql/queries/StagesQueries.ts (1)
commonParamDefs(26-47)
frontend/plugins/sales_ui/src/modules/navigation/SalesNavigation.tsx (1)
frontend/libs/erxes-ui/src/modules/navigation-menu/components/NavigationMenu.tsx (1)
NavigationMenuLinkItem(7-56)
frontend/plugins/sales_ui/src/modules/pos/pos/PosTotalCount.tsx (2)
frontend/plugins/sales_ui/src/modules/pos/states/PosCount.tsx (1)
posTotalCountAtom(3-3)frontend/libs/erxes-ui/src/components/skeleton.tsx (1)
Skeleton(3-13)
frontend/plugins/sales_ui/src/modules/orders/components/OrderRecordTable.tsx (4)
frontend/plugins/sales_ui/src/modules/orders/hooks/useOrdersList.tsx (1)
useOrdersList(8-64)frontend/libs/erxes-ui/src/modules/record-table/index.ts (1)
RecordTable(23-40)frontend/plugins/sales_ui/src/modules/orders/components/columns.tsx (1)
orderColumns(21-123)frontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/OrderCommandBar.tsx (1)
OrderCommandBar(6-30)
frontend/plugins/sales_ui/src/modules/pos/pos-detail/hooks/UsePosLeadSessionKey.tsx (2)
frontend/plugins/sales_ui/src/modules/pos/types/path/PosPath.tsx (2)
PosPath(1-8)PosPath(9-9)frontend/plugins/sales_ui/src/modules/pos/constants/PosCursorSessionKey.tsx (2)
LEADS_CURSOR_SESSION_KEY(2-2)POS_CURSOR_SESSION_KEY(1-1)
frontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsx (8)
frontend/libs/erxes-ui/src/components/skeleton.tsx (1)
Skeleton(3-13)frontend/libs/erxes-ui/src/components/sidebar.tsx (1)
Sidebar(744-768)frontend/libs/erxes-ui/src/modules/icons/components/IconComponent.tsx (1)
IconComponent(5-13)frontend/libs/erxes-ui/src/components/text-overflow.tsx (1)
TextOverflowTooltip(10-56)frontend/libs/erxes-ui/src/modules/navigation-menu/components/NavigationMenu.tsx (2)
NavigationMenuLinkItem(7-56)NavigationMenuGroup(81-112)frontend/libs/ui-modules/src/states/currentUserState.ts (1)
currentUserState(4-4)frontend/plugins/sales_ui/src/modules/pos/hooks/useGetPos.tsx (1)
useGetPos(10-16)frontend/libs/erxes-ui/src/components/dropdown-menu.tsx (1)
DropdownMenu(171-186)
frontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsx (10)
frontend/libs/erxes-ui/src/hooks/use-query-state.tsx (1)
useMultiQueryState(57-98)frontend/libs/erxes-ui/src/modules/filter/components/Filter.tsx (1)
Filter(493-512)frontend/libs/erxes-ui/src/components/combobox.tsx (1)
Combobox(200-208)frontend/libs/erxes-ui/src/components/command.tsx (1)
Command(223-233)frontend/libs/ui-modules/src/modules/tags/components/TagsFilter.tsx (1)
TagsFilter(81-84)frontend/libs/ui-modules/src/modules/team-members/components/SelectMember.tsx (1)
SelectMember(463-475)frontend/libs/ui-modules/src/modules/brands/components/SelectBrand.tsx (1)
SelectBrand(344-353)frontend/plugins/pos_ui/src/modules/pos/PosFilter.tsx (1)
PosFilter(115-167)frontend/plugins/sales_ui/src/modules/pos/pos-detail/hooks/UsePosLeadSessionKey.tsx (1)
useIsPosLeadSessionKey(7-16)frontend/plugins/sales_ui/src/modules/pos/pos/PosTotalCount.tsx (1)
PosTotalCount(5-16)
frontend/plugins/sales_ui/src/modules/orders/hooks/useOrdersList.tsx (1)
frontend/plugins/sales_ui/src/modules/pos/types/order.ts (1)
IOrder(11-22)
frontend/plugins/sales_ui/src/modules/pos/types/order.ts (1)
frontend/plugins/sales_ui/src/modules/pos/types/pos.ts (1)
IUser(1-9)
frontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsx (4)
frontend/plugins/sales_ui/src/modules/pos/hooks/useGetCurrentUsersPos.tsx (1)
useGetCurrentUsersPos(11-27)frontend/libs/erxes-ui/src/components/skeleton.tsx (1)
Skeleton(3-13)frontend/libs/erxes-ui/src/components/breadcrumb.tsx (1)
Breadcrumb(109-116)frontend/libs/erxes-ui/src/modules/icons/components/IconComponent.tsx (1)
IconComponent(5-13)
frontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/delete/delete.tsx (1)
frontend/libs/erxes-ui/src/hooks/use-confirm.tsx (1)
useConfirm(133-181)
frontend/plugins/sales_ui/src/pages/OrdersPage.tsx (6)
frontend/libs/ui-modules/src/modules/header/components/PageHeader.tsx (1)
PageHeader(186-190)frontend/libs/erxes-ui/src/components/breadcrumb.tsx (1)
Breadcrumb(109-116)frontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsx (1)
PosBreadCrumb(5-26)frontend/libs/erxes-ui/src/components/separator.tsx (1)
Separator(48-50)frontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsx (1)
PosFilter(117-169)frontend/plugins/sales_ui/src/modules/orders/components/OrderRecordTable.tsx (1)
OrderRecordTable(6-39)
frontend/plugins/sales_ui/src/modules/orders/components/ordersMoreColumn.tsx (3)
frontend/plugins/sales_ui/src/modules/pos/types/order.ts (1)
IOrder(11-22)frontend/plugins/sales_ui/src/modules/pos/states/orderDetail.tsx (1)
renderingOrderDetailAtom(3-3)frontend/libs/erxes-ui/src/modules/record-table/index.ts (1)
RecordTable(23-40)
frontend/plugins/sales_ui/src/modules/main/Main.tsx (1)
frontend/libs/erxes-ui/src/components/spinner.tsx (1)
Spinner(40-132)
frontend/plugins/sales_ui/src/modules/pos/hooks/useGetPos.tsx (2)
frontend/plugins/sales_ui/src/modules/pos/types/pos.ts (1)
IPos(11-22)frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsx (1)
POS_LIST(100-114)
frontend/plugins/sales_ui/src/modules/pos/hooks/useGetCurrentUsersPos.tsx (3)
frontend/plugins/sales_ui/src/modules/pos/types/pos.ts (1)
IPos(11-22)frontend/libs/ui-modules/src/states/currentUserState.ts (1)
currentUserState(4-4)frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsx (1)
POS_LIST(100-114)
frontend/plugins/sales_ui/src/modules/orders/components/columns.tsx (6)
frontend/plugins/sales_ui/src/modules/pos/types/order.ts (1)
IOrder(11-22)frontend/plugins/sales_ui/src/modules/orders/components/ordersMoreColumn.tsx (1)
ordersMoreColumn(35-39)frontend/libs/erxes-ui/src/modules/record-table/index.ts (1)
RecordTable(23-40)frontend/libs/erxes-ui/src/modules/record-table/components/RecordTableCellInline.tsx (1)
RecordTableInlineCell(100-104)frontend/libs/erxes-ui/src/components/text-overflow.tsx (1)
TextOverflowTooltip(10-56)frontend/libs/erxes-ui/src/components/badge.tsx (1)
Badge(34-60)
frontend/plugins/sales_ui/src/pages/PosIndexPage.tsx (3)
frontend/libs/ui-modules/src/modules/header/components/PageHeader.tsx (1)
PageHeader(186-190)frontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsx (1)
PosFilter(117-169)frontend/plugins/sales_ui/src/modules/orders/components/OrderRecordTable.tsx (1)
OrderRecordTable(6-39)
frontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/OrderCommandBar.tsx (4)
frontend/libs/erxes-ui/src/modules/record-table/index.ts (1)
RecordTable(23-40)frontend/libs/erxes-ui/src/components/command-bar.tsx (1)
CommandBar(105-108)frontend/libs/erxes-ui/src/components/separator.tsx (1)
Separator(48-50)frontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/delete/delete.tsx (1)
OrderDelete(13-57)
frontend/plugins/sales_ui/src/modules/pos/graphql/queries.ts (2)
frontend/plugins/sales_ui/src/modules/deals/graphql/queries/StagesQueries.ts (1)
commonParamDefs(26-47)frontend/plugins/sales_ui/src/modules/pos/graphql/queries/getPos.tsx (1)
posCommonFields(2-59)
frontend/plugins/sales_ui/src/config.tsx (1)
frontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsx (1)
PosOrderNavigation(135-150)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (12)
frontend/plugins/sales_ui/src/modules/pos/types/pos.ts (1)
14-14: LGTM!The addition of the
iconfield to theIPosinterface is straightforward and aligns with the UI components that render POS items with icons.frontend/plugins/sales_ui/src/modules/pos/states/PosCount.tsx (1)
1-3: LGTM!The
posTotalCountAtomdeclaration follows Jotai best practices. Thenumber | nulltype is appropriate for representing an unloaded or loaded count state.frontend/plugins/sales_ui/src/modules/pos/constants/PosCursorSessionKey.tsx (1)
1-2: LGTM!The session key constants are clearly named and appropriately scoped.
frontend/plugins/sales_ui/src/modules/pos/hooks/useGetPos.tsx (1)
1-16: LGTM!The hook implementation is clean and follows React and Apollo best practices. The use of absolute imports aligns with the coding guidelines.
frontend/plugins/sales_ui/module-federation.config.ts (1)
19-19: Confirm consumer imports updated: no occurrences of './deals' found—ensure all external remotes have been updated to import './sales' instead of './deals'.frontend/plugins/sales_ui/src/modules/pos/states/orderDetail.tsx (1)
1-3: LGTM!The atom definition is clean and follows Jotai best practices. The boolean initialization is appropriate for controlling UI rendering state.
frontend/plugins/sales_ui/src/modules/navigation/SalesNavigation.tsx (1)
3-10: LGTM!The component follows coding guidelines with a functional approach, named export, and declarative JSX. The navigation structure is clear and appropriate.
frontend/plugins/sales_ui/src/pages/PosIndexPage.tsx (1)
54-57: LGTM!The addition of PosFilter in a PageHeader and OrderRecordTable properly integrates the new filtering and table components. The layout structure is clean and follows the established pattern.
frontend/plugins/sales_ui/src/modules/pos/pos/PosTotalCount.tsx (1)
5-16: LGTM!The component correctly uses Jotai's
useAtomValuefor reading state, provides a loading skeleton for better UX, and follows coding guidelines with functional patterns and named exports.frontend/plugins/sales_ui/src/pages/OrdersPage.tsx (1)
9-34: LGTM!The page structure is well-organized with conditional breadcrumb rendering, proper filter placement, and clean integration of the OrderRecordTable component. The use of
posIdto conditionally render the breadcrumb is appropriate.frontend/plugins/sales_ui/src/config.tsx (2)
33-37: LGTM! Proper lazy loading pattern for subGroups.The subGroups integration follows the same lazy-loading pattern as the main content, with proper Suspense boundary and fallback.
52-54: Verify disabled settings for POS module.Similar to the sales module,
hasSettingsis nowfalse(line 52). Confirm this change is intentional and that POS settings UI (if it existed) is being properly removed or relocated.
| name: 'sales', | ||
| icon: IconBriefcase, | ||
| path: 'sales', | ||
| hasSettings: false, | ||
| hasRelationWidget: true, | ||
| hasFloatingWidget: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify breaking changes: module rename and disabled settings.
This segment contains potentially breaking changes:
- Module renamed from
'deals'to'sales'(lines 41, 43) — any code referencing the'deals'module or routing to/dealswill break hasSettingschanged tofalse(line 44) — this disables settings UI that may have been previously accessible
Ensure these changes are intentional and that:
- All references to the
'deals'module/route are updated - Removal of settings functionality is coordinated (or was never implemented)
Run the following script to verify references to the old module name and settings usage:
🏁 Script executed:
#!/bin/bash
# Search for references to 'deals' module that might break
rg -nP --type=ts --type=tsx -C3 "['\"](deals)['\"]|/deals\b" -g '!frontend/plugins/sales_ui/src/config.tsx'
# Search for hasSettings usage to understand impact
rg -nP --type=ts --type=tsx -C3 'hasSettings' -g '!frontend/plugins/sales_ui/src/config.tsx'Length of output: 55
🏁 Script executed:
#!/bin/bash
# Search for references to 'deals' module or route outside config.tsx
rg -nP -C3 "(\"deals\"|'deals')|/deals\b" -g '!frontend/plugins/sales_ui/src/config.tsx'
# Search for any usage of hasSettings outside config.tsx
rg -nP -C3 'hasSettings' -g '!frontend/plugins/sales_ui/src/config.tsx'Length of output: 297
🏁 Script executed:
#!/bin/bash
# Unfiltered search for references to 'deals' module or route
rg -nP -C3 "(\"deals\"|'deals')|/deals\b"
# Unfiltered search for any usage of hasSettings
rg -nP -C3 'hasSettings'Length of output: 106095
Update all references after renaming ‘deals’ to ‘sales’ and disabling settings
- Replace import paths (
@/deals/…) and routes (/deals,/settings/deals) to usesales - Update backend plugin registrations and tRPC calls still referencing
module: 'deals' - Review
hasSettings: false—remove or adjust settings links/UI in SalesIndexPage and StagesList
🤖 Prompt for AI Agents
In frontend/plugins/sales_ui/src/config.tsx around lines 41 to 46, the plugin
was renamed from “deals” to “sales” and settings were disabled, but many
references remain unchanged; update all frontend import paths and route strings
from "@/deals/..." and "/deals" or "/settings/deals" to use "sales" and "/sales"
respectively, update any backend plugin registration and trpc/module identifiers
that still use module: 'deals' to module: 'sales', and remove or hide settings
links/UI in SalesIndexPage and StagesList (or conditionally render them based on
hasSettings: false) so the UI no longer shows settings actions for this plugin.
| <Route path="/pos" element={<Navigate to="orders" replace />} /> | ||
| <Route path="/pos/:posId/orders" element={<OrdersMain />} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redirect is missing the required posId.
Navigating to /pos ends up at /orders (or /pos/orders), but no such route exists; only /pos/:posId/orders is defined. Users hitting /pos will land on a 404. Please redirect to a concrete route that includes a valid posId (e.g., fetch the default POS first, then navigate to /pos/<id>/orders).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eniig harsan uu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KhBaterdene Yes, I've reviewed this route configuration. The issue I flagged is still present in the current code:
The Problem:
Line 29 redirects /pos to the relative path "orders", which resolves to /pos/orders. However, your route definition on line 30 is /pos/:posId/orders, which requires a posId parameter. This mismatch will cause a 404 error when users navigate to /pos.
Suggested Fix:
You have a few options:
- Fetch a default POS and redirect to it:
<Route path="/pos" element={<PosRedirect />} />Where PosRedirect is a component that fetches the user's first POS and redirects to /pos/<posId>/orders
- Add an intermediary route:
<Route path="/pos" element={<Navigate to="/deals" replace />} />Redirect to deals instead if there's no default POS
- Add a route without posId:
<Route path="/pos/orders" element={<OrdersMain />} />
<Route path="/pos/:posId/orders" element={<OrdersMain />} />And handle the missing posId inside the OrdersMain component
Which approach would work best for your use case?
| const posLink = `${window.location.origin}/operation/pos/${pos._id}/orders`; | ||
| try { | ||
| await navigator.clipboard.writeText(posLink); | ||
| toast({ | ||
| variant: 'default', | ||
| title: 'Link copied to clipboard', | ||
| }); | ||
| } catch (e) { | ||
| toast({ | ||
| variant: 'destructive', | ||
| title: 'Failed to copy link', | ||
| description: e as string, | ||
| }); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <DropdownMenu> | ||
| <DropdownMenu.Trigger asChild> | ||
| <Button | ||
| variant="ghost" | ||
| size="icon" | ||
| className="invisible group-hover/trigger:visible absolute top-1/2 -translate-y-1/2 right-1 text-muted-foreground" | ||
| onClick={(e) => { | ||
| e.stopPropagation(); | ||
| }} | ||
| > | ||
| <IconDotsVertical className="size-4" /> | ||
| </Button> | ||
| </DropdownMenu.Trigger> | ||
| <DropdownMenu.Content side="right" align="start" className="w-60 min-w-0"> | ||
| <DropdownMenu.Item | ||
| className="cursor-pointer" | ||
| onSelect={(e) => { | ||
| navigate(`/settings/operation/pos/details/${pos._id}`); | ||
| }} | ||
| > | ||
| <IconSettings className="size-4" /> | ||
| Go to pos settings | ||
| </DropdownMenu.Item> | ||
| <DropdownMenu.Item | ||
| onSelect={(e) => { | ||
| handleCopyLink(); | ||
| }} | ||
| className="cursor-pointer" | ||
| > | ||
| <IconLink className="size-4" /> | ||
| Copy link | ||
| </DropdownMenu.Item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the copied orders link path.
handleCopyLink builds /operation/pos/${pos._id}/orders, but the Orders navigation item above routes to /sales/pos/${pos._id}/orders. Users who click “Copy link” will land on the wrong page (likely a 404). Build the link with the same prefix as the navigation item (e.g. /sales/pos/${pos._id}/orders) to keep the destinations consistent.
🤖 Prompt for AI Agents
In frontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsx
around lines 157 to 205, the handleCopyLink builds a link using the /operation
prefix but the Orders navigation routes use /sales; update the posLink to use
the same prefix as the navigation item (e.g.
`${window.location.origin}/sales/pos/${pos._id}/orders`) so the copied URL
matches the actual Orders route, leaving the rest of the clipboard/write and
toast logic intact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eniig bas uzdee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KhBaterdene, you're right! Here's the corrected link path:
frontend/plugins/sales_ui/src/modules/navigation/PosOrderNavigation.tsx
const handleCopyLink = async () => {
const posLink = `${window.location.origin}/sales/pos/${pos._id}/orders`;
try {
await navigator.clipboard.writeText(posLink);
toast({
variant: 'default',
title: 'Link copied to clipboard',
});
} catch (e) {
toast({
variant: 'destructive',
title: 'Failed to copy link',
description: e as string,
});
}
};The key change is on line 157: replace /operation/pos/ with /sales/pos/ to match the Orders navigation route.
| const { removePos } = useRemovePos(); | ||
| const { toast } = useToast(); | ||
|
|
||
| const orderCount = orderIds.includes(',') ? orderIds.split(',').length : 1; | ||
|
|
||
| return ( | ||
| <Button | ||
| variant="secondary" | ||
| className="text-destructive" | ||
| onClick={() => | ||
| confirm({ | ||
| message: `Are you sure you want to delete the ${orderCount} selected order?`, | ||
| }).then(() => { | ||
| removePos(orderIds, { | ||
| onError: (e: ApolloError) => { | ||
| toast({ | ||
| title: 'Error', | ||
| description: e.message, | ||
| variant: 'destructive', | ||
| }); | ||
| }, | ||
| onCompleted: () => { | ||
| toast({ | ||
| title: 'Success', | ||
| description: `pos deleted successfully.`, | ||
| }); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong delete mutation invoked.
OrderDelete triggers useRemovePos, which deletes POS records, not orders. That will wipe POS entries (or simply fail) instead of deleting the selected orders. Please wire this to the correct order-removal mutation/hook and update the success message accordingly.
🤖 Prompt for AI Agents
In
frontend/plugins/sales_ui/src/modules/orders/components/order-command-bar/delete/delete.tsx
around lines 18 to 44, the component currently calls useRemovePos (which deletes
POS records) when deleting orders; replace that hook with the correct
order-deletion hook (e.g., useRemoveOrder or useDeleteOrderOrders — whichever is
defined in the codebase), update the call site to pass the same orderIds and
preserve onError handling, and change the success toast text to a grammatically
correct message like "Order(s) deleted successfully." Ensure types align with
the chosen hook and update any imports accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eniig bas shalgaarai
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rate Limit Exceeded
@KhBaterdene have exceeded the limit for the number of chat messages per hour. Please wait 2 minutes and 19 seconds before sending another message.
| const { pathname } = useLocation(); | ||
| const isLead = new RegExp(`(^|/)${PosPath.Leads}(/|$)`).test(pathname); | ||
| return { | ||
| isLead, | ||
| sessionKey: isLead | ||
| ? LEADS_CURSOR_SESSION_KEY | ||
| : POS_CURSOR_SESSION_KEY, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex never matches because PosPath already includes /.
PosPath.Leads is '/leads', so the pattern becomes (^|/)\/leads(/|$) → effectively (^|//)leads(/|$), which won’t match /pos/leads. Strip the leading slash before building the regex (e.g., PosPath.Leads.replace(/^\//, '')).
- const isLead = new RegExp(`(^|/)${PosPath.Leads}(/|$)`).test(pathname);
+ const leadsPath = PosPath.Leads.replace(/^\//, '');
+ const isLead = new RegExp(`(^|/)${leadsPath}(/|$)`).test(pathname);📝 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.
| const { pathname } = useLocation(); | |
| const isLead = new RegExp(`(^|/)${PosPath.Leads}(/|$)`).test(pathname); | |
| return { | |
| isLead, | |
| sessionKey: isLead | |
| ? LEADS_CURSOR_SESSION_KEY | |
| : POS_CURSOR_SESSION_KEY, | |
| const { pathname } = useLocation(); | |
| const leadsPath = PosPath.Leads.replace(/^\//, ''); | |
| const isLead = new RegExp(`(^|/)${leadsPath}(/|$)`).test(pathname); | |
| return { | |
| isLead, | |
| sessionKey: isLead | |
| ? LEADS_CURSOR_SESSION_KEY | |
| : POS_CURSOR_SESSION_KEY, |
🤖 Prompt for AI Agents
frontend/plugins/sales_ui/src/modules/pos/pos-detail/hooks/UsePosLeadSessionKey.tsx
around lines 8 to 14: the RegExp never matches because PosPath.Leads already
contains a leading slash, producing patterns like '(^|//)leads(/|$)'; fix by
stripping the leading slash before building the regex (e.g., const leadSegment =
PosPath.Leads.replace(/^\//, ''); then use new
RegExp(`(^|/)${leadSegment}(/|$)`). Ensure you still escape any regex
metacharacters in the segment if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shalgaarai
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, let's check the PosPath constant definition
echo "=== Checking PosPath constant definition ==="
cat frontend/plugins/sales_ui/src/modules/pos/types/path/PosPath.tsx
echo -e "\n=== Testing regex pattern behavior ==="
# Create a Node.js test to verify the regex behavior
node -e "
const PosPath = {
Index: '/contacts',
Customers: '/customers',
Leads: '/leads',
Companies: '/companies',
Vendors: '/vendors',
Clients: '/clients'
};
console.log('PosPath.Leads value:', PosPath.Leads);
console.log('');
// Current implementation (with the bug)
const currentPattern = new RegExp(\`(^|/)\${PosPath.Leads}(/|$)\`);
console.log('Current regex pattern:', currentPattern.toString());
console.log('');
// Test paths
const testPaths = [
'/leads',
'/pos/leads',
'/sales/pos/123/leads',
'/leads/',
'/some/leads/path'
];
console.log('Testing current implementation:');
testPaths.forEach(path => {
const matches = currentPattern.test(path);
console.log(\` \${path} → \${matches ? '✓ matches' : '✗ no match'}\`);
});
console.log('');
// Fixed implementation
const leadsPath = PosPath.Leads.replace(/^\//, '');
const fixedPattern = new RegExp(\`(^|/)\${leadsPath}(/|$)\`);
console.log('Fixed regex pattern:', fixedPattern.toString());
console.log('');
console.log('Testing fixed implementation:');
testPaths.forEach(path => {
const matches = fixedPattern.test(path);
console.log(\` \${path} → \${matches ? '✓ matches' : '✗ no match'}\`);
});
"
Length of output: 772
@KhBaterdene I've verified the issue with concrete tests. Here are the results:
Current Implementation Problem
PosPath.Leads value: /leads
Current regex pattern: /(^|\/)\/leads(\/|$)/
This creates a double-slash pattern that only matches root-level paths:
Testing current implementation:
/leads → ✓ matches
/pos/leads → ✗ no match
/sales/pos/123/leads → ✗ no match
/leads/ → ✓ matches
/some/leads/path → ✗ no match
With the Fix
Fixed regex pattern: /(^|\/)leads(\/|$)/
After stripping the leading slash, it correctly matches all nested paths:
Testing fixed implementation:
/leads → ✓ matches
/pos/leads → ✓ matches
/sales/pos/123/leads → ✓ matches
/leads/ → ✓ matches
/some/leads/path → ✓ matches
Impact
Without this fix, the useIsPosLeadSessionKey hook will fail to detect leads routes in nested paths (like /sales/pos/123/leads), causing it to return the wrong session key (POS_CURSOR_SESSION_KEY instead of LEADS_CURSOR_SESSION_KEY). This could lead to cursor pagination state conflicts.
The suggested fix is necessary and correct. ✓
| export const PosBreadCrumb = () => { | ||
| const { posId } = useParams(); | ||
|
|
||
| const { pos, loading } = useGetCurrentUsersPos(); | ||
|
|
||
| const posItem = pos?.find((pos) => pos._id === posId); | ||
|
|
||
| if (loading) { | ||
| return <Skeleton className="w-12 h-[1lh]" />; | ||
| } | ||
|
|
||
| return ( | ||
| <Breadcrumb.Item> | ||
| <Button variant="ghost" asChild> | ||
| <Link to={`/operation/pos/${posItem?._id}`}> | ||
| <IconComponent name={posItem?.icon} /> | ||
| {posItem?.name} | ||
| </Link> | ||
| </Button> | ||
| </Breadcrumb.Item> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add null safety for posItem.
If posItem is undefined (when posId doesn't match any POS in the list), the component will render a broken link with undefined values. Add a null check to handle this edge case gracefully.
Apply this diff to add null safety:
if (loading) {
return <Skeleton className="w-12 h-[1lh]" />;
}
+
+ if (!posItem) {
+ return null;
+ }
return (
<Breadcrumb.Item>
<Button variant="ghost" asChild>
- <Link to={`/operation/pos/${posItem?._id}`}>
- <IconComponent name={posItem?.icon} />
- {posItem?.name}
+ <Link to={`/operation/pos/${posItem._id}`}>
+ <IconComponent name={posItem.icon} />
+ {posItem.name}
</Link>
</Button>
</Breadcrumb.Item>📝 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.
| export const PosBreadCrumb = () => { | |
| const { posId } = useParams(); | |
| const { pos, loading } = useGetCurrentUsersPos(); | |
| const posItem = pos?.find((pos) => pos._id === posId); | |
| if (loading) { | |
| return <Skeleton className="w-12 h-[1lh]" />; | |
| } | |
| return ( | |
| <Breadcrumb.Item> | |
| <Button variant="ghost" asChild> | |
| <Link to={`/operation/pos/${posItem?._id}`}> | |
| <IconComponent name={posItem?.icon} /> | |
| {posItem?.name} | |
| </Link> | |
| </Button> | |
| </Breadcrumb.Item> | |
| ); | |
| }; | |
| export const PosBreadCrumb = () => { | |
| const { posId } = useParams(); | |
| const { pos, loading } = useGetCurrentUsersPos(); | |
| const posItem = pos?.find((pos) => pos._id === posId); | |
| if (loading) { | |
| return <Skeleton className="w-12 h-[1lh]" />; | |
| } | |
| if (!posItem) { | |
| return null; | |
| } | |
| return ( | |
| <Breadcrumb.Item> | |
| <Button variant="ghost" asChild> | |
| <Link to={`/operation/pos/${posItem._id}`}> | |
| <IconComponent name={posItem.icon} /> | |
| {posItem.name} | |
| </Link> | |
| </Button> | |
| </Breadcrumb.Item> | |
| ); | |
| }; |
🤖 Prompt for AI Agents
frontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsx around
lines 5 to 26: the component assumes posItem exists and will render a broken
link if posItem is undefined; add a null-safety branch that checks if posItem is
falsy and render a safe fallback (for example return a Breadcrumb.Item with a
disabled/ghost Button and non-clickable text like "POS not found" or an
appropriate placeholder/Skeleton) so you never build a Link with undefined
id/icon/name; otherwise render the existing Breadcrumb.Item with the Link using
posItem._id, icon and name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eniig shalgah bas file nerni buruu baina
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for all references to the misspelled "breadcumb" directory or filename
echo "=== Searching for 'breadcumb' references ==="
rg -n "breadcumb" --type ts --type tsx -g '!node_modules'
echo -e "\n=== Searching for PosBreadCrumb imports ==="
rg -n "PosBreadCrumb" --type ts --type tsx -g '!node_modules'
echo -e "\n=== Finding all breadcrumb-related files ==="
fd -e ts -e tsx breadc
Length of output: 1718
🏁 Script executed:
#!/bin/bash
# Search for all references to the misspelled "breadcumb" and PosBreadCrumb
echo "=== Searching for 'breadcumb' references ==="
rg -n "breadcumb"
echo -e "\n=== Searching for PosBreadCrumb imports and usage ==="
rg -n "PosBreadCrumb"
echo -e "\n=== Checking OrdersPage.tsx where PosBreadCrumb is likely used ==="
cat frontend/plugins/sales_ui/src/pages/OrdersPage.tsx
Length of output: 2036
@KhBaterdene, та зөв - файлын нэр буруу байна! 👍
The directory name is misspelled: breadcumb should be breadcrumb
Here's what needs to be fixed:
-
Rename the directory:
- From:
frontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/ - To:
frontend/plugins/sales_ui/src/modules/pos/pos/breadcrumb/
- From:
-
Rename the file:
- From:
PosBreadCumb.tsx - To:
PosBreadCrumb.tsx
- From:
-
Update the import in OrdersPage.tsx (Line 5):
// Change from: import { PosBreadCrumb } from '../modules/pos/pos/breadcumb/PosBreadCumb'; // To: import { PosBreadCrumb } from '../modules/pos/pos/breadcrumb/PosBreadCrumb';
Also, the original null safety issue still applies - you should add a check for when posItem is undefined:
if (!posItem) {
return null;
}Note: I also noticed similar typos in the operation_ui plugin (breadcumb and breadcrump), but those are outside the scope of this PR.
Would you like me to create a follow-up issue to track fixing all breadcrumb spelling inconsistencies across the codebase?
| const [queries] = useMultiQueryState<{ | ||
| tags: string[]; | ||
| searchValue: string; | ||
| created: string; | ||
| updated: string; | ||
| lastSeen: string; | ||
| brand: string; | ||
| }>(['tags', 'searchValue', 'created', 'updated', 'lastSeen', 'brand']); | ||
|
|
||
| const hasFilters = Object.values(queries || {}).some( | ||
| (value) => value !== null, | ||
| ); | ||
|
|
||
| return ( | ||
| <> | ||
| <Filter.Popover scope={PosHotKeyScope.PosPage}> | ||
| <Filter.Trigger isFiltered={hasFilters} /> | ||
| <Combobox.Content> | ||
| <Filter.View> | ||
| <Command> | ||
| <Filter.CommandInput | ||
| placeholder="Filter" | ||
| variant="secondary" | ||
| className="bg-background" | ||
| /> | ||
| <Command.List className="p-1"> | ||
| <Filter.Item value="searchValue" inDialog> | ||
| <IconSearch /> | ||
| Search | ||
| </Filter.Item> | ||
| <TagsFilter /> | ||
| <Filter.Item value="brand"> | ||
| <IconLabel /> | ||
| Brand | ||
| </Filter.Item> | ||
| <SelectMember.FilterItem /> | ||
| <Command.Separator className="my-1" /> | ||
| <Filter.Item value="created"> | ||
| <IconCalendarPlus /> | ||
| Created At | ||
| </Filter.Item> | ||
| <Filter.Item value="updated"> | ||
| <IconCalendarUp /> | ||
| Updated At | ||
| </Filter.Item> | ||
| <Filter.Item value="lastSeen"> | ||
| <IconCalendarTime /> | ||
| Last Seen At | ||
| </Filter.Item> | ||
| <Filter.Item value="birthday"> | ||
| <IconCalendar /> | ||
| Birthday | ||
| </Filter.Item> | ||
| </Command.List> | ||
| </Command> | ||
| </Filter.View> | ||
| <SelectMember.FilterView /> | ||
| <SelectBrand.FilterView /> | ||
| <TagsFilter.View tagType="core:pos" /> | ||
| <Filter.View filterKey="created"> | ||
| <Filter.DateView filterKey="created" /> | ||
| </Filter.View> | ||
| <Filter.View filterKey="updated"> | ||
| <Filter.DateView filterKey="updated" /> | ||
| </Filter.View> | ||
| <Filter.View filterKey="lastSeen"> | ||
| <Filter.DateView filterKey="lastSeen" /> | ||
| </Filter.View> | ||
| <Filter.View filterKey="birthday"> | ||
| <Filter.DateView filterKey="birthday" /> | ||
| </Filter.View> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include every filter key in the trigger state.
hasFilters is derived from useMultiQueryState(['tags','searchValue','created','updated','lastSeen','brand']), but the UI also exposes a birthday filter. When a user sets only birthday, hasFilters stays false and the trigger never indicates an active filter. Add birthday (and any other filter keys surfaced in the bar) to this list so the trigger reflects the actual filter state.
🤖 Prompt for AI Agents
In frontend/plugins/sales_ui/src/modules/pos/pos/PosFilter.tsx around lines 23
to 93, the hasFilters check uses useMultiQueryState with
['tags','searchValue','created','updated','lastSeen','brand'] but the UI also
exposes a 'birthday' filter (and may expose others); update the
useMultiQueryState key array to include 'birthday' (and any other filter keys
shown in the filter bar) so Object.values(queries) reflects all possible filters
and the Filter.Trigger correctly shows the active state.
| export interface IUser { | ||
| _id: string; | ||
| details: { | ||
| avatar: string; | ||
| fullName: string; | ||
| __typename: string; | ||
| }; | ||
| __typename: string; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Remove duplicate IUser interface definition.
The IUser interface is already defined in frontend/plugins/sales_ui/src/modules/pos/types/pos.ts (lines 0-8). This duplication violates DRY principles and creates maintenance risk if the interface needs to be updated.
Apply this diff to remove the duplicate and import from the single source:
+import { IUser } from './pos';
+
-export interface IUser {
- _id: string;
- details: {
- avatar: string;
- fullName: string;
- __typename: string;
- };
- __typename: string;
-}
export interface IOrder {📝 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.
| export interface IUser { | |
| _id: string; | |
| details: { | |
| avatar: string; | |
| fullName: string; | |
| __typename: string; | |
| }; | |
| __typename: string; | |
| } | |
| import { IUser } from './pos'; | |
| export interface IOrder { |
🤖 Prompt for AI Agents
In frontend/plugins/sales_ui/src/modules/pos/types/order.ts around lines 1 to 9,
remove the duplicated IUser interface declaration and instead import IUser from
frontend/plugins/sales_ui/src/modules/pos/types/pos.ts; update the file to
delete the local interface block and add an import statement referencing the
single source so all code uses the shared IUser definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check this bas __typename: string; ene der type bichihgui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rate Limit Exceeded
@KhBaterdene have exceeded the limit for the number of chat messages per hour. Please wait 2 minutes and 21 seconds before sending another message.
| import { PosBreadCrumb } from '../modules/pos/pos/breadcumb/PosBreadCumb'; | ||
| import { OrderRecordTable } from '~/modules/orders/components/OrderRecordTable'; | ||
| import { PosFilter } from '../modules/pos/pos/PosFilter'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Standardize import paths to use absolute paths.
Lines 5 and 7 use relative ../ paths while line 6 uses the ~/ absolute path. As per coding guidelines, all imports should use absolute paths for consistency and maintainability.
Apply this diff to use absolute paths:
-import { PosBreadCrumb } from '../modules/pos/pos/breadcumb/PosBreadCumb';
+import { PosBreadCrumb } from '~/modules/pos/pos/breadcumb/PosBreadCrumb';
import { OrderRecordTable } from '~/modules/orders/components/OrderRecordTable';
-import { PosFilter } from '../modules/pos/pos/PosFilter';
+import { PosFilter } from '~/modules/pos/pos/PosFilter';📝 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.
| import { PosBreadCrumb } from '../modules/pos/pos/breadcumb/PosBreadCumb'; | |
| import { OrderRecordTable } from '~/modules/orders/components/OrderRecordTable'; | |
| import { PosFilter } from '../modules/pos/pos/PosFilter'; | |
| import { PosBreadCrumb } from '~/modules/pos/pos/breadcumb/PosBreadCrumb'; | |
| import { OrderRecordTable } from '~/modules/orders/components/OrderRecordTable'; | |
| import { PosFilter } from '~/modules/pos/pos/PosFilter'; |
🤖 Prompt for AI Agents
frontend/plugins/sales_ui/src/pages/OrdersPage.tsx lines 5-7: imports on lines 5
and 7 use relative paths while line 6 uses the project absolute `~` path; change
those two imports to absolute paths to match line 6 — replace
'../modules/pos/pos/breadcumb/PosBreadCumb' with
'~/modules/pos/pos/breadcumb/PosBreadCumb' and '../modules/pos/pos/PosFilter'
with '~/modules/pos/pos/PosFilter' so all three imports use the same absolute
path convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PosBreadCrumb bish PosBreadcrumb gej bichih ni zuw shuu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check the actual export in the PosBreadCumb file
cat frontend/plugins/sales_ui/src/modules/pos/pos/breadcumb/PosBreadCumb.tsx | grep -E "export.*Pos.*[Bb]read"
Length of output: 36
@KhBaterdene You're absolutely right! "Breadcrumb" is one word, so it should be PosBreadcrumb with a lowercase 'c', not PosBreadCrumb.
However, I checked the actual file and it currently exports PosBreadCrumb (with capital C). For the immediate import fix to work, we need to match what's currently exported:
import { PosBreadCrumb } from '~/modules/pos/pos/breadcumb/PosBreadCumb';But you're correct about the naming convention issue. Ideally, the component should be renamed to follow proper conventions:
- Rename the directory:
breadcumb→breadcrumb(also fixes the typo) - Rename the file:
PosBreadCumb.tsx→PosBreadcrumb.tsx - Update the export:
PosBreadCrumb→PosBreadcrumb
Would you like me to create an issue to track this refactoring task?
🧠 Learnings used
Learnt from: CR
PR: erxes/erxes-next#0
File: .cursorrules:0-0
Timestamp: 2025-07-21T06:09:41.203Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Always use absolute paths when importing.
Learnt from: CR
PR: erxes/erxes-next#0
File: .windsurfrules:0-0
Timestamp: 2025-07-21T06:10:08.710Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use absolute path when import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed 8e7d4d4 in 50 seconds. Click for details.
- Reviewed
282lines of code in8files - Skipped
0files when reviewing. - Skipped posting
3draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsx:16
- Draft comment:
Good removal of debug log. This avoids unintentional logging in production. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. frontend/plugins/pos_ui/src/pages/PosIndexPage.tsx:2
- Draft comment:
Removed the unused 'PageSubHeader' import. Ensure the remaining header components cover required functionality. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
3. frontend/plugins/pos_ui/tsconfig.app.json:22
- Draft comment:
Review the updated 'include' paths to ensure all necessary source files are covered. The removal of additional paths (e.g. sales_ui modules) may impact builds if those files are still required. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
Workflow ID: wflow_Zo70Pb7uLv82qaTb
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed 1986394 in 47 seconds. Click for details.
- Reviewed
11lines of code in1files - Skipped
0files when reviewing. - Skipped posting
1draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/plugins/sales_ui/src/modules/main/Main.tsx:3
- Draft comment:
Removed extra blank line between imports. Ensure consistency with project formatting guidelines. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
Workflow ID: wflow_JCbktUnyv3vzhzTJ
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
KhBaterdene
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zaa yronhiidoo dawgui baina edgeereiig zasaarai
| Last Seen At | ||
| </Filter.Item> | ||
| <Filter.Item value="birthday"> | ||
| <IconCalendar /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happy birthday
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eniig baiikhgu bolgoh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eniig bas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eniig ch bas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ene ter chigeere ustaagui yu
| import { PosBreadCrumb } from '../modules/pos/pos/breadcumb/PosBreadCumb'; | ||
| import { OrderRecordTable } from '~/modules/orders/components/OrderRecordTable'; | ||
| import { PosFilter } from '../modules/pos/pos/PosFilter'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PosBreadCrumb bish PosBreadcrumb gej bichih ni zuw shuu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ene import pathuudaa zasaarai
| @@ -1,4 +1,4 @@ | |||
| REACT_APP_API_URL=http://localhost:4000 | |||
| REACT_APP_API_URL=http://localhost:4000/ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ene odoo yajiinaa mi hu
| "dev:apis": "dotenv -e .env -- node scripts/start-api-dev.js", | ||
| "dev:uis": "dotenv -e .env -- node scripts/start-ui-dev.js", | ||
| "create-plugin": "node scripts/create-plugin.js" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yaahgeed bainaa zaluuu
| @@ -1,4 +1,4 @@ | |||
| REACT_APP_API_URL=http://localhost:4000 | |||
| REACT_APP_API_URL=http://localhost:4000/ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ene odoo yajiinaa mi hu
Summary by Sourcery
Enhance the POS UI by adding filtering capabilities, record count display, and route-based session key utilities, along with code formatting scripts.
New Features:
Enhancements:
Important
Enhance POS UI with filtering, record count display, and session key management, while updating navigation and adding code formatting scripts.
PosFiltercomponent inPosIndexPagefor filtering POS records.PosTotalCountcomponent to display total records with loading state.useIsPosLeadSessionKeyhook for session key management based on route.PosPathenum for POS-related routes.posTotalCountAtomfor record count state.POS_CURSOR_SESSION_KEYandLEADS_CURSOR_SESSION_KEYconstants.formatandformat:checknpm scripts using Prettier.SalesNavigationandPosOrderNavigationfor new POS and Sales routes.Main.tsxinsales_uito include new routes for POS orders..env.samplecontains hardcoded MongoDB credentials.This description was created by
for 1986394. You can customize this summary. It will automatically update as commits are pushed.
Greptile Overview
Updated On: 2025-10-07 02:52:11 UTC
Summary
This PR implements a comprehensive filtering system for the POS (Point of Sale) UI module. The changes introduce session-based filter state persistence, allowing users to filter POS records by multiple criteria including search terms, tags, brands, team members, and various date ranges (created, updated, lastSeen, birthday). The implementation follows the existing erxes-ui filter system patterns and adds proper state management through Jotai atoms.Key components added include:
The filtering system integrates seamlessly with the existing POS index page, providing users with advanced search and filter capabilities while maintaining separate filter states for different sections (leads vs regular POS records).
PR Description Notes:
Important Files Changed
Changed Files
.env.samplefrontend/plugins/pos_ui/src/modules/types/path/PosPath.tsxfrontend/plugins/pos_ui/src/modules/pos/PosFilter.tsxfrontend/plugins/pos_ui/src/modules/pos-detail/hooks/UsePosLeadSessionKey.tsxfrontend/plugins/pos_ui/src/pages/PosIndexPage.tsxfrontend/plugins/pos_ui/src/modules/constants/PosCursorSessionKey.tsxfrontend/plugins/pos_ui/src/modules/pos/PosTotalCount.tsxpackage.jsonConfidence score: 1/5
Sequence Diagram
sequenceDiagram participant User participant PosIndexPage participant PosFilter participant UseIsPosLeadSessionKey participant FilterQueryState participant SessionStorage participant PosTotalCount participant Jotai User->>PosIndexPage: "Navigate to POS page" PosIndexPage->>PosFilter: "Render PosFilter component" PosFilter->>UseIsPosLeadSessionKey: "Get session key based on path" UseIsPosLeadSessionKey->>UseIsPosLeadSessionKey: "Check if path includes '/leads'" UseIsPosLeadSessionKey-->>PosFilter: "Return appropriate session key (pos-cursor or leads-cursor)" PosFilter->>FilterQueryState: "Initialize filter state with session key" FilterQueryState->>SessionStorage: "Load saved filter state from session" SessionStorage-->>FilterQueryState: "Return saved filters" FilterQueryState-->>PosFilter: "Provide filter state and handlers" User->>PosFilter: "Interact with filter (search, tags, dates, etc.)" PosFilter->>FilterQueryState: "Update filter values" FilterQueryState->>SessionStorage: "Save filter state to session" PosFilter->>PosTotalCount: "Trigger count update based on filters" PosTotalCount->>Jotai: "Read posTotalCountAtom value" Jotai-->>PosTotalCount: "Return current count or null" PosTotalCount-->>User: "Display total count or skeleton loader"Context used:
Rule from
dashboard- Pull requests should be opened against the erxes-community repository (https://github.com/erxes/erxe... (source)Summary by CodeRabbit
New Features
Refactor
Chores