Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .cursor/mcp.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"mcpServers": {
"nx-mcp": {
"url": "http://localhost:9216/sse"
}
}
"mcpServers": {}
}
34 changes: 9 additions & 25 deletions frontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,14 @@ export const getPluginsRoutes = () => {
const [pluginsMetaData] = useAtom(pluginsConfigState);
const plugins = Object.values(pluginsMetaData || {});

const allModules = plugins.flatMap((plugin) =>
plugin.modules
.filter((module) => !module.settingsOnly)
.map((module) => ({
...module,
pluginName: plugin.name,
})),
);

return allModules.map((module) => (
return plugins.map((module) => (
Copy link

Choose a reason for hiding this comment

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

style: Variable name 'module' is misleading since this now maps over plugins directly. Consider renaming to 'plugin' for consistency with getPluginsSettingsRoutes

Suggested change
return plugins.map((module) => (
return plugins.map((plugin) => (
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsx
Line: 11:11

Comment:
**style:** Variable name 'module' is misleading since this now maps over plugins directly. Consider renaming to 'plugin' for consistency with getPluginsSettingsRoutes

```suggestion
  return plugins.map((plugin) => (
```

How can I resolve this? If you propose a fix, please make it concise.

<Route
key={module.name}
path={`/${module.path}/*`}
element={
<RenderPluginsComponent
moduleName={module.name}
pluginName={`${module.pluginName}_ui`}
pluginName={`${module.name}_ui`}
remoteModuleName={module.name}
/>
}
Expand All @@ -36,24 +27,17 @@ export const getPluginsSettingsRoutes = () => {
const [pluginsMetaData] = useAtom(pluginsConfigState);
const plugins = Object.values(pluginsMetaData || {});

const settingsModules = plugins.flatMap((plugin) =>
plugin.modules
.filter((module) => module.hasSettings || module.settingsOnly)
.map((module) => ({
...module,
pluginName: plugin.name,
})),
);
console.log(plugins);
Copy link

Choose a reason for hiding this comment

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

syntax: Remove debug console.log statement before merging

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsx
Line: 30:30

Comment:
**syntax:** Remove debug console.log statement before merging

How can I resolve this? If you propose a fix, please make it concise.


Comment on lines +30 to 31
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

Remove the stray console.log.

Per our frontend guidelines we avoid console logging in shipped code. Please drop this log (or replace with structured telemetry if needed).

🤖 Prompt for AI Agents
In frontend/core-ui/src/modules/app/hooks/usePluginsRouter.tsx around lines
30-31 there is a stray console.log(plugins); that violates frontend guidelines;
remove this console.log (or replace it with a structured telemetry/analytics
call if you need runtime insight) and ensure no other debug logs remain in this
hook.

return settingsModules.map((module) => (
return plugins.map((plugin) => (
<Route
key={module.name}
path={`/${module.path}/*`}
key={plugin.name}
path={`/${plugin.path}/*`}
element={
<RenderPluginsComponent
moduleName={module.name}
pluginName={`${module.pluginName}_ui`}
remoteModuleName={`${module.name}Settings`}
moduleName={plugin.name}
pluginName={`${plugin.name}_ui`}
remoteModuleName={`${plugin.name}Settings`}
/>
}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IconChevronLeft } from '@tabler/icons-react';
import { activePluginState, NavigationMenuGroup, Sidebar } from 'erxes-ui';
import { usePluginsNavigationGroups } from '../hooks/usePluginsModules';
import { usePluginsNavigationGroups } from '../hooks/usePlugins';
import { useAtom } from 'jotai';

export const NavigationPluginExitButton = () => {
Expand Down Expand Up @@ -36,6 +36,7 @@ export const NavigationPlugins = () => {
}

if (activePlugin && navigationGroups[activePlugin]) {
const subGroups = navigationGroups[activePlugin].subGroups;
Copy link

Choose a reason for hiding this comment

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

suggestion (code-quality): Prefer object destructuring when accessing and using properties. (use-object-destructuring)

Suggested change
const subGroups = navigationGroups[activePlugin].subGroups;
const {subGroups} = navigationGroups[activePlugin];


ExplanationObject destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.

From the Airbnb Javascript Style Guide

return (
<>
<NavigationMenuGroup
Expand All @@ -50,7 +51,7 @@ export const NavigationPlugins = () => {
<Content key={index} />
))}
</NavigationMenuGroup>
{navigationGroups[activePlugin].subGroups.map((SubGroup, index) => (
{subGroups.map((SubGroup, index) => (
<SubGroup key={index} />
))}
</>
Expand Down
38 changes: 1 addition & 37 deletions frontend/core-ui/src/modules/navigation/hooks/useFavorites.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useQuery } from '@apollo/client';
import { GET_FAVORITES } from '@/navigation/graphql/queries/getFavorites';
import { usePluginsModules } from '@/navigation/hooks/usePluginsModules';
import { useAtomValue } from 'jotai';
import { currentUserState } from 'ui-modules';

Expand All @@ -21,7 +20,6 @@ interface GetFavoritesResponse {
}

export function useFavorites(): FavoriteModule[] {
const modules = usePluginsModules();
const currentUser = useAtomValue(currentUserState);

const { data } = useQuery<GetFavoritesResponse>(GET_FAVORITES, {
Expand All @@ -30,39 +28,5 @@ export function useFavorites(): FavoriteModule[] {

const favorites = data?.getFavoritesByCurrentUser ?? [];
Comment on lines 28 to 31
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): useFavorites now always returns an empty array.

This change will hide all favorite modules. If this is intentional or temporary, please clarify with a TODO or plan to restore the original logic.


return favorites.reduce<FavoriteModule[]>((acc, favorite) => {
if (favorite.type === 'module') {
const module = modules.find(
(m) => m.path === favorite.path.replace('/', ''),
);

if (module) {
acc.push({
name: module.name,
icon: module.icon,
path: module.path,
});
} else {
const moduleWithSubmenu = modules.find(
(m) => m.path === favorite.path.split('/')[1],
);

if (moduleWithSubmenu?.submenus) {
const matchingSubmenu = moduleWithSubmenu.submenus.find(
(sub) => sub.path === favorite.path.replace('/', ''),
);

if (matchingSubmenu) {
acc.push({
name: matchingSubmenu.name,
icon: matchingSubmenu.icon || moduleWithSubmenu.icon,
path: matchingSubmenu.path,
});
}
}
}
}

return acc;
}, []);
return [];
Copy link

Choose a reason for hiding this comment

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

logic: Favorites functionality has been completely removed - the hook now returns an empty array instead of processing favorites data. This will break any UI components that rely on displaying user favorites.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/core-ui/src/modules/navigation/hooks/useFavorites.tsx
Line: 31:31

Comment:
**logic:** Favorites functionality has been completely removed - the hook now returns an empty array instead of processing favorites data. This will break any UI components that rely on displaying user favorites.

How can I resolve this? If you propose a fix, please make it concise.

}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const usePluginsNavigationGroups = (): NavigationGroups => {
? [...existingGroup.contents, newContent]
: existingGroup.contents;

const newSubGroup = plugin.navigationGroup?.subGroups;
const newSubGroup = plugin.navigationGroup?.subGroup;
const updatedSubGroups = newSubGroup
? [...existingGroup.subGroups, newSubGroup]
: existingGroup.subGroups;
Comment on lines -64 to 67
Copy link

Choose a reason for hiding this comment

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

suggestion: subGroups replaced with subGroup in navigationGroup.

Ensure subGroup is consistently treated as an array to avoid issues when handling multiple subgroups.

Suggested change
const newSubGroup = plugin.navigationGroup?.subGroups;
const newSubGroup = plugin.navigationGroup?.subGroup;
const updatedSubGroups = newSubGroup
? [...existingGroup.subGroups, newSubGroup]
: existingGroup.subGroups;
const newSubGroup = plugin.navigationGroup?.subGroup
? Array.isArray(plugin.navigationGroup.subGroup)
? plugin.navigationGroup.subGroup
: [plugin.navigationGroup.subGroup]
: [];
const updatedSubGroups = newSubGroup.length > 0
? [...existingGroup.subGroups, ...newSubGroup]
: existingGroup.subGroups;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,9 @@ export function SettingsSidebar() {
))}
</SettingsNavigationGroup>

{Array.from(pluginsWithSettingsModules.entries()).map(
([pluginName, modules]) => (
<SettingsNavigationGroup
key={pluginName}
name={pluginName.charAt(0).toUpperCase() + pluginName.slice(1)}
>
{modules.map((item) => (
<NavigationMenuLinkItem
key={item.name}
pathPrefix={AppPath.Settings}
path={item.path}
name={item.name}
/>
))}
</SettingsNavigationGroup>
),
{pluginSettingsNavigations.map(
Copy link

Choose a reason for hiding this comment

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

The variable 'pluginSettingsNavigations' is used but not defined or imported. Verify its source to avoid runtime errors.

(SettingsNavigation, index) =>
SettingsNavigation && <SettingsNavigation key={index} />,
)}
Comment on lines +83 to 86
Copy link

Choose a reason for hiding this comment

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

logic: pluginSettingsNavigations is not defined. You need to either import it or create it from plugin configs with settingsNavigation functions.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/core-ui/src/modules/settings/components/SettingsSidebar.tsx
Line: 83:86

Comment:
**logic:** `pluginSettingsNavigations` is not defined. You need to either import it or create it from plugin configs with `settingsNavigation` functions.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +83 to 86
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

Define pluginSettingsNavigations before rendering.

pluginSettingsNavigations is referenced here but never defined, so the component now throws at render time. Please derive it from pluginsMetaData (e.g., memoize the non-null settingsNavigation functions) before mapping.

-  return (
+  const pluginSettingsNavigations = useMemo(
+    () =>
+      Object.values(pluginsMetaData || {})
+        .map((plugin) => plugin.settingsNavigation)
+        .filter(
+          (navigation): navigation is NonNullable<typeof navigation> =>
+            Boolean(navigation),
+        ),
+    [pluginsMetaData],
+  );
+
+  return (
@@
-        {pluginSettingsNavigations.map(
-          (SettingsNavigation, index) =>
-            SettingsNavigation && <SettingsNavigation key={index} />,
-        )}
+        {pluginSettingsNavigations.map((SettingsNavigation, index) => (
+          <SettingsNavigation key={index} />
+        ))}
📝 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
{pluginSettingsNavigations.map(
(SettingsNavigation, index) =>
SettingsNavigation && <SettingsNavigation key={index} />,
)}
const pluginSettingsNavigations = useMemo(
() =>
Object.values(pluginsMetaData || {})
.map((plugin) => plugin.settingsNavigation)
.filter(
(navigation): navigation is NonNullable<typeof navigation> =>
Boolean(navigation),
),
[pluginsMetaData],
);
return (
{pluginSettingsNavigations.map((SettingsNavigation, index) => (
<SettingsNavigation key={index} />
))}
);
🤖 Prompt for AI Agents
frontend/core-ui/src/modules/settings/components/SettingsSidebar.tsx around
lines 83 to 86: the code maps pluginSettingsNavigations which is not defined,
causing a render error; derive pluginSettingsNavigations from pluginsMetaData by
using React.useMemo to collect and return an array of non-null
settingsNavigation components/functions (e.g., pluginsMetaData.map(p =>
p.settingsNavigation).filter(Boolean)), memoized on pluginsMetaData, then use
that variable in the map call; ensure you type-check for undefined and keep the
existing key usage.

</Sidebar.Content>
</>
Expand All @@ -109,7 +96,6 @@ export const SettingsNavigationGroup = ({
name: string;
children: React.ReactNode;
}) => {

if (React.Children.count(children) === 0) return null;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const FloatingWidgets = () => {
return modules.map((module) => (
<RenderPluginsComponent
key={module.name}
pluginName={`${module.pluginName}_ui`}
pluginName={`${module.name}_ui`}
remoteModuleName="floatingWidget"
moduleName={module.name}
props={{ module }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,5 @@ export const useFloatingWidgetsModules = () => {

const plugins = Object.values(pluginsMetaData);

return plugins.flatMap((plugin) =>
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Floating widgets now filter plugins instead of modules.

This change may prevent floating widgets defined in modules from being included, potentially breaking existing functionality if widgets are meant to be module-specific.

plugin.modules
.filter((module) => module.hasFloatingWidget)
.map((module) => ({
...module,
pluginName: plugin.name,
})),
);
return plugins.filter((plugin) => plugin.hasFloatingWidget);
Copy link

Choose a reason for hiding this comment

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

logic: This structural change from module-level to plugin-level filtering will break if any consuming components still expect the old data structure with pluginName metadata and module-level objects

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/core-ui/src/modules/widgets/hooks/useFloatingWidgetsModules.tsx
Line: 13:13

Comment:
**logic:** This structural change from module-level to plugin-level filtering will break if any consuming components still expect the old data structure with `pluginName` metadata and module-level objects

How can I resolve this? If you propose a fix, please make it concise.

};
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export function RenderPluginsComponent({
const [isLoading, setIsLoading] = useState(true);
const [hasError, setHasError] = useState<{ message: string } | null>(null);

console.log(pluginName, remoteModuleName, moduleName);
Copy link

Choose a reason for hiding this comment

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

style: Console log should be removed per project guidelines that explicitly state 'Avoid console logs'

Context Used: Context from dashboard - .cursorrules (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/core-ui/src/plugins/components/RenderPluginsComponent.tsx
Line: 25:25

Comment:
**style:** Console log should be removed per project guidelines that explicitly state 'Avoid console logs'

**Context Used:** Context from `dashboard` - .cursorrules ([source](https://app.greptile.com/review/custom-context?memory=bf691a04-8aaa-40fe-8db5-b17d5fe3755f))

How can I resolve this? If you propose a fix, please make it concise.


Comment on lines +25 to +26
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

Remove the console.log statement.

The coding guidelines specify to avoid console logs in production code. This debug statement should be removed.

As per coding guidelines

Apply this diff to remove the debug statement:

-  console.log(pluginName, remoteModuleName, moduleName);
-
📝 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
console.log(pluginName, remoteModuleName, moduleName);
🤖 Prompt for AI Agents
In frontend/core-ui/src/plugins/components/RenderPluginsComponent.tsx around
lines 25-26, there is a leftover debug console.log(pluginName, remoteModuleName,
moduleName); which violates coding guidelines; remove that console.log statement
from the file and ensure no other console.* debug calls remain (run project
linter/grep for console.log to confirm) so production code contains no debug
logging.

useEffect(() => {
const loadPlugin = async () => {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
IconSpiral,
IconUser,
} from '@tabler/icons-react';
import { IUIConfig } from 'erxes-ui';

export const GET_CORE_MODULES = (version?: boolean): IUIConfig['modules'] => {
const MODULES: IUIConfig['modules'] = [
Comment on lines 14 to 15
Copy link

Choose a reason for hiding this comment

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

syntax: TypeScript error: IUIConfig is not defined. The import was removed but the type is still referenced in the return type and variable declaration.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/core-ui/src/plugins/constants/core-plugins.constants.ts
Line: 14:15

Comment:
**syntax:** TypeScript error: IUIConfig is not defined. The import was removed but the type is still referenced in the return type and variable declaration.

How can I resolve this? If you propose a fix, please make it concise.

Expand Down
6 changes: 3 additions & 3 deletions frontend/core-ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"erxes-ui/*": ["frontend/libs/erxes-ui/src/*"],
"ui-modules": ["frontend/libs/ui-modules/src"],
"ui-modules/*": ["frontend/libs/ui-modules/src/*"],
"@/*": ["frontend/core-ui/src/modules/*"],
"@": ["frontend/core-ui/src/modules"],
"~/*": ["frontend/core-ui/src/*"],
"~": ["frontend/core-ui/src"]
"@/*": ["frontend/core-ui/src/modules/*"],
"~": ["frontend/core-ui/src"],
"~/*": ["frontend/core-ui/src/*"]
}
},
"files": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const NavigationMenuLinkItem = forwardRef<
) => {
const { pathname } = useLocation();
const fullPath = pathPrefix ? `${pathPrefix}/${path}` : path;
const isActive = pathname.startsWith(`/${fullPath}`);

const isActive = pathname.startsWith(
fullPath?.startsWith('/') ? fullPath : `/${fullPath}`,
);
return (
<Sidebar.MenuItem>
<Sidebar.MenuButton
Expand Down Expand Up @@ -57,6 +60,21 @@ export const NavigationMenuLinkItem = forwardRef<

NavigationMenuLinkItem.displayName = 'NavigationMenuLinkItem';

export const SettingsNavigationMenuLinkItem = forwardRef<
React.ElementRef<typeof Sidebar.MenuButton>,
React.ComponentProps<typeof NavigationMenuLinkItem>
>(({ pathPrefix, ...props }, ref) => {
const settingsPathPrefix =
'/settings' + (pathPrefix?.startsWith('/') ? pathPrefix : `/${pathPrefix}`);
Comment on lines +67 to +68
Copy link

Choose a reason for hiding this comment

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

style: The path handling logic duplicates the same pattern used in NavigationMenuLinkItem. Consider extracting this into a utility function to avoid repetition.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/libs/erxes-ui/src/modules/navigation-menu/components/NavigationMenu.tsx
Line: 67:68

Comment:
**style:** The path handling logic duplicates the same pattern used in NavigationMenuLinkItem. Consider extracting this into a utility function to avoid repetition.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +67 to +68
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Handle undefined pathPrefix safely.

If pathPrefix is undefined, the concatenation will produce '/settings/undefined' as a string. Add a guard to handle the undefined case.

Apply this diff to fix the issue:

-  const settingsPathPrefix =
-    '/settings' + (pathPrefix?.startsWith('/') ? pathPrefix : `/${pathPrefix}`);
+  const settingsPathPrefix = pathPrefix
+    ? '/settings' + (pathPrefix.startsWith('/') ? pathPrefix : `/${pathPrefix}`)
+    : '/settings';
📝 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
const settingsPathPrefix =
'/settings' + (pathPrefix?.startsWith('/') ? pathPrefix : `/${pathPrefix}`);
const settingsPathPrefix = pathPrefix
? '/settings' + (pathPrefix.startsWith('/') ? pathPrefix : `/${pathPrefix}`)
: '/settings';
🤖 Prompt for AI Agents
In
frontend/libs/erxes-ui/src/modules/navigation-menu/components/NavigationMenu.tsx
around lines 67 to 68, the current expression can yield "/settings/undefined"
when pathPrefix is undefined; update the logic to guard against undefined by
only appending the prefixed path when pathPrefix is truthy—if pathPrefix is
provided, append it ensuring a single leading slash (use
pathPrefix.startsWith('/') ? pathPrefix : `/${pathPrefix}`), otherwise just use
"/settings".

return (
<NavigationMenuLinkItem
{...props}
pathPrefix={settingsPathPrefix}
ref={ref}
/>
);
});
Copy link

Choose a reason for hiding this comment

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

style: Missing displayName assignment for SettingsNavigationMenuLinkItem component, which is inconsistent with the pattern used for other components in this file.

Suggested change
});
});
SettingsNavigationMenuLinkItem.displayName = 'SettingsNavigationMenuLinkItem';
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/libs/erxes-ui/src/modules/navigation-menu/components/NavigationMenu.tsx
Line: 76:76

Comment:
**style:** Missing displayName assignment for SettingsNavigationMenuLinkItem component, which is inconsistent with the pattern used for other components in this file.

```suggestion
});

SettingsNavigationMenuLinkItem.displayName = 'SettingsNavigationMenuLinkItem';
```

How can I resolve this? If you propose a fix, please make it concise.


export const NavigationMenuItem = forwardRef<
React.ElementRef<typeof Sidebar.MenuButton>,
React.ComponentProps<typeof Sidebar.MenuButton> & {
Expand Down
21 changes: 4 additions & 17 deletions frontend/libs/erxes-ui/src/types/UIConfig.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
export type IUIConfig = {
name: string;
icon?: React.ElementType;
path: string;
hasFloatingWidget?: boolean;
settingsNavigation?: () => React.ReactNode;
navigationGroup?: {
name: string;
icon: React.ElementType;
content: () => React.ReactNode;
subGroups?: () => React.ReactNode;
subGroup?: () => React.ReactNode;
};
modules: {
name: string;
icon?: React.ElementType;
path: string;
hasSettings?: boolean;
hasRelationWidget?: boolean;
hasFloatingWidget?: boolean;
settingsOnly?: boolean;
submenus?: {
name: string;
path: string;
icon: React.ElementType
}[]
}[];

relationWidgets?: {
name: string;
icon?: React.ElementType;
Expand Down
5 changes: 2 additions & 3 deletions frontend/plugins/frontline_ui/module-federation.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ const config: ModuleFederationConfig = {
name: 'frontline_ui',
exposes: {
'./config': './src/config.tsx',
'./frontline': './src/modules/Main.tsx',
'./inboxSettings': './src/modules/inbox/Settings.tsx',
'./ticketSettings': './src/modules/ticket/Settings.tsx',
'./frontline': './src/modules/FrontlineMain.tsx',
'./frontlineSettings': './src/modules/FrontlineSettings.tsx',
'./automationsWidget':
'./src/widgets/automations/components/AutomationRemoteEntry.tsx',
'./notificationWidget':
Expand Down
42 changes: 15 additions & 27 deletions frontend/plugins/frontline_ui/src/config.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IconMail, IconStackFront, IconTicket } from '@tabler/icons-react';
import { IconStackFront } from '@tabler/icons-react';
import { IUIConfig } from 'erxes-ui';
import { lazy, Suspense } from 'react';

Expand All @@ -14,8 +14,21 @@ const FrontlineSubGroups = lazy(() =>
})),
);

const FrontlineSettingsNavigation = lazy(() =>
import('./modules/FrontlineSettingsNavigation').then((module) => ({
default: module.FrontlineSettingsNavigation,
})),
);

export const CONFIG: IUIConfig = {
name: 'frontline',
path: 'frontline',
hasFloatingWidget: true,
settingsNavigation: () => (
<Suspense fallback={<div />}>
<FrontlineSettingsNavigation />
</Suspense>
),
navigationGroup: {
name: 'frontline',
icon: IconStackFront,
Expand All @@ -24,35 +37,10 @@ export const CONFIG: IUIConfig = {
<FrontlineNavigation />
</Suspense>
),
subGroups: () => (
subGroup: () => (
<Suspense fallback={<div />}>
<FrontlineSubGroups />
</Suspense>
),
},
modules: [
{
name: 'inbox',
icon: IconMail,
path: 'inbox',
hasSettings: true,
hasRelationWidget: true,
hasFloatingWidget: true,
settingsOnly: true,
},
{
name: 'ticket',
icon: IconTicket,
path: 'ticket',
hasSettings: true,
hasRelationWidget: true,
settingsOnly: true,
},
{
name: 'frontline',
icon: IconMail,
path: 'frontline',
hasSettings: false,
},
],
};
Loading