Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

refactor: move Notification type to a shared types file and update imports in Notifications component

naveenkash5a7325cbb814
diff --git a/apps/erp/app/components/Layout/Topbar/Notifications.tsx b/apps/erp/app/components/Layout/Topbar/Notifications.tsx
index 7266547a2d..1722e84a45 100644
--- a/apps/erp/app/components/Layout/Topbar/Notifications.tsx
+++ b/apps/erp/app/components/Layout/Topbar/Notifications.tsx
@@ -45,9 +45,9 @@ import {
} from "react-icons/ri";
import { Link, useFetcher } from "react-router";
import { useDateFormatter, useNotifications, useUser } from "~/hooks";
-import type { Notification as NotificationRecord } from "~/hooks/useNotifications";
import type { ApprovalDocumentType } from "~/modules/shared";
import { usePeople } from "~/stores";
+import type { Notification as NotificationRecord } from "~/types";
import { path } from "~/utils/path";
type OutstandingTraining = {
@@ -570,7 +570,7 @@ const Notifications = () => {
value={activeTab}
onValueChange={setActiveTab}
>
- <TabsList className="w-full border-b-[1px] py-6 rounded-none bg-muted/[0.5]">
+ <TabsList className="w-full border-b py-6 rounded-none bg-muted/50">
<TabsTrigger value="inbox" className="font-normal">
<Trans>Inbox</Trans>
</TabsTrigger>
@@ -649,7 +649,7 @@ const Notifications = () => {
)}
{unreadNotifications.length > 0 && (
- <div className="h-12 w-full absolute bottom-0 flex items-center justify-center border-t-[1px]">
+ <div className="h-12 w-full absolute bottom-0 flex items-center justify-center border-t">
<Button
variant="secondary"
className="bg-transparent"
diff --git a/apps/erp/app/hooks/useNotifications.tsx b/apps/erp/app/hooks/useNotifications.tsx
index a3f6dd9333..db5a7c8ed0 100644
--- a/apps/erp/app/hooks/useNotifications.tsx
+++ b/apps/erp/app/hooks/useNotifications.tsx
@@ -1,22 +1,6 @@
import { useCarbon, useRealtimeChannel } from "@carbon/react";
import { useCallback, useEffect, useMemo, useState } from "react";
-
-// Topbar shape — matches the surface the old Novu IMessage exposed so
-// consumers don't change. `payload` mirrors what notify.ts writes into the
-// notification row's payload jsonb column.
-export type Notification = {
- _id: string;
- read: boolean;
- seen: boolean;
- createdAt: string;
- payload: {
- recordId?: string;
- description?: string;
- event?: string;
- from?: string;
- documentType?: string;
- };
-};
+import type { Notification } from "~/types";
type NotificationRow = {
id: string;
diff --git a/apps/erp/app/types/index.ts b/apps/erp/app/types/index.ts
index 23726ce6f8..872f871b9e 100644
--- a/apps/erp/app/types/index.ts
+++ b/apps/erp/app/types/index.ts
@@ -29,6 +29,23 @@ export type ListItem = {
name: string;
};
+// Topbar shape — matches the surface the old Novu IMessage exposed so
+// consumers don't change. `payload` mirrors what notify.ts writes into the
+// notification row's payload jsonb column.
+export type Notification = {
+ _id: string;
+ read: boolean;
+ seen: boolean;
+ createdAt: string;
+ payload: {
+ recordId?: string;
+ description?: string;
+ event?: string;
+ from?: string;
+ documentType?: string;
+ };
+};
+
export type ModelUpload = {
modelId: string | null;
modelName: string | null;
diff --git a/packages/ee/src/plan.ts b/packages/ee/src/plan.ts
index 3d4c65e12a..6326c63923 100644
--- a/packages/ee/src/plan.ts
+++ b/packages/ee/src/plan.ts
@@ -6,12 +6,11 @@ import type { IntegrationID } from "./index";
* (`usePlanGate`) and server (`plan.server.ts`) read from here.
*/
export const FEATURE_PLANS = {
- API_KEYS: [Plan.Starter, Plan.Business],
- AUDIT_LOG: [Plan.Business],
- EMAIL_NOTIFICATIONS: [Plan.Business],
- INTEGRATIONS: [Plan.Starter, Plan.Business],
+ API_KEYS: [Plan.Business, Plan.Partner],
+ WEBHOOKS: [Plan.Business, Plan.Partner],
+ INTEGRATIONS: [Plan.Business, Plan.Partner],
ITEM_RULES: [Plan.Business],
- WEBHOOKS: [Plan.Starter, Plan.Business]
+ AUDIT_LOG: [Plan.Business]
} as const satisfies Record<string, Plan[]>;
export type Feature = keyof typeof FEATURE_PLANS;