@asaleh37/ui-base 1.2.18 → 1.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,9 @@ import SystemApplicationAuthorityGrid from "../../components/administration/admi
19
19
  import SystemApplicationRoleGrid from "../../components/administration/admin/SystemApplicationRoleGrid";
20
20
  import SystemApplicationModuleGrid from "../../components/administration/admin/SystemApplicationModuleGrid";
21
21
  import AttachmentConfigGrid from "../../components/administration/dev/AttachmentConfigGrid";
22
+ import NotificationGrid from "../../components/administration/dev/NotificationGrid";
23
+ import MyNotificationsPanel from "../../components/common/MyNotificationsPanel";
24
+ import WorkflowRouteComponent from "../../components/templates/workflow/WorkflowRouteComponent";
22
25
 
23
26
  export const devRoutes: Array<SystemRoute> = [
24
27
  {
@@ -108,6 +111,18 @@ export const devRoutes: Array<SystemRoute> = [
108
111
  path: "dev/attachmentconfigs",
109
112
  component: AttachmentConfigGrid,
110
113
  },
114
+ {
115
+ path: "dev/notifications",
116
+ component: NotificationGrid,
117
+ },
118
+ {
119
+ path: "myNotifications",
120
+ component: MyNotificationsPanel,
121
+ },
122
+ {
123
+ path: "workflow/:workflowDocumentCode/:refDocumentId",
124
+ component: WorkflowRouteComponent,
125
+ },
111
126
  ];
112
127
 
113
128
  // import { devRoutes } from "./devRoutes";
@@ -21,3 +21,33 @@ export function isValidEmail(email) {
21
21
  const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
22
22
  return re.test(email);
23
23
  }
24
+
25
+ export function timeAgo(dateInput, appDirection: "ltr" | "rtl") {
26
+ const date = new Date(dateInput);
27
+ const now = new Date();
28
+ const diffInSeconds = Math.floor((date - now) / 1000); // Note: future is positive
29
+ const absDiff = Math.abs(diffInSeconds);
30
+
31
+ const locale = appDirection === "rtl" ? "ar" : "en";
32
+
33
+ const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
34
+
35
+ const units = [
36
+ { unit: "year", seconds: 31536000 },
37
+ { unit: "month", seconds: 2592000 },
38
+ { unit: "week", seconds: 604800 },
39
+ { unit: "day", seconds: 86400 },
40
+ { unit: "hour", seconds: 3600 },
41
+ { unit: "minute", seconds: 60 },
42
+ { unit: "second", seconds: 1 },
43
+ ];
44
+
45
+ for (const { unit, seconds } of units) {
46
+ const delta = Math.floor(diffInSeconds / seconds);
47
+ if (Math.abs(delta) > 1) {
48
+ return rtf.format(delta, unit);
49
+ }
50
+ }
51
+
52
+ return locale === "ar" ? "الآن" : "just now";
53
+ }