-
Notifications
You must be signed in to change notification settings - Fork 3
feat: tourism api/tms #375
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?
Conversation
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.
Sorry @tsebaa0310, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
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.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
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. WalkthroughAdds a tourism UI module with routing/exposure, introduces Jotai-backed TMS form state and multi-step UI, many new/refactored TMS components/hooks/GraphQL operations (pagination, renamed manager fields), removes env vars from Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User
participant BranchList
participant BranchCard
participant Dialogs as Dialogs/Sheet
participant Hooks as Hooks(useBranchEdit/useBranchDuplicate/useBranchRemove/useBranchSubmit)
participant GraphQL
User->>BranchList: open list
BranchList->>GraphQL: query bmsBranchList (paginated)
GraphQL-->>BranchList: return list + pageInfo
BranchList->>BranchCard: render cards
User->>BranchCard: select Action -> Edit
BranchCard->>Hooks: handleEditBranch(id)
Hooks->>GraphQL: query BmsBranchDetail
GraphQL-->>Hooks: return branchDetail
Hooks->>Dialogs: open Sheet with CreateTmsForm (edit mode)
User->>CreateTmsForm: submit changes
CreateTmsForm->>Hooks: useBranchSubmit(handleSubmit -> edit)
Hooks->>GraphQL: mutate EDIT_BRANCH
GraphQL-->>Hooks: success
Hooks->>BranchList: refetch
alt Duplicate flow
User->>BranchCard: Duplicate
BranchCard->>Dialogs: open ConfirmationDialog
User->>Dialogs: confirm
Dialogs->>Hooks: useBranchDuplicate.handleDuplicateBranch
Hooks->>GraphQL: mutate CREATE_BRANCH
GraphQL-->>Hooks: success
Hooks->>BranchList: refetch
end
alt Delete flow
User->>BranchCard: Delete
BranchCard->>Dialogs: open ConfirmationDialog
User->>Dialogs: confirm
Dialogs->>Hooks: useBranchRemove.handleDeleteBranch
Hooks->>GraphQL: mutate REMOVE_BRANCH
GraphQL-->>Hooks: success
Hooks->>BranchList: refetch
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Points to focus review on:
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (1 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 |
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 1060b2e in 2 minutes and 39 seconds. Click for details.
- Reviewed
3479lines of code in33files - Skipped
2files when reviewing. - Skipped posting
6draft 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/tourism_ui/src/modules/tms/components/BranchCard.tsx:37
- Draft comment:
The 'duplicateLoading' prop is passed to ActionMenu even though it is not defined in its props. Remove it or extend the ActionMenu interface 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 = 10% vs. threshold = 50% The comment is speculative - it assumes ActionMenu doesn't acceptduplicateLoadingwithout showing the ActionMenu component definition. This is a cross-file issue since I'd need to see ActionMenu's implementation to verify. If ActionMenu truly didn't accept this prop, TypeScript would catch this at build time, making it something that would be "obviously caught by the build". The rules state I should ignore cross-file issues and not comment on things that would be caught by the build. Could ActionMenu actually be missing this prop? If so, this would be a legitimate issue that needs fixing. However, without seeing ActionMenu's definition, I can't be certain. Even if ActionMenu is missing the prop, TypeScript compilation would fail, making this an issue that would be "obviously caught by the build". The rules explicitly state not to comment on such issues. Additionally, this requires cross-file context to verify, which the rules say to ignore. This comment should be deleted because it's a cross-file issue that requires seeing ActionMenu's implementation to verify, and if it were truly incorrect, TypeScript would catch it at build time.
2. frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx:293
- Draft comment:
Incorrect property access: 'data?.paymentsPublic' is used, but the query returns 'payments'. Use 'data?.payments' instead. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 15% vs. threshold = 50% The comment is making a specific claim about the GraphQL query return structure. However, I don't have access to the PAYMENT_LIST query definition to verify whether it returnspaymentsorpaymentsPublic. The namepaymentsPublicseems intentional and specific - it's not a typo. Without seeing the actual query definition or schema, I cannot confirm this is definitely wrong. The automated tool may be guessing based on naming conventions, butpaymentsPubliccould be a legitimate field name for a public-facing API. This seems speculative without strong evidence. The query name is PAYMENT_LIST and the field is paymentsPublic - this could be intentional API design where the query returns a field specifically namedpaymentsPublicto distinguish from internal payment data. Without the query definition, I'm making assumptions. While it's possible the field name is wrong, the specific namepaymentsPublic(not justpayments) suggests this was intentionally chosen. Without access to the GraphQL schema or query definition, this comment lacks strong evidence and appears speculative. The rule states I need STRONG EVIDENCE to keep a comment. Delete this comment. Without access to the PAYMENT_LIST query definition or GraphQL schema, there's insufficient evidence to confirm this is actually incorrect. The field namepaymentsPublicappears intentional and specific, not a simple typo.
3. frontend/plugins/tourism_ui/src/modules/tms/hooks/useBranchSubmit.ts:125
- Draft comment:
Resetting the current step to 0 might be inconsistent with steps starting at 1. Consider resetting to 1 instead. - 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% This comment is speculative - it says "might be inconsistent" without providing evidence that steps actually start at 1. The comment is making an assumption about how the step system works without proof. In many step-based systems, 0 is a valid starting index (0-indexed). The comment would need to show evidence from the codebase that steps are 1-indexed to be valid. Since this is a new file being added, and the comment is speculating about potential inconsistency without strong evidence, it violates the rule about not making speculative comments. Perhaps the automated tool has access to other parts of the codebase that show steps are 1-indexed, and I'm missing that context. The comment could be correct if there's evidence elsewhere that the step system uses 1-based indexing. Even if there is evidence elsewhere, the rule states I should only keep comments with STRONG EVIDENCE visible in the diff itself. Since I cannot see that evidence in this file, and the comment is phrased speculatively ("might be inconsistent"), I should delete it. The rule explicitly states to ignore cross-file issues and only think about the file being reviewed. This comment is speculative and lacks strong evidence within the visible diff. It makes an assumption about how the step system works without proof. Following the rules to delete speculative comments and ignore cross-file issues, this comment should be removed.
4. frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx:63
- Draft comment:
Typo: 'FrontlitnePaths' seems like a misspelling for 'FrontlinePaths'. Please check the variable name 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 = 0% vs. threshold = 50% This is a clear typo that was introduced in the diff (line 63 changed from FrontlinePaths to FrontlitnePaths). The comment is about a change made in the diff, not about unchanged code. This would cause a runtime error since FrontlitnePaths is not defined (only FrontlinePaths is imported on line 10). The comment is actionable and correct. However, I need to consider if this would be caught by the build - this is TypeScript/JavaScript, so an undefined variable reference would definitely be caught by TypeScript compilation or linting. According to the rules, I should NOT comment on anything that would be obviously caught by the build. This typo would cause a TypeScript compilation error since 'FrontlitnePaths' is not defined anywhere in the code. According to the rules, I should not comment on things that would be obviously caught by the build, which includes undefined variable references. While TypeScript would catch this as an undefined variable, the comment is still valuable because it identifies the exact nature of the error (a typo) and provides the correct fix. However, the rule explicitly states not to comment on things caught by the build, including variable renames and undefined references. Despite the comment being technically correct and helpful, it violates the rule about not commenting on issues that would be caught by the build. An undefined variable reference would immediately fail TypeScript compilation, so this comment should be deleted.
5. frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx:235
- Draft comment:
Typo fixed: The variable name has been changed from 'GeneralManeger' to 'GeneralManager'. Please ensure that all references to this identifier elsewhere in the code are updated accordingly. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is asking the PR author to ensure that all references to the identifier are updated, which violates the rule against asking the author to double-check things. The comment does not provide a specific suggestion or point out a specific issue, making it not useful according to the guidelines.
6. frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx:354
- Draft comment:
Typographical note: consider removing the extra space before the question mark in the description text. For example, change "What is erxes app token ?" to "What is erxes app token?". - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_qh8ShCSOlOQszhdS
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
| iframeSrc={ | ||
| '/settings/frontline/channels' + | ||
| FrontlinePaths.ErxesMessengerPreview + | ||
| FrontlitnePaths.ErxesMessengerPreview + |
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.
Typo: FrontlitnePaths appears to be a typo. It should likely be FrontlinePaths.
| FrontlitnePaths.ErxesMessengerPreview + | |
| FrontlinePaths.ErxesMessengerPreview + |
| align="end" | ||
| > | ||
| {dropdownItems.map((item) => ( | ||
| <div |
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.
Each item in the dropdown map should have a unique key prop to avoid React key warnings.
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: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/plugins/tourism_ui/src/modules/tms/Settings.tsx (1)
1-9: Use named export instead of default export.The coding guidelines specify favoring named exports for components.
As per coding guidelines.
Apply this diff:
const Settings = () => { return ( <div> <h1 className="justify-center text-center">Tms Settings</h1> </div> ); }; -export default Settings; +export { Settings };
🧹 Nitpick comments (12)
frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx (1)
20-41: Remove or uncomment the disabled menu item.The commented-out "Visit website" menu item should either be removed if not needed or properly implemented if it's intended for future use.
frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsx (1)
12-15: Consider resetting step only when opening.Currently,
setCurrentStep(1)is called for both open and close events. Resetting on close may be unnecessary and could potentially cause visual inconsistencies during the sheet's close animation.Apply this diff to reset the step only when the sheet opens:
const handleOpenChange = (openState: boolean) => { setOpen(openState); - setCurrentStep(1); + if (openState) { + setCurrentStep(1); + } };frontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsx (1)
8-27: Consider derivinglogoUrldirectly instead of using state.The
logoUrlcan be computed directly fromformData.logoduring render, eliminating the need foruseStateanduseEffect. This aligns with the coding guideline to minimizeuseEffectandsetState.Based on learnings.
Apply this diff:
export const PreviewPage = () => { const [formData] = useAtom(tmsFormAtom); - const [logoUrl, setLogoUrl] = useState(''); useLayoutEffect(() => { if (formData.color && hexToHsl(formData.color)) { document.documentElement.style.setProperty( '--primary', hexToHsl(formData.color) || '', ); } }, [formData.color]); const tourName = formData.name || 'Tour Management System'; - - useEffect(() => { - if (formData.logo) { - setLogoUrl(readImage(formData.logo)); - } else { - setLogoUrl('https://placehold.co/150x150'); - } - }, [formData.logo]); + const logoUrl = formData.logo ? readImage(formData.logo) : 'https://placehold.co/150x150'; const themeColor = formData.color || '#4F46E5';frontend/plugins/tourism_ui/src/modules/tms/components/PaymentIcon.tsx (1)
63-63: Consider using a named export instead of default export.The coding guidelines for
.tsxfiles favor named exports for components. While default exports work, named exports improve consistency and refactoring tooling support.As per coding guidelines.
Apply this diff:
-export default PaymentIcon; +export { PaymentIcon };Then update imports in consuming files from:
import PaymentIcon from './PaymentIcon';to:
import { PaymentIcon } from './PaymentIcon';frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx (4)
29-35: Simplify the onChange handler.The custom
onChangehandler simply passes the event tofield.onChangewithout any additional logic. The spread operator{...field}already includes theonChangehandler.Apply this diff:
- <Input - className="h-8 rounded-md" - {...field} - onChange={(e) => { - field.onChange(e); - }} - /> + <Input className="h-8 rounded-md" {...field} />
58-60: Avoid usinganytype.The
valueparameter usesany, which defeats TypeScript's type safety benefits.Consider defining a proper type or using
stringif that's what ColorPicker accepts:- onValueChange={(value: any) => { + onValueChange={(value: string) => { field.onChange(value); }}
150-233: Consider extracting shared upload logic.The
FavIconFieldandLogoFieldcomponents share nearly identical implementation. Consider creating a reusableImageUploadFieldcomponent to reduce duplication.Example approach:
const ImageUploadField = ({ control, name, label, description }: { control: Control<TmsFormType>; name: 'logo' | 'favIcon'; label: string; description: string; }) => { // Shared upload logic here }; // Usage: export const LogoField = ({ control }: { control: Control<TmsFormType> }) => ( <ImageUploadField control={control} name="logo" label="LOGO" description="Image can be shown on the top of the post also" /> );
356-356: Consider flexible width for token input.The fixed width (
w-40) might be too narrow for longer tokens. Consider using a more flexible width likew-fullormax-w-md.- <Input className="w-40 h-8 rounded-md" {...field} /> + <Input className="w-full max-w-md h-8 rounded-md" {...field} />frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchEdit.ts (3)
13-13: Avoid usingany[]forpaymentTypes.The
paymentTypesfield usesany[], which defeats TypeScript's type safety. Consider defining a proper interface for payment types.+interface PaymentType { + type: string; + title: string; + icon: string; + config?: string; +} + interface UpdateBranchVariables { id: string; name?: string; description?: string; generalManagerIds?: string[]; managerIds?: string[]; paymentIds?: string[]; - paymentTypes?: any[]; + paymentTypes?: PaymentType[]; erxesAppToken?: string; permissionConfig?: any; uiOptions?: any; }
28-70: Consider consolidating duplicate mutation logic.The
updateBranchByIdandeditBranchfunctions contain significant duplication. Consider consolidating them into a single function or having one call the other.Example approach:
const editBranch = async ({ variables, onError, onCompleted, }: { variables: UpdateBranchVariables; onError?: (error: any) => void; onCompleted?: () => void; }) => { try { const result = await updateBranch({ variables }); if (result.data) { onCompleted?.(); options?.onSuccess?.(); return result.data; } return null; } catch (error) { onError?.(error); options?.onError?.(error); throw error; } }; // Simplified updateBranchById const updateBranchById = (variables: UpdateBranchVariables) => editBranch({ variables });
92-98: Improve error handling type safety.The error handling assumes
errorhas amessageproperty, but this isn't type-safe. Apollo errors have a different structure.} catch (error) { toast({ title: 'Failed to update branch', - description: error?.message || 'Unknown error occurred', + description: error instanceof Error ? error.message : 'Unknown error occurred', variant: 'destructive', }); throw error;frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (1)
45-45: ReconsiderfetchPolicy: 'network-only'.Using
fetchPolicy: 'network-only'bypasses Apollo's cache entirely, which may lead to unnecessary network requests and slower UX. Consider usingcache-and-networkorcache-firstunless there's a specific requirement to always fetch fresh data.- fetchPolicy: 'network-only', + fetchPolicy: 'cache-and-network',
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
frontend/plugins/tourism_ui/src/assets/tourism-empty-state.jpgis excluded by!**/*.jpgpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (33)
.env.sample(0 hunks)frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx(4 hunks)frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx(3 hunks)frontend/plugins/tourism_ui/module-federation.config.ts(1 hunks)frontend/plugins/tourism_ui/project.json(1 hunks)frontend/plugins/tourism_ui/src/config.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/main/Main.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/Settings.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/PaymentIcon.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/Preview.tsx(0 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx(21 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsx(2 hunks)frontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/graphql/mutation.ts(3 hunks)frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDetail.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDuplicate.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchEdit.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchRemove.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts(3 hunks)frontend/plugins/tourism_ui/src/modules/tms/hooks/useBranchSubmit.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts(1 hunks)frontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsx(1 hunks)
💤 Files with no reviewable changes (2)
- frontend/plugins/tourism_ui/src/modules/tms/components/Preview.tsx
- .env.sample
🧰 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/tourism_ui/module-federation.config.tsfrontend/plugins/tourism_ui/src/modules/tms/types/branch.tsfrontend/plugins/tourism_ui/src/modules/tms/components/PaymentIcon.tsxfrontend/plugins/tourism_ui/src/modules/tms/Settings.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsxfrontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsxfrontend/plugins/tourism_ui/src/modules/tms/hooks/useBranchSubmit.tsfrontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsxfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsxfrontend/plugins/tourism_ui/src/modules/main/Main.tsxfrontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDetail.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchRemove.tsfrontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.tsfrontend/plugins/tourism_ui/src/modules/tms/graphql/queries.tsfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsxfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDuplicate.tsfrontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.tsfrontend/plugins/tourism_ui/src/config.tsxfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchEdit.tsfrontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsxfrontend/plugins/tourism_ui/src/modules/tms/graphql/mutation.ts
**/*.{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/tourism_ui/module-federation.config.tsfrontend/plugins/tourism_ui/src/modules/tms/types/branch.tsfrontend/plugins/tourism_ui/src/modules/tms/components/PaymentIcon.tsxfrontend/plugins/tourism_ui/src/modules/tms/Settings.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsxfrontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsxfrontend/plugins/tourism_ui/src/modules/tms/hooks/useBranchSubmit.tsfrontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsxfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsxfrontend/plugins/tourism_ui/src/modules/main/Main.tsxfrontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDetail.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchRemove.tsfrontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.tsfrontend/plugins/tourism_ui/src/modules/tms/graphql/queries.tsfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsxfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDuplicate.tsfrontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.tsfrontend/plugins/tourism_ui/src/config.tsxfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchEdit.tsfrontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsxfrontend/plugins/tourism_ui/src/modules/tms/graphql/mutation.ts
**/*.{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/tourism_ui/src/modules/tms/components/PaymentIcon.tsxfrontend/plugins/tourism_ui/src/modules/tms/Settings.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsxfrontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsxfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsxfrontend/plugins/tourism_ui/src/modules/main/Main.tsxfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsxfrontend/plugins/tourism_ui/src/config.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.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/tourism_ui/src/modules/tms/components/PaymentIcon.tsxfrontend/plugins/tourism_ui/src/modules/tms/Settings.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsxfrontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsxfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsxfrontend/plugins/tourism_ui/src/modules/main/Main.tsxfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsxfrontend/plugins/tourism_ui/src/config.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsx
**/*.{webp,tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Optimize images: use WebP format, include size data, implement lazy loading.
Files:
frontend/plugins/tourism_ui/src/modules/tms/components/PaymentIcon.tsxfrontend/plugins/tourism_ui/src/modules/tms/Settings.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsxfrontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsxfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsxfrontend/plugins/tourism_ui/src/modules/main/Main.tsxfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsxfrontend/plugins/tourism_ui/src/config.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsx
🧠 Learnings (9)
📚 Learning: 2025-07-21T06:09:41.203Z
Learnt from: CR
Repo: erxes/erxes-next PR: 0
File: .cursorrules:0-0
Timestamp: 2025-07-21T06:09:41.203Z
Learning: Structure files: exported component, utils, contexts, hooks, types.
Applied to files:
frontend/plugins/tourism_ui/module-federation.config.tsfrontend/plugins/tourism_ui/src/modules/main/Main.tsx
📚 Learning: 2025-07-21T06:10:08.710Z
Learnt from: CR
Repo: erxes/erxes-next PR: 0
File: .windsurfrules:0-0
Timestamp: 2025-07-21T06:10:08.710Z
Learning: Applies to **/*.{tsx,jsx} : Structure files: exported component, subcomponents, helpers, static content, types.
Applied to files:
frontend/plugins/tourism_ui/module-federation.config.tsfrontend/plugins/tourism_ui/project.jsonfrontend/plugins/tourism_ui/src/modules/main/Main.tsx
📚 Learning: 2025-07-21T06:10:08.710Z
Learnt from: CR
Repo: erxes/erxes-next PR: 0
File: .windsurfrules:0-0
Timestamp: 2025-07-21T06:10:08.710Z
Learning: Applies to **/*.{tsx,jsx} : Favor named exports for components.
Applied to files:
frontend/plugins/tourism_ui/module-federation.config.tsfrontend/plugins/tourism_ui/src/modules/main/Main.tsx
📚 Learning: 2025-07-21T06:10:08.710Z
Learnt from: CR
Repo: erxes/erxes-next PR: 0
File: .windsurfrules:0-0
Timestamp: 2025-07-21T06:10:08.710Z
Learning: Applies to **/*.tsx : Minimize 'useEffect', and 'setState'.
Applied to files:
frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsx
📚 Learning: 2025-07-21T06:10:08.710Z
Learnt from: CR
Repo: erxes/erxes-next PR: 0
File: .windsurfrules:0-0
Timestamp: 2025-07-21T06:10:08.710Z
Learning: Applies to **/*.tsx : Use dynamic loading for non-critical components.
Applied to files:
frontend/plugins/tourism_ui/src/modules/main/Main.tsx
📚 Learning: 2025-07-21T06:09:41.203Z
Learnt from: CR
Repo: erxes/erxes-next PR: 0
File: .cursorrules:0-0
Timestamp: 2025-07-21T06:09:41.203Z
Learning: Applies to **/*.tsx : Wrap client components in Suspense with fallback.
Applied to files:
frontend/plugins/tourism_ui/src/modules/main/Main.tsx
📚 Learning: 2025-07-21T06:10:08.710Z
Learnt from: CR
Repo: erxes/erxes-next PR: 0
File: .windsurfrules:0-0
Timestamp: 2025-07-21T06:10:08.710Z
Learning: Applies to **/*.{tsx,jsx} : Use Shadcn UI, Radix, and Tailwind for components and styling.
Applied to files:
frontend/plugins/tourism_ui/src/modules/main/Main.tsxfrontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsxfrontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsx
📚 Learning: 2025-07-21T06:10:08.710Z
Learnt from: CR
Repo: erxes/erxes-next PR: 0
File: .windsurfrules:0-0
Timestamp: 2025-07-21T06:10:08.710Z
Learning: Follow Next.js docs for Data Fetching, Rendering, and Routing.
Applied to files:
frontend/plugins/tourism_ui/src/modules/main/Main.tsx
📚 Learning: 2025-07-21T06:10:08.710Z
Learnt from: CR
Repo: erxes/erxes-next PR: 0
File: .windsurfrules:0-0
Timestamp: 2025-07-21T06:10:08.710Z
Learning: Applies to **/*.tsx : Use functional components with TypeScript interfaces.
Applied to files:
frontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsx
🧬 Code graph analysis (18)
frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsx (2)
frontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.ts (1)
currentStepAtom(3-3)frontend/libs/erxes-ui/src/components/sheet.tsx (1)
Sheet(173-183)
frontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsx (3)
frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts (1)
tmsFormAtom(50-67)frontend/libs/erxes-ui/src/utils/colors.ts (1)
hexToHsl(15-79)frontend/libs/erxes-ui/src/utils/core.ts (1)
readImage(4-46)
frontend/plugins/tourism_ui/src/modules/tms/hooks/useBranchSubmit.ts (5)
frontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.ts (1)
TmsFormType(25-25)frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts (1)
useCreateBranch(35-63)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchEdit.ts (1)
useBranchEdit(24-115)frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts (2)
resetFormAtom(69-71)DEFAULT_TMS_FORM(33-43)frontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.ts (1)
currentStepAtom(3-3)
frontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsx (1)
frontend/libs/erxes-ui/src/utils/getPluginAssetsUrl.ts (1)
getPluginAssetsUrl(3-16)
frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx (1)
frontend/libs/erxes-ui/src/components/popover.tsx (1)
Popover(52-57)
frontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsx (4)
frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts (1)
IBranch(11-28)frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx (1)
ActionMenu(15-74)frontend/libs/erxes-ui/src/utils/core.ts (1)
readImage(4-46)frontend/libs/erxes-ui/src/components/avatar.tsx (1)
Avatar(72-75)
frontend/plugins/tourism_ui/src/modules/main/Main.tsx (1)
apps/frontline-widgets/src/app/app.tsx (1)
App(5-48)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDetail.ts (2)
frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts (1)
IBranch(11-28)frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts (1)
BRANCH_LIST_DETAIL(55-84)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchRemove.ts (1)
frontend/plugins/tourism_ui/src/modules/tms/graphql/mutation.ts (1)
REMOVE_BRANCH(115-119)
frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx (2)
frontend/libs/ui-modules/src/modules/team-members/components/MembersInline.tsx (1)
MembersInline(266-270)frontend/libs/erxes-ui/src/components/button.tsx (1)
Button(43-57)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (3)
backend/erxes-api-shared/src/utils/mongo/cursor-util.ts (1)
PageInfo(25-30)frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts (1)
IBranch(11-28)frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts (1)
GET_BRANCH_LIST(3-53)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDuplicate.ts (2)
frontend/plugins/tourism_ui/src/modules/tms/graphql/mutation.ts (1)
CREATE_BRANCH(3-56)frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts (1)
IBranch(11-28)
frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts (2)
frontend/plugins/tourism_ui/src/modules/tms/graphql/mutation.ts (1)
CREATE_BRANCH(3-56)frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts (1)
GET_BRANCH_LIST(3-53)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchEdit.ts (1)
frontend/plugins/tourism_ui/src/modules/tms/graphql/mutation.ts (1)
EDIT_BRANCH(58-113)
frontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsx (8)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (1)
useBranchList(28-54)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchRemove.ts (1)
useBranchRemove(10-63)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDuplicate.ts (1)
useBranchDuplicate(23-85)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchEdit.ts (1)
useBranchEdit(24-115)frontend/libs/erxes-ui/src/components/spinner.tsx (1)
Spinner(40-132)frontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsx (1)
EmptyList(4-33)frontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsx (1)
BranchCard(15-90)frontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsx (1)
ConfirmationDialog(13-83)
frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsx (6)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDetail.ts (1)
useBranchDetail(13-26)frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts (1)
tmsFormAtom(50-67)frontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.ts (1)
currentStepAtom(3-3)frontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.ts (2)
TmsFormType(25-25)TmsFormSchema(3-23)frontend/plugins/tourism_ui/src/modules/tms/hooks/useBranchSubmit.ts (1)
useBranchSubmit(27-144)frontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsx (1)
TmsInformationFields(20-238)
frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx (6)
frontend/libs/erxes-ui/src/components/form.tsx (1)
Form(166-174)frontend/libs/erxes-ui/src/components/color-picker.tsx (1)
ColorPicker(181-185)frontend/libs/erxes-ui/src/components/upload.tsx (1)
Upload(320-325)frontend/libs/ui-modules/src/modules/team-members/components/SelectMember.tsx (1)
SelectMember(463-475)frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts (1)
PAYMENT_LIST(86-97)frontend/plugins/tourism_ui/src/modules/tms/components/PaymentIcon.tsx (1)
paymentIconOptions(12-19)
frontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsx (3)
frontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.ts (1)
TmsFormType(25-25)frontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.ts (1)
currentStepAtom(3-3)frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts (1)
tmsFormAtom(50-67)
🪛 Biome (2.1.2)
frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx
[error] 61-64: Missing key property for this element in iterable.
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
(lint/correctness/useJsxKeyInIterable)
⏰ 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 (14)
frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx (1)
14-14: LGTM - cosmetic className reordering.The changes are purely cosmetic, reordering Tailwind CSS utility classes with no functional or visual impact. The component follows the coding guidelines for using Tailwind, Shadcn UI, and declarative JSX patterns.
Also applies to: 33-33, 43-43, 64-64, 71-72, 76-76, 79-79
frontend/plugins/tourism_ui/module-federation.config.ts (1)
23-23: LGTM!The new module exposure for the unified tourism module is correctly configured and aligns with the PR's restructuring objectives.
frontend/plugins/tourism_ui/src/modules/main/Main.tsx (1)
1-31: LGTM on routing implementation!The lazy loading with Suspense fallback is correctly implemented, and the route structure is clear and functional.
frontend/plugins/tourism_ui/src/config.tsx (2)
24-29: LGTM on unified tourism module configuration!The migration from separate pms/tms modules to a unified tourism module aligns with the PR objectives.
30-43: Verify commented-out module configurations.The previous pms and tms module configurations are commented out. Confirm whether these should be:
- Removed entirely if no longer needed
- Kept as placeholders for future reactivation
- Documented with a TODO or explanation
frontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.ts (1)
4-22: Excellent form schema improvements!The changes enhance the schema with:
- Corrected field names (generalManeger → generalManager, manegers → managers)
- Sensible default values for optional fields
- Clear validation messages for required nested fields
These improvements will provide better developer experience and more predictable form state management.
frontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.ts (1)
1-4: LGTM!The currentStepAtom is cleanly implemented for tracking multi-step form state.
frontend/plugins/tourism_ui/project.json (1)
18-18: LGTM!The assets configuration correctly enables the tourism UI module to include static assets for images and branding.
frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts (1)
20-21: LGTM! Clean interface additions.The new
generalManagerIdsandmanagerIdsfields follow the existing pattern and align with the GraphQL schema updates mentioned in the AI summary.frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDetail.ts (1)
13-25: LGTM! Well-structured data fetching hook.The hook properly implements the skip condition to prevent unnecessary queries when
idis absent, and usescache-and-networkfetch policy for fresh data while utilizing cache.frontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsx (1)
6-31: LGTM! Excellent responsive design implementation.The component now follows a mobile-first approach with proper Tailwind breakpoints and uses
getPluginAssetsUrlfor dynamic asset loading, which ensures proper asset resolution in the module federation setup.frontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsx (1)
13-82: LGTM! Well-designed reusable confirmation dialog.The component provides a clean, type-safe interface for both duplicate and delete confirmations with proper loading state handling.
frontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsx (1)
65-67: LGTM! Proper date formatting with safe fallback.The date formatting correctly handles missing
createdAtvalues with an 'N/A' fallback.frontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsx (1)
127-136: The original review comment's concern is incorrect.The form schema definitively shows that
paymentandtokenare optional fields with default empty string values. The current validation strategy—which only validatesnameandcolorbefore advancing or saving—is correct, as these are the only required fields in the form. Steps 2 and 3 contain only optional fields, so the absence of validation for those steps is appropriate and intentional.Likely an incorrect or invalid review comment.
frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx
Outdated
Show resolved
Hide resolved
| ) | ||
| } | ||
|
|
||
| export default App No newline at end of file |
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
Use named export instead of default export.
The coding guidelines specify favoring named exports for components.
As per coding guidelines.
Apply this diff:
-export default App
+export { App }You'll also need to update the import in module-federation.config.ts accordingly.
📝 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 default App | |
| export { App } |
🤖 Prompt for AI Agents
In frontend/plugins/tourism_ui/src/modules/main/Main.tsx around line 33, the
file currently uses a default export for the App component; change it to a named
export (export const App = ... or export { App }) and remove the default export
line, then update any imports—specifically update the import in
module-federation.config.ts to import { App } from './modules/main/Main' (or the
correct relative path) instead of the default import, and run a quick build/test
to ensure no other files reference the default export.
frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx
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.
Important
Looks good to me! 👍
Reviewed eb911f8 in 53 seconds. Click for details.
- Reviewed
25lines of code in2files - Skipped
0files when reviewing. - Skipped posting
2draft 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/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx:54
- Draft comment:
Typo fix: changed 'FrontlitnePaths' to 'FrontlinePaths' to correctly reference the path. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx:62
- Draft comment:
Added missing key prop for list items using item.label as a key. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%This comment is purely informative, stating that a missing key prop was added. It doesn't provide a suggestion or ask for confirmation about a specific change. It doesn't align with the rules for good comments.
Workflow ID: wflow_cCJ0fmPrNqOmJm5K
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
🧹 Nitpick comments (1)
frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx (1)
20-41: Simplify onClick handlers and remove stale commented code.The onClick handlers unnecessarily wrap the callbacks in arrow functions, and the commented code references a non-existent
branch.websitevariable.Apply this diff:
const dropdownItems = [ { label: 'Edit', icon: <IconEdit size={16} stroke={1.5} />, - onClick: () => onEdit(), + onClick: onEdit, }, { label: 'Duplicate', icon: <IconCopy className="size-4" />, - onClick: () => onDuplicate(), + onClick: onDuplicate, }, - // { - // label: 'Visit website', - // icon: <IconWorld size={16} stroke={1.5} />, - // onClick: () => window.open(branch.website, '_blank'), - // }, { label: 'Delete', icon: <IconTrash size={16} stroke={1.5} />, - onClick: () => onDelete(), + onClick: onDelete, }, ];
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx(2 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.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/tourism_ui/src/modules/tms/components/ActionMenu.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/tourism_ui/src/modules/tms/components/ActionMenu.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/tourism_ui/src/modules/tms/components/ActionMenu.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/tourism_ui/src/modules/tms/components/ActionMenu.tsx
**/*.{webp,tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Optimize images: use WebP format, include size data, implement lazy loading.
Files:
frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx
🧬 Code graph analysis (1)
frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx (1)
frontend/libs/erxes-ui/src/components/popover.tsx (1)
Popover(52-57)
⏰ 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)
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 0bc4cd5 in 37 seconds. Click for details.
- Reviewed
147lines 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. frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts:4
- Draft comment:
Good refactor using spread for merging defaults and storage. Ensure that all new fields in TmsForm are correctly serialized in storage. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
2. frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx:29
- Draft comment:
Nice update for duplicateLoading state. Consider defining a proper type for dropdown items to avoid using 'as any' for the disabled property. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
3. frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx:293
- Draft comment:
Updated payment field reference from 'paymentsPublic' to 'payments'. Ensure this change aligns with your GraphQL schema. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
4. frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts:6
- Draft comment:
Allowing startCursor/endCursor to be null improves cursor handling. Confirm consuming code properly handles null cursors. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
Workflow ID: wflow_BwVcFiHbxAxksnNV
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: 0
🧹 Nitpick comments (2)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (1)
1-3: Use absolute import paths per coding guidelines.The imports use relative paths, but the coding guidelines require absolute paths for all imports. Consider updating to absolute paths for consistency with project standards.
As per coding guidelines.
frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx (1)
29-35: Remove redundant onChange handler.The
onChangehandler at lines 32-34 is unnecessary because the spread operator{...field}already includesfield.onChange. This wrapper adds no functionality and can be simplified.Apply this diff to simplify the code:
<Form.Control> - <Input - className="h-8 rounded-md" - {...field} - onChange={(e) => { - field.onChange(e); - }} - /> + <Input className="h-8 rounded-md" {...field} /> </Form.Control>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx(21 hunks)frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts
- frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.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/tourism_ui/src/modules/tms/hooks/BranchList.tsfrontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.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/tourism_ui/src/modules/tms/hooks/BranchList.tsfrontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.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/tourism_ui/src/modules/tms/components/TmsFormFields.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/tourism_ui/src/modules/tms/components/TmsFormFields.tsx
**/*.{webp,tsx,jsx}
📄 CodeRabbit inference engine (.cursorrules)
Optimize images: use WebP format, include size data, implement lazy loading.
Files:
frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx
🧬 Code graph analysis (2)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (3)
backend/erxes-api-shared/src/utils/mongo/cursor-util.ts (1)
PageInfo(25-30)frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts (1)
IBranch(11-28)frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts (1)
GET_BRANCH_LIST(3-53)
frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx (7)
frontend/libs/erxes-ui/src/components/form.tsx (1)
Form(166-174)frontend/libs/erxes-ui/src/components/color-picker.tsx (1)
ColorPicker(181-185)frontend/libs/erxes-ui/src/components/upload.tsx (1)
Upload(320-325)frontend/libs/ui-modules/src/modules/team-members/components/SelectMember.tsx (1)
SelectMember(463-475)frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts (1)
PAYMENT_LIST(86-97)frontend/libs/erxes-ui/src/components/select.tsx (1)
Select(145-156)frontend/plugins/tourism_ui/src/modules/tms/components/PaymentIcon.tsx (1)
paymentIconOptions(12-19)
⏰ 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 (10)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (2)
5-10: Great fix – PageInfo cursor types now match the backend contract.The cursor types have been correctly updated to
string | null, which aligns with the backend interface incursor-util.ts. This addresses the previous review concern.
45-45: Verify the necessity ofnetwork-onlyfetch policy.The
network-onlypolicy bypasses Apollo's cache entirely, which ensures fresh data but may impact performance if the branch list is queried frequently. Consider whethercache-firstwith selectiverefetchcalls would better balance freshness and performance.frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx (8)
44-69: LGTM!The ColorPicker integration is clean and follows the expected pattern for controlled form components.
71-148: LGTM!The loading state management and conditional rendering logic are well-implemented. The hidden
Upload.Previewcomponent is necessary to trigger upload callbacks and maintain proper state flow.
150-233: LGTM!The implementation mirrors the LogoField pattern correctly and maintains consistency across upload components.
235-264: LGTM!The naming corrections (GeneralManeger → GeneralManager) and integration with
SelectMember.FormItemimprove code quality and consistency.
266-290: LGTM!The naming corrections (Maneger → Manager, manegers → managers) and
SelectMember.FormItemintegration are consistent with the GeneralManager component updates.
292-344: LGTM!The Payments component correctly uses
data?.payments(line 294), which matches the GraphQL query response structure. The past review concern about the field name mismatch has been resolved. Loading and empty states are properly handled.
346-363: LGTM!The Token field implementation is straightforward and correct.
365-532: LGTM!The OtherPayments component properly uses
useFieldArrayfor dynamic field management. The integration ofPaymentIconwith the icon selector provides good UX by showing visual feedback alongside text labels.
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 03c8125 in 48 seconds. Click for details.
- Reviewed
28lines of code in2files - 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/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts:46
- Draft comment:
Added notifyOnNetworkStatusChange: true ensures the UI reflects network status changes (e.g., during pagination). Verify this is the intended behavior. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
2. frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts:45
- Draft comment:
Explicitly setting orderBy: { createdAt: -1 } improves clarity. Consider centralizing default ordering to avoid duplication if it’s used in multiple places. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
3. frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts:49
- Draft comment:
Using awaitRefetchQueries: true ensures the mutation waits for the refetch to complete. Confirm that any added delay aligns with the desired UX. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
Workflow ID: wflow_QQs4chLoOC02RoJF
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: 3
🧹 Nitpick comments (2)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (2)
25-25: Consider a more specific type fororderBy.The
orderByparameter usesany, which reduces type safety. Consider using a more specific type likeRecord<string, 1 | -1>to match MongoDB-style sort orders, or define a specific interface for the sort fields.Example:
- orderBy?: Record<string, any>; + orderBy?: Record<string, 1 | -1>;
50-52: Consider handling undefinedpageInfoexplicitly.The
pageInfoextraction doesn't provide a fallback value (unlikelistandtotalCount), which means it can beundefinedwhen there's no data. While this may be acceptable, consider whether consumers should handle this or if a default value would improve the API.Example with a default:
- const pageInfo = data?.bmsBranchList?.pageInfo; + const pageInfo = data?.bmsBranchList?.pageInfo || { + hasNextPage: false, + hasPreviousPage: false, + startCursor: null, + endCursor: null, + };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts(1 hunks)frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/tourism_ui/src/modules/tms/hooks/CreateBranch.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts
**/*.{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/tourism_ui/src/modules/tms/hooks/CreateBranch.tsfrontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts
🧬 Code graph analysis (2)
frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts (2)
frontend/plugins/tourism_ui/src/modules/tms/graphql/mutation.ts (1)
CREATE_BRANCH(3-56)frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts (1)
GET_BRANCH_LIST(3-53)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (3)
backend/erxes-api-shared/src/utils/mongo/cursor-util.ts (1)
PageInfo(25-30)frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts (1)
IBranch(11-28)frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts (1)
GET_BRANCH_LIST(3-53)
⏰ 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 (4)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (2)
5-10: PageInfo cursor types are correct.The
startCursorandendCursorfields are correctly typed asstring | null, matching the backend interface. This properly handles cases where there are no more pages.
45-45: Verify thatfetchPolicy: 'network-only'is intentional.Using
network-onlybypasses the Apollo cache entirely, meaning every component render or hook call will trigger a network request. This could impact performance if the branch list is accessed frequently.Consider whether
cache-and-networkor the defaultcache-firstpolicy would be more appropriate for your use case. Thenetwork-onlypolicy is typically reserved for data that must always be fresh (e.g., real-time dashboards, live counts).frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts (2)
19-32: Good type safety for permissionConfig and uiOptions.The structured TypeScript types for
permissionConfiganduiOptionsprovide better client-side type safety than the genericJSONtype used in the GraphQL mutation signature. This is a good practice for catching type errors early.
52-65: LGTM! Clean implementation of the hook.The
createBranchfunction correctly forwards all options to the underlying mutation, and the hook exposes all necessary values (createBranch,loading,error) for consumers. The implementation properly handlesonCompletedandonErrorcallbacks.
| import { GET_BRANCH_LIST } from '../graphql/queries'; | ||
| import { IBranch } from '../types/branch'; |
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.
Use absolute imports per coding guidelines.
The imports use relative paths, but the coding guidelines require absolute paths for all imports.
As per coding guidelines.
Apply this diff to use absolute imports:
-import { GET_BRANCH_LIST } from '../graphql/queries';
-import { IBranch } from '../types/branch';
+import { GET_BRANCH_LIST } from '@tourism_ui/modules/tms/graphql/queries';
+import { IBranch } from '@tourism_ui/modules/tms/types/branch';Note: Adjust the absolute path prefix based on your project's path alias configuration.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts around lines
2 to 3, the imports use relative paths but the repo coding guidelines require
absolute imports; update the two imports to their corresponding absolute module
paths (e.g. replace '../graphql/queries' and '../types/branch' with the
project's configured path aliases such as '@tms/graphql/queries' and
'@tms/types/branch' or the correct alias for your setup), ensure you preserve
the named imports (GET_BRANCH_LIST, IBranch) and update any build/tsconfig path
settings if necessary so the new absolute paths resolve.
| import { CREATE_BRANCH } from '../graphql/mutation'; | ||
| import { GET_BRANCH_LIST } from '../graphql/queries'; |
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.
Use absolute imports for local files.
The imports use relative paths ('../graphql/mutation' and '../graphql/queries'), which violates the coding guidelines requiring absolute paths for all imports.
As per coding guidelines.
Apply this diff to use absolute imports:
-import { CREATE_BRANCH } from '../graphql/mutation';
-import { GET_BRANCH_LIST } from '../graphql/queries';
+import { CREATE_BRANCH } from 'frontend/plugins/tourism_ui/src/modules/tms/graphql/mutation';
+import { GET_BRANCH_LIST } from 'frontend/plugins/tourism_ui/src/modules/tms/graphql/queries';📝 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 { CREATE_BRANCH } from '../graphql/mutation'; | |
| import { GET_BRANCH_LIST } from '../graphql/queries'; | |
| import { CREATE_BRANCH } from 'frontend/plugins/tourism_ui/src/modules/tms/graphql/mutation'; | |
| import { GET_BRANCH_LIST } from 'frontend/plugins/tourism_ui/src/modules/tms/graphql/queries'; |
🤖 Prompt for AI Agents
In frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts around
lines 2–3, the file currently imports local modules using relative paths;
replace those with the project's configured absolute import aliases (e.g. use
the repo's alias such as "@/modules/tms/graphql/mutation" and
"@/modules/tms/graphql/queries" or the equivalent absolute root path your
tsconfig/webpack defines) by updating both import statements to the absolute
paths and then run the linter/TypeScript build to verify resolution.
| refetchQueries: [ | ||
| { | ||
| query: GET_BRANCH_LIST, | ||
| variables: { | ||
| limit: 10, | ||
| orderBy: { createdAt: -1 }, | ||
| }, | ||
| }, |
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 refetch configuration and paymentTypes inconsistency.
Two concerns:
-
The hardcoded
limit: 10may not reflect the user's current pagination state. If a user is viewing a different page or has a different limit set, the refetch might cause unexpected behavior. -
The GraphQL mutation signature includes
$paymentTypes: [JSON](see mutation snippet), butICreateBranchVariablesinterface does not include apaymentTypesfield. This prevents TypeScript from allowing this parameter even though the backend mutation accepts it.
Run the following script to verify whether paymentTypes is used elsewhere in the codebase:
🏁 Script executed:
#!/bin/bash
# Search for usage of paymentTypes in relation to branch creation
rg -nP --type=ts --type=tsx -C3 '\bpaymentTypes\b' -g '!node_modules' -g '!dist' -g '!build'Length of output: 27
🏁 Script executed:
#!/bin/bash
# Search for paymentTypes usage (corrected: use --type=ts instead of --type=tsx)
rg -nP --type=ts -C3 '\bpaymentTypes\b'Length of output: 59567
🏁 Script executed:
#!/bin/bash
# Examine the CreateBranch.ts file directly to see the interface and mutation
cat frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.tsLength of output: 1396
🏁 Script executed:
#!/bin/bash
# Search for ICreateBranchVariables interface definition
rg -nP --type=ts -C5 'interface ICreateBranchVariables'Length of output: 979
🏁 Script executed:
#!/bin/bash
# Search for CREATE_BRANCH mutation definition to see its signature
rg -nP --type=ts -C10 'CREATE_BRANCH.*=.*gql'Length of output: 1185
🏁 Script executed:
#!/bin/bash
# Search for GET_BRANCH_LIST query to understand the refetch pattern
rg -nP --type=ts -C5 'GET_BRANCH_LIST.*=.*gql'Length of output: 715
Fix missing paymentTypes field in ICreateBranchVariables and use dynamic pagination limit in refetch.
Two issues found:
-
Missing
paymentTypesin interface (line 10-30): The mutation signature accepts$paymentTypes: [JSON], butICreateBranchVariableslacks this field. Compare withBranchEdit.tsandBranchDuplicate.tswhich both includepaymentTypes?: any[]. Add it to maintain consistency. -
Hardcoded refetch limit (line 44): The refetch uses
limit: 10regardless of the user's current pagination state. If a user views page 2 with limit 20, the refetch will request page 1 with limit 10, causing inconsistent data and UX issues. Pass the current pagination limit to the refetch instead.
🤖 Prompt for AI Agents
In frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts around
lines 10-30 and 40-47: the ICreateBranchVariables interface is missing the
paymentTypes field and the refetchQueries call uses a hardcoded limit of 10. Add
paymentTypes?: any[] (matching BranchEdit/BranchDuplicate) to
ICreateBranchVariables, and change the refetchQueries variables to use the
current pagination limit (pass the component/hook's active limit variable
instead of the literal 10) so refetch respects the user's current page size.
Important
Introduces a new Tourism module with comprehensive branch management features, including creation, editing, duplication, and deletion, along with UI enhancements and GraphQL integration.
Tourismmodule with branch management UI, routes, and a read-only preview page inMain.tsx.CreateTmsForm.tsxandBranchCard.tsx.BranchList.tsx.CREATE_BRANCH,EDIT_BRANCH, andREMOVE_BRANCHinmutation.ts.GET_BRANCH_LIST,BRANCH_LIST_DETAIL, andPAYMENT_LISTinqueries.ts.formAtoms.tsandtmsInformationFieldsAtoms.ts.ActionMenu,BranchCard,BranchList,ConfirmationDialog,CreateTmsForm,EmptyList,PaymentIcon,TmsFormFields, andTmsInformationFieldscomponents.EMPreviewIntro.tsxandEMSetup.tsxfor better UI consistency.module-federation.config.tsandproject.jsonfor module federation and build configurations..env.samplefile.This description was created by
for 03c8125. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit
New Features
Improvements
Bug Fixes