-
Notifications
You must be signed in to change notification settings - Fork 4
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?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||
| import React, { lazy, Suspense } from 'react' | ||||||
| import { Navigate, Route, Routes } from 'react-router-dom' | ||||||
|
|
||||||
| const Tms = lazy(() => | ||||||
| import('~/pages/tms/IndexPage').then((module) => ({ | ||||||
| default: module.IndexPage, | ||||||
| })), | ||||||
| ); | ||||||
| const TmsPreview = lazy(() => | ||||||
| import('~/pages/tms/PreviewPage').then((module) => ({ | ||||||
| default: module.PreviewPage, | ||||||
| })), | ||||||
| ); | ||||||
| const Pms = lazy(() => | ||||||
| import('~/pages/pms/IndexPage').then((module) => ({ | ||||||
| default: module.IndexPage, | ||||||
| })), | ||||||
| ); | ||||||
|
|
||||||
| const App = () => { | ||||||
| return ( | ||||||
| <Suspense fallback={<div />}> | ||||||
| <Routes> | ||||||
| <Route path="/" element={<Navigate to="tms" replace />} /> | ||||||
| <Route path="/tms" element={<Tms />} /> | ||||||
| <Route path="/tms/PreviewPage" element={<TmsPreview />} /> | ||||||
| <Route path="/pms" element={<Pms />} /> | ||||||
| </Routes> | ||||||
| </Suspense> | ||||||
| ) | ||||||
| } | ||||||
|
|
||||||
| export default App | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { atom } from 'jotai'; | ||
| import { atomWithStorage, RESET } from 'jotai/utils'; | ||
|
|
||
| type TmsFormStorage = { | ||
| name: string; | ||
| color: string; | ||
| logo: string; | ||
| }; | ||
|
|
||
| export type TmsForm = { | ||
| name: string; | ||
| color: string; | ||
| logo: string; | ||
| favIcon: string; | ||
| generalManager: string[]; | ||
| managers: string[]; | ||
| payment: string; | ||
| token: string; | ||
| otherPayments: Array<{ | ||
| type: string; | ||
| title: string; | ||
| icon: string; | ||
| config?: string; | ||
| }>; | ||
| }; | ||
|
|
||
| const DEFAULT_STORAGE_FORM: TmsFormStorage = { | ||
| name: '', | ||
| color: '#4F46E5', | ||
| logo: '', | ||
| }; | ||
|
|
||
| export const DEFAULT_TMS_FORM: TmsForm = { | ||
| name: '', | ||
| color: '#4F46E5', | ||
| logo: '', | ||
| favIcon: '', | ||
| generalManager: [], | ||
| managers: [], | ||
| payment: '', | ||
| token: '', | ||
| otherPayments: [], | ||
| }; | ||
|
|
||
| const tmsFormStorageAtom = atomWithStorage<TmsFormStorage>( | ||
| 'tms_form_data', | ||
| DEFAULT_STORAGE_FORM, | ||
| ); | ||
|
|
||
| export const tmsFormAtom = atom( | ||
| (get) => { | ||
| const storage = get(tmsFormStorageAtom); | ||
| return { | ||
| ...DEFAULT_TMS_FORM, | ||
| name: storage.name, | ||
| color: storage.color, | ||
| logo: storage.logo, | ||
| }; | ||
| }, | ||
| (get, set, update: TmsForm) => { | ||
| set(tmsFormStorageAtom, { | ||
| name: update.name, | ||
| color: update.color, | ||
| logo: update.logo, | ||
| }); | ||
| }, | ||
| ); | ||
tsebaa0310 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export const resetFormAtom = atom(null, (get, set) => { | ||
| set(tmsFormStorageAtom, RESET); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import { | ||
| IconEdit, | ||
| IconCopy, | ||
| IconTrash, | ||
| IconChevronDown, | ||
| } from '@tabler/icons-react'; | ||
| import { Popover } from 'erxes-ui'; | ||
|
|
||
| interface ActionMenuProps { | ||
| onEdit: () => void; | ||
| onDuplicate: () => void; | ||
| onDelete: () => void; | ||
| } | ||
|
|
||
| export const ActionMenu = ({ | ||
| onEdit, | ||
| onDuplicate, | ||
| onDelete, | ||
| }: ActionMenuProps) => { | ||
| const dropdownItems = [ | ||
| { | ||
| label: 'Edit', | ||
| icon: <IconEdit size={16} stroke={1.5} />, | ||
| onClick: () => onEdit(), | ||
| }, | ||
| { | ||
| label: 'Duplicate', | ||
| icon: <IconCopy className="size-4" />, | ||
| 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(), | ||
| }, | ||
| ]; | ||
|
|
||
| return ( | ||
| <Popover> | ||
| <Popover.Trigger asChild> | ||
| <button | ||
| className="flex items-center leading-[100%] text-foreground font-inter gap-1 text-sm font-medium rounded-md p-1 hover:bg-muted focus:outline-none" | ||
| aria-label="Open action menu" | ||
| aria-haspopup="true" | ||
| > | ||
| Action | ||
| <IconChevronDown size={18} stroke={2} /> | ||
| </button> | ||
| </Popover.Trigger> | ||
| <Popover.Content | ||
| className="p-1 w-48 rounded-lg border shadow-lg bg-background" | ||
| side="bottom" | ||
| align="end" | ||
| > | ||
| {dropdownItems.map((item) => ( | ||
| <div | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| className="flex gap-3 items-center px-4 py-2 w-full text-left rounded-md cursor-pointer hover:bg-muted" | ||
| onClick={item.onClick} | ||
| > | ||
| {item.icon} | ||
| <p className="text-sm font-medium leading-[100%] font-inter"> | ||
| {item.label} | ||
| </p> | ||
| </div> | ||
| ))} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </Popover.Content> | ||
| </Popover> | ||
| ); | ||
| }; | ||
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:
FrontlitnePathsappears to be a typo. It should likely beFrontlinePaths.