Skip to content

Conversation

@tsebaa0310
Copy link
Collaborator

@tsebaa0310 tsebaa0310 commented Nov 4, 2025

Important

Introduces a new Tourism module with comprehensive branch management features, including creation, editing, duplication, and deletion, along with UI enhancements and GraphQL integration.

  • New Features:
    • Introduces Tourism module with branch management UI, routes, and a read-only preview page in Main.tsx.
    • Implements multi-step create/edit flow with live preview, duplication, confirmation dialogs, and card-based branch actions in CreateTmsForm.tsx and BranchCard.tsx.
    • Adds pagination-enabled branch listing in BranchList.tsx.
  • GraphQL:
    • Adds mutations CREATE_BRANCH, EDIT_BRANCH, and REMOVE_BRANCH in mutation.ts.
    • Adds queries GET_BRANCH_LIST, BRANCH_LIST_DETAIL, and PAYMENT_LIST in queries.ts.
  • State Management:
    • Uses Jotai atoms for form state management in formAtoms.ts and tmsInformationFieldsAtoms.ts.
  • UI Components:
    • Adds ActionMenu, BranchCard, BranchList, ConfirmationDialog, CreateTmsForm, EmptyList, PaymentIcon, TmsFormFields, and TmsInformationFields components.
    • Enhances EMPreviewIntro.tsx and EMSetup.tsx for better UI consistency.
  • Miscellaneous:
    • Updates module-federation.config.ts and project.json for module federation and build configurations.
    • Removes .env.sample file.

This description was created by Ellipsis for 03c8125. You can customize this summary. It will automatically update as commits are pushed.


Summary by CodeRabbit

  • New Features

    • Tourism module shipped: branch management UI, routes, and a read-only preview page.
    • Card-based branch list with pagination, duplication, delete confirmations, and per-branch action menu.
    • Multi-step create/edit flow with live preview, upload progress, and resizable preview pane.
  • Improvements

    • Dynamic payment options, improved manager selection, stronger form validation, and persistent form state.
    • Updated assets included in tourism build and improved loading/error states for lists and forms.
  • Bug Fixes

    • Minor UI and layout refinements.

Copy link

@sourcery-ai sourcery-ai bot left a 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

Copy link

@greptile-apps greptile-apps bot left a 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.

@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

Adds 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 .env.sample, and applies small frontend cosmetic tweaks.

Changes

Cohort / File(s) Summary
Environment
\.env.sample
Removed hardcoded environment variable definitions (REACT_APP_API_URL, NODE_ENV, MONGO_URL, NODE_OPTIONS, ENABLED_PLUGINS).
Frontend cosmetic — EM components
frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx, frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx
Cosmetic reordering of Tailwind utility classes and minor formatting edits; no behavioral changes.
Module config & assets
frontend/plugins/tourism_ui/module-federation.config.ts, frontend/plugins/tourism_ui/project.json, frontend/plugins/tourism_ui/src/config.tsx
Added ./tourism expose for module federation, added build assets path, replaced/disabled pms/tms entries and introduced tourism in CONFIG.
Routing / Entry
frontend/plugins/tourism_ui/src/modules/main/Main.tsx
New lazy-loaded React Router App with routes for /tms, /tms/PreviewPage, /pms and root redirect.
Persistent form state & atoms
frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts, frontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.ts
Added storage-backed tmsFormAtom, resetFormAtom, and currentStepAtom for multi-step form state.
Schema & types
frontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.ts, frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts
Renamed fields (generalManegergeneralManager, manegersmanagers), added defaults for logo/favIcon/payment/token/otherPayments, strengthened otherPayments validation; added generalManagerIds and managerIds to IBranch.
GraphQL operations
frontend/plugins/tourism_ui/src/modules/tms/graphql/mutation.ts, frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts
Renamed/added mutations (CREATE_BRANCH, EDIT_BRANCH), replaced user1Ids/user2Ids with generalManagerIds/managerIds, expanded response shapes, added PAYMENT_LIST, and converted branch list to paginated bmsBranchList.
Hooks — branch flows
frontend/plugins/tourism_ui/src/modules/tms/hooks/*
Added/updated hooks: parameterized useBranchList (pagination + refetch), useBranchDetail, useBranchDuplicate, refactored useBranchEdit (mutation-driven), useBranchRemove (options + toasts), updated useCreateBranch, and new useBranchSubmit to orchestrate create/edit flows.
Components — new
frontend/plugins/tourism_ui/src/modules/tms/components/*
Added ActionMenu.tsx, BranchCard.tsx, ConfirmationDialog.tsx, PaymentIcon.tsx; updated EmptyList.tsx to use plugin assets.
Components — refactored / moved
frontend/plugins/tourism_ui/src/modules/tms/components/{BranchList,CreateTmsForm,CreateTmsSheet,TmsFormFields,TmsInformationFields,Settings}.tsx
BranchList refactored to card/dialog flow; CreateTmsForm supports edit mode, split preview and Jotai sync; CreateTmsSheet wired to global step; TmsFormFields adds ColorPicker, payment loading and renamed exports (GeneralManager/Manager); TmsInformationFields uses Jotai currentStep and accepts isOpen/isLoading props; minor Settings style tweak.
Preview changes
frontend/plugins/tourism_ui/src/modules/tms/components/Preview.tsx, frontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsx
Removed device-frame Preview.tsx; added PreviewPage.tsx rendering a static sign-in preview driven by tmsFormAtom.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Points to focus review on:

  • GraphQL name/shape changes and backend compatibility for CREATE/EDIT and BmsBranchList/BmsBranchDetail.
  • Form synchronization between Jotai atoms, persisted storage, and edit/create lifecycle in CreateTmsForm and TmsInformationFields.
  • Hook orchestration and side-effects (toasts, refetch callbacks) in useBranchSubmit, useBranchEdit, useBranchDuplicate, useBranchRemove.
  • Public API/name changes (renamed exports GeneralManager/Manager, changed useBranchList signature, new/removed Preview component).

Possibly related PRs

  • Tms #261 — Overlapping tourism_ui changes (routes, hooks, GraphQL, PreviewPage); likely highly related.
  • Revert "Tms" #263 — Conflicting/overlapping refactor of tourism_ui TMS components/hooks/GraphQL; potential merge conflicts.
  • refactor: tourism #192 — Backend GraphQL renames/pagination additions (bms/Bms* and PageInfo) that align with this PR’s query/mutation shape changes.

Suggested reviewers

  • Enkhtuvshin0513

Poem

🐇 I hopped through code with carrot zeal,
Branches bloom beneath my wheel,
Atoms hold the form so bright,
Routes wake lazily in the night,
I nibble bugs — TMS takes flight! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat: tourism api/tms' is vague and generic, using unclear abbreviations ('api/tms') that don't clearly convey the main change without additional context. Consider making the title more descriptive and specific, such as 'feat: add Tourism Management System module with branch management' to better communicate the primary changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/tourism_api

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

❤️ Share

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

Copy link

@ellipsis-dev ellipsis-dev bot left a 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 3479 lines of code in 33 files
  • Skipped 2 files when reviewing.
  • Skipped posting 6 draft 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 accept duplicateLoading without 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 returns payments or paymentsPublic. The name paymentsPublic seems 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, but paymentsPublic could 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 named paymentsPublic to distinguish from internal payment data. Without the query definition, I'm making assumptions. While it's possible the field name is wrong, the specific name paymentsPublic (not just payments) 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 name paymentsPublic appears 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% <= threshold 50% 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 Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

iframeSrc={
'/settings/frontline/channels' +
FrontlinePaths.ErxesMessengerPreview +
FrontlitnePaths.ErxesMessengerPreview +
Copy link

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.

Suggested change
FrontlitnePaths.ErxesMessengerPreview +
FrontlinePaths.ErxesMessengerPreview +

align="end"
>
{dropdownItems.map((item) => (
<div
Copy link

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 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 deriving logoUrl directly instead of using state.

The logoUrl can be computed directly from formData.logo during render, eliminating the need for useState and useEffect. This aligns with the coding guideline to minimize useEffect and setState.

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 .tsx files 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 onChange handler simply passes the event to field.onChange without any additional logic. The spread operator {...field} already includes the onChange handler.

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 using any type.

The value parameter uses any, which defeats TypeScript's type safety benefits.

Consider defining a proper type or using string if that's what ColorPicker accepts:

-              onValueChange={(value: any) => {
+              onValueChange={(value: string) => {
                 field.onChange(value);
               }}

150-233: Consider extracting shared upload logic.

The FavIconField and LogoField components share nearly identical implementation. Consider creating a reusable ImageUploadField component 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 like w-full or max-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 using any[] for paymentTypes.

The paymentTypes field uses any[], 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 updateBranchById and editBranch functions 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 error has a message property, 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: Reconsider fetchPolicy: 'network-only'.

Using fetchPolicy: 'network-only' bypasses Apollo's cache entirely, which may lead to unnecessary network requests and slower UX. Consider using cache-and-network or cache-first unless 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

📥 Commits

Reviewing files that changed from the base of the PR and between 231fdbe and 1060b2e.

⛔ Files ignored due to path filters (2)
  • frontend/plugins/tourism_ui/src/assets/tourism-empty-state.jpg is excluded by !**/*.jpg
  • pnpm-lock.yaml is 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.ts
  • frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts
  • frontend/plugins/tourism_ui/src/modules/tms/components/PaymentIcon.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/Settings.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsx
  • frontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/useBranchSubmit.ts
  • frontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsx
  • frontend/plugins/tourism_ui/src/modules/main/Main.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.ts
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDetail.ts
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchRemove.ts
  • frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts
  • frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDuplicate.ts
  • frontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.ts
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts
  • frontend/plugins/tourism_ui/src/config.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchEdit.ts
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsx
  • frontend/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.ts
  • frontend/plugins/tourism_ui/src/modules/tms/types/branch.ts
  • frontend/plugins/tourism_ui/src/modules/tms/components/PaymentIcon.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/Settings.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsx
  • frontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/useBranchSubmit.ts
  • frontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsx
  • frontend/plugins/tourism_ui/src/modules/main/Main.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/states/tmsInformationFieldsAtoms.ts
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDetail.ts
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchRemove.ts
  • frontend/plugins/tourism_ui/src/modules/tms/atoms/formAtoms.ts
  • frontend/plugins/tourism_ui/src/modules/tms/graphql/queries.ts
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchDuplicate.ts
  • frontend/plugins/tourism_ui/src/modules/tms/constants/formSchema.ts
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/CreateBranch.ts
  • frontend/plugins/tourism_ui/src/config.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchEdit.ts
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/TmsInformationFields.tsx
  • frontend/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.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/Settings.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsx
  • frontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsx
  • frontend/plugins/tourism_ui/src/modules/main/Main.tsx
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx
  • frontend/plugins/tourism_ui/src/config.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx
  • frontend/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.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/Settings.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsx
  • frontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsx
  • frontend/plugins/tourism_ui/src/modules/main/Main.tsx
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx
  • frontend/plugins/tourism_ui/src/config.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx
  • frontend/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.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/Settings.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsSheet.tsx
  • frontend/plugins/tourism_ui/src/pages/tms/PreviewPage.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ConfirmationDialog.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/EmptyList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/ActionMenu.tsx
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMSetup.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchCard.tsx
  • frontend/plugins/tourism_ui/src/modules/main/Main.tsx
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx
  • frontend/plugins/tourism_ui/src/config.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/BranchList.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/CreateTmsForm.tsx
  • frontend/plugins/tourism_ui/src/modules/tms/components/TmsFormFields.tsx
  • frontend/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.ts
  • 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} : Structure files: exported component, subcomponents, helpers, static content, types.

Applied to files:

  • frontend/plugins/tourism_ui/module-federation.config.ts
  • frontend/plugins/tourism_ui/project.json
  • 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} : Favor named exports for components.

Applied to files:

  • frontend/plugins/tourism_ui/module-federation.config.ts
  • 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 : 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.tsx
  • frontend/plugins/frontline_ui/src/modules/integrations/erxes-messenger/components/EMPreviewIntro.tsx
  • frontend/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 generalManagerIds and managerIds fields 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 id is absent, and uses cache-and-network fetch 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 getPluginAssetsUrl for 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 createdAt values 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 payment and token are optional fields with default empty string values. The current validation strategy—which only validates name and color before 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.

)
}

export default App No newline at end of file
Copy link

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.

Suggested change
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.

Copy link

@ellipsis-dev ellipsis-dev bot left a 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 25 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft 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% <= threshold 50% 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 Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 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.website variable.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1060b2e and eb911f8.

📒 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)

Copy link

@ellipsis-dev ellipsis-dev bot left a 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 147 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% None

Workflow ID: wflow_BwVcFiHbxAxksnNV

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (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 onChange handler at lines 32-34 is unnecessary because the spread operator {...field} already includes field.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

📥 Commits

Reviewing files that changed from the base of the PR and between eb911f8 and 0bc4cd5.

📒 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.ts
  • frontend/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.ts
  • frontend/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 in cursor-util.ts. This addresses the previous review concern.


45-45: Verify the necessity of network-only fetch policy.

The network-only policy bypasses Apollo's cache entirely, which ensures fresh data but may impact performance if the branch list is queried frequently. Consider whether cache-first with selective refetch calls 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.Preview component 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.FormItem improve code quality and consistency.


266-290: LGTM!

The naming corrections (Maneger → Manager, manegers → managers) and SelectMember.FormItem integration 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 useFieldArray for dynamic field management. The integration of PaymentIcon with the icon selector provides good UX by showing visual feedback alongside text labels.

Copy link

@ellipsis-dev ellipsis-dev bot left a 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 28 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft 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% <= threshold 50% 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% <= threshold 50% 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% <= threshold 50% None

Workflow ID: wflow_QQs4chLoOC02RoJF

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
frontend/plugins/tourism_ui/src/modules/tms/hooks/BranchList.ts (2)

25-25: Consider a more specific type for orderBy.

The orderBy parameter uses any, which reduces type safety. Consider using a more specific type like Record<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 undefined pageInfo explicitly.

The pageInfo extraction doesn't provide a fallback value (unlike list and totalCount), which means it can be undefined when 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0bc4cd5 and 03c8125.

📒 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.ts
  • frontend/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.ts
  • frontend/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 startCursor and endCursor fields are correctly typed as string | null, matching the backend interface. This properly handles cases where there are no more pages.


45-45: Verify that fetchPolicy: 'network-only' is intentional.

Using network-only bypasses 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-network or the default cache-first policy would be more appropriate for your use case. The network-only policy 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 permissionConfig and uiOptions provide better client-side type safety than the generic JSON type 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 createBranch function correctly forwards all options to the underlying mutation, and the hook exposes all necessary values (createBranch, loading, error) for consumers. The implementation properly handles onCompleted and onError callbacks.

Comment on lines 2 to 3
import { GET_BRANCH_LIST } from '../graphql/queries';
import { IBranch } from '../types/branch';
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

Comment on lines +2 to +3
import { CREATE_BRANCH } from '../graphql/mutation';
import { GET_BRANCH_LIST } from '../graphql/queries';
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
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.

Comment on lines +40 to +47
refetchQueries: [
{
query: GET_BRANCH_LIST,
variables: {
limit: 10,
orderBy: { createdAt: -1 },
},
},
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify refetch configuration and paymentTypes inconsistency.

Two concerns:

  1. The hardcoded limit: 10 may 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.

  2. The GraphQL mutation signature includes $paymentTypes: [JSON] (see mutation snippet), but ICreateBranchVariables interface does not include a paymentTypes field. 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.ts

Length 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:

  1. Missing paymentTypes in interface (line 10-30): The mutation signature accepts $paymentTypes: [JSON], but ICreateBranchVariables lacks this field. Compare with BranchEdit.ts and BranchDuplicate.ts which both include paymentTypes?: any[]. Add it to maintain consistency.

  2. Hardcoded refetch limit (line 44): The refetch uses limit: 10 regardless 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants