@propknot/shared-ui 1.0.24 → 1.0.26
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.
- package/dist/index.js +402 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +454 -140
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +21 -5
- package/src/styles/globals.css +59 -0
package/dist/index.js
CHANGED
|
@@ -204,10 +204,30 @@ var index_exports = {};
|
|
|
204
204
|
__export(index_exports, {
|
|
205
205
|
AuthLayout: () => AuthLayout_default,
|
|
206
206
|
AuthProvider: () => AuthProvider,
|
|
207
|
+
Blockquote: () => Blockquote,
|
|
208
|
+
Button: () => Button2,
|
|
209
|
+
Card: () => Card2,
|
|
210
|
+
CardContent: () => CardContent2,
|
|
211
|
+
CardDescription: () => CardDescription,
|
|
212
|
+
CardFooter: () => CardFooter,
|
|
213
|
+
CardHeader: () => CardHeader,
|
|
214
|
+
CardTitle: () => CardTitle,
|
|
207
215
|
CustomThemeProvider: () => CustomThemeProvider,
|
|
208
216
|
ErrorBoundary: () => ErrorBoundary_default,
|
|
217
|
+
H1: () => H1,
|
|
218
|
+
H2: () => H2,
|
|
219
|
+
H3: () => H3,
|
|
220
|
+
H4: () => H4,
|
|
221
|
+
Heading: () => Heading,
|
|
222
|
+
InlineCode: () => InlineCode,
|
|
223
|
+
Input: () => Input,
|
|
224
|
+
Label: () => Label,
|
|
225
|
+
Large: () => Large,
|
|
226
|
+
Lead: () => Lead,
|
|
227
|
+
List: () => List2,
|
|
209
228
|
LoadingSpinner: () => LoadingSpinner_default,
|
|
210
229
|
ModernCard: () => ModernCard_default,
|
|
230
|
+
Muted: () => Muted,
|
|
211
231
|
NOTIFICATION_CHANNELS: () => NOTIFICATION_CHANNELS,
|
|
212
232
|
NOTIFICATION_TYPES: () => NOTIFICATION_TYPES,
|
|
213
233
|
Navbar: () => Navbar_default,
|
|
@@ -215,13 +235,17 @@ __export(index_exports, {
|
|
|
215
235
|
NotificationManager: () => NotificationManager_default,
|
|
216
236
|
NotificationPatterns: () => NotificationPatterns,
|
|
217
237
|
NotificationProvider: () => NotificationProvider,
|
|
238
|
+
P: () => P,
|
|
218
239
|
PageHeader: () => PageHeader_default,
|
|
219
240
|
PageLayout: () => PageLayout_default,
|
|
241
|
+
Small: () => Small,
|
|
220
242
|
SocketProvider: () => SocketProvider,
|
|
221
243
|
TenantLayout: () => TenantLayout_default,
|
|
222
244
|
TenantThemeProvider: () => TenantThemeProvider,
|
|
223
245
|
api: () => api,
|
|
224
246
|
auditNotifications: () => auditNotifications,
|
|
247
|
+
buttonVariants: () => buttonVariants,
|
|
248
|
+
cn: () => cn,
|
|
225
249
|
createContrastEnhancedComponents: () => createContrastEnhancedComponents,
|
|
226
250
|
createNotificationAwareAPI: () => createNotificationAwareAPI,
|
|
227
251
|
darkenColor: () => darkenColor,
|
|
@@ -277,6 +301,13 @@ __export(index_exports, {
|
|
|
277
301
|
});
|
|
278
302
|
module.exports = __toCommonJS(index_exports);
|
|
279
303
|
|
|
304
|
+
// src/lib/utils.js
|
|
305
|
+
var import_clsx = require("clsx");
|
|
306
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
307
|
+
function cn(...inputs) {
|
|
308
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
309
|
+
}
|
|
310
|
+
|
|
280
311
|
// src/components/Navigation/Navbar.js
|
|
281
312
|
var import_react4 = __toESM(require("react"));
|
|
282
313
|
var import_material = require("@mui/material");
|
|
@@ -3231,6 +3262,281 @@ var ModernCardContent = ({ children, sx = {}, ...props }) => {
|
|
|
3231
3262
|
ModernCard.Content = ModernCardContent;
|
|
3232
3263
|
var ModernCard_default = ModernCard;
|
|
3233
3264
|
|
|
3265
|
+
// src/components/UI/button.jsx
|
|
3266
|
+
var React13 = __toESM(require("react"));
|
|
3267
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
3268
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
3269
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
3270
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
3271
|
+
{
|
|
3272
|
+
variants: {
|
|
3273
|
+
variant: {
|
|
3274
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
3275
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
3276
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
3277
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
3278
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
3279
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
3280
|
+
},
|
|
3281
|
+
size: {
|
|
3282
|
+
default: "h-10 px-4 py-2",
|
|
3283
|
+
sm: "h-9 rounded-md px-3",
|
|
3284
|
+
lg: "h-11 rounded-md px-8",
|
|
3285
|
+
icon: "h-10 w-10"
|
|
3286
|
+
}
|
|
3287
|
+
},
|
|
3288
|
+
defaultVariants: {
|
|
3289
|
+
variant: "default",
|
|
3290
|
+
size: "default"
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
);
|
|
3294
|
+
var Button2 = React13.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
3295
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
3296
|
+
return /* @__PURE__ */ React13.createElement(
|
|
3297
|
+
Comp,
|
|
3298
|
+
{
|
|
3299
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
3300
|
+
ref,
|
|
3301
|
+
...props
|
|
3302
|
+
}
|
|
3303
|
+
);
|
|
3304
|
+
});
|
|
3305
|
+
Button2.displayName = "Button";
|
|
3306
|
+
|
|
3307
|
+
// src/components/UI/card.jsx
|
|
3308
|
+
var React14 = __toESM(require("react"));
|
|
3309
|
+
var Card2 = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React14.createElement(
|
|
3310
|
+
"div",
|
|
3311
|
+
{
|
|
3312
|
+
ref,
|
|
3313
|
+
className: cn(
|
|
3314
|
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
3315
|
+
className
|
|
3316
|
+
),
|
|
3317
|
+
...props
|
|
3318
|
+
}
|
|
3319
|
+
));
|
|
3320
|
+
Card2.displayName = "Card";
|
|
3321
|
+
var CardHeader = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React14.createElement(
|
|
3322
|
+
"div",
|
|
3323
|
+
{
|
|
3324
|
+
ref,
|
|
3325
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
3326
|
+
...props
|
|
3327
|
+
}
|
|
3328
|
+
));
|
|
3329
|
+
CardHeader.displayName = "CardHeader";
|
|
3330
|
+
var CardTitle = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React14.createElement(
|
|
3331
|
+
"h3",
|
|
3332
|
+
{
|
|
3333
|
+
ref,
|
|
3334
|
+
className: cn(
|
|
3335
|
+
"text-2xl font-semibold leading-none tracking-tight",
|
|
3336
|
+
className
|
|
3337
|
+
),
|
|
3338
|
+
...props
|
|
3339
|
+
}
|
|
3340
|
+
));
|
|
3341
|
+
CardTitle.displayName = "CardTitle";
|
|
3342
|
+
var CardDescription = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React14.createElement(
|
|
3343
|
+
"p",
|
|
3344
|
+
{
|
|
3345
|
+
ref,
|
|
3346
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
3347
|
+
...props
|
|
3348
|
+
}
|
|
3349
|
+
));
|
|
3350
|
+
CardDescription.displayName = "CardDescription";
|
|
3351
|
+
var CardContent2 = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React14.createElement("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
3352
|
+
CardContent2.displayName = "CardContent";
|
|
3353
|
+
var CardFooter = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React14.createElement(
|
|
3354
|
+
"div",
|
|
3355
|
+
{
|
|
3356
|
+
ref,
|
|
3357
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
3358
|
+
...props
|
|
3359
|
+
}
|
|
3360
|
+
));
|
|
3361
|
+
CardFooter.displayName = "CardFooter";
|
|
3362
|
+
|
|
3363
|
+
// src/components/UI/input.jsx
|
|
3364
|
+
var React15 = __toESM(require("react"));
|
|
3365
|
+
var Input = React15.forwardRef(({ className, type, ...props }, ref) => {
|
|
3366
|
+
return /* @__PURE__ */ React15.createElement(
|
|
3367
|
+
"input",
|
|
3368
|
+
{
|
|
3369
|
+
type,
|
|
3370
|
+
className: cn(
|
|
3371
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
3372
|
+
className
|
|
3373
|
+
),
|
|
3374
|
+
ref,
|
|
3375
|
+
...props
|
|
3376
|
+
}
|
|
3377
|
+
);
|
|
3378
|
+
});
|
|
3379
|
+
Input.displayName = "Input";
|
|
3380
|
+
|
|
3381
|
+
// src/components/UI/label.jsx
|
|
3382
|
+
var React16 = __toESM(require("react"));
|
|
3383
|
+
var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
|
|
3384
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
3385
|
+
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
3386
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
3387
|
+
);
|
|
3388
|
+
var Label = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React16.createElement(
|
|
3389
|
+
LabelPrimitive.Root,
|
|
3390
|
+
{
|
|
3391
|
+
ref,
|
|
3392
|
+
className: cn(labelVariants(), className),
|
|
3393
|
+
...props
|
|
3394
|
+
}
|
|
3395
|
+
));
|
|
3396
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
3397
|
+
|
|
3398
|
+
// src/components/UI/typography.jsx
|
|
3399
|
+
var React17 = __toESM(require("react"));
|
|
3400
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
3401
|
+
var headingVariants = (0, import_class_variance_authority3.cva)("scroll-m-20 tracking-tight", {
|
|
3402
|
+
variants: {
|
|
3403
|
+
level: {
|
|
3404
|
+
h1: "text-4xl font-extrabold lg:text-5xl",
|
|
3405
|
+
h2: "text-3xl font-semibold",
|
|
3406
|
+
h3: "text-2xl font-semibold",
|
|
3407
|
+
h4: "text-xl font-semibold",
|
|
3408
|
+
h5: "text-lg font-semibold",
|
|
3409
|
+
h6: "text-base font-semibold"
|
|
3410
|
+
}
|
|
3411
|
+
},
|
|
3412
|
+
defaultVariants: {
|
|
3413
|
+
level: "h2"
|
|
3414
|
+
}
|
|
3415
|
+
});
|
|
3416
|
+
var Heading = React17.forwardRef(({ className, level = "h2", ...props }, ref) => {
|
|
3417
|
+
const Comp = level;
|
|
3418
|
+
return /* @__PURE__ */ React17.createElement(
|
|
3419
|
+
Comp,
|
|
3420
|
+
{
|
|
3421
|
+
ref,
|
|
3422
|
+
className: cn(headingVariants({ level, className })),
|
|
3423
|
+
...props
|
|
3424
|
+
}
|
|
3425
|
+
);
|
|
3426
|
+
});
|
|
3427
|
+
Heading.displayName = "Heading";
|
|
3428
|
+
var H1 = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3429
|
+
"h1",
|
|
3430
|
+
{
|
|
3431
|
+
ref,
|
|
3432
|
+
className: cn("scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl", className),
|
|
3433
|
+
...props
|
|
3434
|
+
}
|
|
3435
|
+
));
|
|
3436
|
+
H1.displayName = "H1";
|
|
3437
|
+
var H2 = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3438
|
+
"h2",
|
|
3439
|
+
{
|
|
3440
|
+
ref,
|
|
3441
|
+
className: cn("scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0", className),
|
|
3442
|
+
...props
|
|
3443
|
+
}
|
|
3444
|
+
));
|
|
3445
|
+
H2.displayName = "H2";
|
|
3446
|
+
var H3 = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3447
|
+
"h3",
|
|
3448
|
+
{
|
|
3449
|
+
ref,
|
|
3450
|
+
className: cn("scroll-m-20 text-2xl font-semibold tracking-tight", className),
|
|
3451
|
+
...props
|
|
3452
|
+
}
|
|
3453
|
+
));
|
|
3454
|
+
H3.displayName = "H3";
|
|
3455
|
+
var H4 = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3456
|
+
"h4",
|
|
3457
|
+
{
|
|
3458
|
+
ref,
|
|
3459
|
+
className: cn("scroll-m-20 text-xl font-semibold tracking-tight", className),
|
|
3460
|
+
...props
|
|
3461
|
+
}
|
|
3462
|
+
));
|
|
3463
|
+
H4.displayName = "H4";
|
|
3464
|
+
var P = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3465
|
+
"p",
|
|
3466
|
+
{
|
|
3467
|
+
ref,
|
|
3468
|
+
className: cn("leading-7 [&:not(:first-child)]:mt-6", className),
|
|
3469
|
+
...props
|
|
3470
|
+
}
|
|
3471
|
+
));
|
|
3472
|
+
P.displayName = "P";
|
|
3473
|
+
var Blockquote = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3474
|
+
"blockquote",
|
|
3475
|
+
{
|
|
3476
|
+
ref,
|
|
3477
|
+
className: cn("mt-6 border-l-2 pl-6 italic", className),
|
|
3478
|
+
...props
|
|
3479
|
+
}
|
|
3480
|
+
));
|
|
3481
|
+
Blockquote.displayName = "Blockquote";
|
|
3482
|
+
var List2 = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3483
|
+
"ul",
|
|
3484
|
+
{
|
|
3485
|
+
ref,
|
|
3486
|
+
className: cn("my-6 ml-6 list-disc [&>li]:mt-2", className),
|
|
3487
|
+
...props
|
|
3488
|
+
}
|
|
3489
|
+
));
|
|
3490
|
+
List2.displayName = "List";
|
|
3491
|
+
var InlineCode = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3492
|
+
"code",
|
|
3493
|
+
{
|
|
3494
|
+
ref,
|
|
3495
|
+
className: cn(
|
|
3496
|
+
"relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",
|
|
3497
|
+
className
|
|
3498
|
+
),
|
|
3499
|
+
...props
|
|
3500
|
+
}
|
|
3501
|
+
));
|
|
3502
|
+
InlineCode.displayName = "InlineCode";
|
|
3503
|
+
var Lead = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3504
|
+
"p",
|
|
3505
|
+
{
|
|
3506
|
+
ref,
|
|
3507
|
+
className: cn("text-xl text-muted-foreground", className),
|
|
3508
|
+
...props
|
|
3509
|
+
}
|
|
3510
|
+
));
|
|
3511
|
+
Lead.displayName = "Lead";
|
|
3512
|
+
var Large = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3513
|
+
"div",
|
|
3514
|
+
{
|
|
3515
|
+
ref,
|
|
3516
|
+
className: cn("text-lg font-semibold", className),
|
|
3517
|
+
...props
|
|
3518
|
+
}
|
|
3519
|
+
));
|
|
3520
|
+
Large.displayName = "Large";
|
|
3521
|
+
var Small = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3522
|
+
"small",
|
|
3523
|
+
{
|
|
3524
|
+
ref,
|
|
3525
|
+
className: cn("text-sm font-medium leading-none", className),
|
|
3526
|
+
...props
|
|
3527
|
+
}
|
|
3528
|
+
));
|
|
3529
|
+
Small.displayName = "Small";
|
|
3530
|
+
var Muted = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React17.createElement(
|
|
3531
|
+
"p",
|
|
3532
|
+
{
|
|
3533
|
+
ref,
|
|
3534
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
3535
|
+
...props
|
|
3536
|
+
}
|
|
3537
|
+
));
|
|
3538
|
+
Muted.displayName = "Muted";
|
|
3539
|
+
|
|
3234
3540
|
// src/components/Notifications/NotificationManager.js
|
|
3235
3541
|
var import_react12 = __toESM(require("react"));
|
|
3236
3542
|
var import_material8 = require("@mui/material");
|
|
@@ -3464,7 +3770,7 @@ var NotificationBell = ({ api: api2, useSocket: useSocket2, useAuth: useAuth2 })
|
|
|
3464
3770
|
};
|
|
3465
3771
|
const handleNotificationRead = (notificationId) => {
|
|
3466
3772
|
setNotifications(
|
|
3467
|
-
(prev) => prev.map((n) => n._id === notificationId ? { ...n, read: true } : n)
|
|
3773
|
+
(prev) => prev.map((n) => (n.id || n._id) === notificationId ? { ...n, is_read: true, read: true } : n)
|
|
3468
3774
|
);
|
|
3469
3775
|
setUnreadCount((prev) => Math.max(0, prev - 1));
|
|
3470
3776
|
};
|
|
@@ -3489,7 +3795,7 @@ var NotificationBell = ({ api: api2, useSocket: useSocket2, useAuth: useAuth2 })
|
|
|
3489
3795
|
try {
|
|
3490
3796
|
await api2.put(`/notifications/${notificationId}/read`);
|
|
3491
3797
|
setNotifications(
|
|
3492
|
-
(prev) => prev.map((n) => n._id === notificationId ? { ...n, read: true, readAt: /* @__PURE__ */ new Date() } : n)
|
|
3798
|
+
(prev) => prev.map((n) => (n.id || n._id) === notificationId ? { ...n, is_read: true, read: true, read_at: /* @__PURE__ */ new Date(), readAt: /* @__PURE__ */ new Date() } : n)
|
|
3493
3799
|
);
|
|
3494
3800
|
setUnreadCount((prev) => Math.max(0, prev - 1));
|
|
3495
3801
|
} catch (err) {
|
|
@@ -3501,7 +3807,7 @@ var NotificationBell = ({ api: api2, useSocket: useSocket2, useAuth: useAuth2 })
|
|
|
3501
3807
|
try {
|
|
3502
3808
|
await api2.put("/notifications/mark-all-read");
|
|
3503
3809
|
setNotifications(
|
|
3504
|
-
(prev) => prev.map((n) => ({ ...n, read: true, readAt: /* @__PURE__ */ new Date() }))
|
|
3810
|
+
(prev) => prev.map((n) => ({ ...n, is_read: true, read: true, read_at: /* @__PURE__ */ new Date(), readAt: /* @__PURE__ */ new Date() }))
|
|
3505
3811
|
);
|
|
3506
3812
|
setUnreadCount(0);
|
|
3507
3813
|
} catch (err) {
|
|
@@ -3509,11 +3815,14 @@ var NotificationBell = ({ api: api2, useSocket: useSocket2, useAuth: useAuth2 })
|
|
|
3509
3815
|
}
|
|
3510
3816
|
};
|
|
3511
3817
|
const handleNotificationClick = async (notification) => {
|
|
3512
|
-
|
|
3513
|
-
|
|
3818
|
+
const isRead = notification.is_read || notification.read;
|
|
3819
|
+
const notifId = notification.id || notification._id;
|
|
3820
|
+
if (!isRead) {
|
|
3821
|
+
await handleMarkAsRead(notifId);
|
|
3514
3822
|
}
|
|
3515
|
-
|
|
3516
|
-
|
|
3823
|
+
const actionUrl = notification.action_url || notification.actionUrl;
|
|
3824
|
+
if (actionUrl) {
|
|
3825
|
+
window.location.href = actionUrl;
|
|
3517
3826
|
}
|
|
3518
3827
|
handleClose();
|
|
3519
3828
|
};
|
|
@@ -3676,66 +3985,71 @@ var NotificationBell = ({ api: api2, useSocket: useSocket2, useAuth: useAuth2 })
|
|
|
3676
3985
|
/* @__PURE__ */ import_react13.default.createElement(import_icons_material3.NotificationsNone, { sx: { fontSize: 64, color: "text.secondary", mb: 2 } }),
|
|
3677
3986
|
/* @__PURE__ */ import_react13.default.createElement(import_material9.Typography, { variant: "body1", color: "text.secondary", sx: { fontWeight: 500 } }, "No notifications yet"),
|
|
3678
3987
|
/* @__PURE__ */ import_react13.default.createElement(import_material9.Typography, { variant: "body2", color: "text.secondary" }, "You're all caught up!")
|
|
3679
|
-
) : /* @__PURE__ */ import_react13.default.createElement(import_material9.List, { sx: { p: 0 } }, notifications.map((notification, index) =>
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
py: 1.5,
|
|
3686
|
-
px: 2,
|
|
3687
|
-
bgcolor: notification.read ? "transparent" : "action.hover",
|
|
3688
|
-
"&:hover": {
|
|
3689
|
-
bgcolor: notification.read ? "action.hover" : "action.selected"
|
|
3690
|
-
},
|
|
3691
|
-
borderLeft: notification.read ? "none" : "3px solid",
|
|
3692
|
-
borderLeftColor: getNotificationColor(notification.type),
|
|
3693
|
-
transition: "all 0.2s"
|
|
3694
|
-
}
|
|
3695
|
-
},
|
|
3696
|
-
/* @__PURE__ */ import_react13.default.createElement(import_material9.ListItemAvatar, null, /* @__PURE__ */ import_react13.default.createElement(
|
|
3697
|
-
import_material9.Avatar,
|
|
3988
|
+
) : /* @__PURE__ */ import_react13.default.createElement(import_material9.List, { sx: { p: 0 } }, notifications.map((notification, index) => {
|
|
3989
|
+
const isRead = notification.is_read || notification.read;
|
|
3990
|
+
const notifId = notification.id || notification._id;
|
|
3991
|
+
const createdAt = notification.created_at || notification.createdAt;
|
|
3992
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: notifId }, /* @__PURE__ */ import_react13.default.createElement(
|
|
3993
|
+
import_material9.ListItem,
|
|
3698
3994
|
{
|
|
3995
|
+
button: true,
|
|
3996
|
+
onClick: () => handleNotificationClick(notification),
|
|
3699
3997
|
sx: {
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3998
|
+
py: 1.5,
|
|
3999
|
+
px: 2,
|
|
4000
|
+
bgcolor: isRead ? "transparent" : "action.hover",
|
|
4001
|
+
"&:hover": {
|
|
4002
|
+
bgcolor: isRead ? "action.hover" : "action.selected"
|
|
4003
|
+
},
|
|
4004
|
+
borderLeft: isRead ? "none" : "3px solid",
|
|
4005
|
+
borderLeftColor: getNotificationColor(notification.type),
|
|
4006
|
+
transition: "all 0.2s"
|
|
3703
4007
|
}
|
|
3704
4008
|
},
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
4009
|
+
/* @__PURE__ */ import_react13.default.createElement(import_material9.ListItemAvatar, null, /* @__PURE__ */ import_react13.default.createElement(
|
|
4010
|
+
import_material9.Avatar,
|
|
4011
|
+
{
|
|
4012
|
+
sx: {
|
|
4013
|
+
bgcolor: isRead ? "grey.300" : getNotificationColor(notification.type),
|
|
4014
|
+
width: 40,
|
|
4015
|
+
height: 40
|
|
4016
|
+
}
|
|
4017
|
+
},
|
|
4018
|
+
getNotificationIcon(notification.type)
|
|
4019
|
+
)),
|
|
4020
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
4021
|
+
import_material9.ListItemText,
|
|
4022
|
+
{
|
|
4023
|
+
primary: /* @__PURE__ */ import_react13.default.createElement(import_material9.Box, { sx: { display: "flex", alignItems: "center", mb: 0.5 } }, /* @__PURE__ */ import_react13.default.createElement(
|
|
4024
|
+
import_material9.Typography,
|
|
4025
|
+
{
|
|
4026
|
+
variant: "body2",
|
|
4027
|
+
sx: {
|
|
4028
|
+
fontWeight: isRead ? 400 : 600,
|
|
4029
|
+
flex: 1
|
|
4030
|
+
}
|
|
4031
|
+
},
|
|
4032
|
+
notification.title
|
|
4033
|
+
), getPriorityChip(notification.priority)),
|
|
4034
|
+
secondary: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
|
|
4035
|
+
import_material9.Typography,
|
|
4036
|
+
{
|
|
4037
|
+
variant: "body2",
|
|
4038
|
+
color: "text.secondary",
|
|
4039
|
+
sx: {
|
|
4040
|
+
display: "-webkit-box",
|
|
4041
|
+
WebkitLineClamp: 2,
|
|
4042
|
+
WebkitBoxOrient: "vertical",
|
|
4043
|
+
overflow: "hidden",
|
|
4044
|
+
mb: 0.5
|
|
4045
|
+
}
|
|
4046
|
+
},
|
|
4047
|
+
notification.message
|
|
4048
|
+
), /* @__PURE__ */ import_react13.default.createElement(import_material9.Typography, { variant: "caption", color: "text.secondary" }, (0, import_date_fns2.formatDistanceToNow)(new Date(createdAt), { addSuffix: true })))
|
|
4049
|
+
}
|
|
4050
|
+
)
|
|
4051
|
+
), index < notifications.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_material9.Divider, null));
|
|
4052
|
+
})),
|
|
3739
4053
|
hasMore && notifications.length > 0 && /* @__PURE__ */ import_react13.default.createElement(import_material9.Box, { sx: { p: 2, textAlign: "center", borderTop: "1px solid", borderColor: "divider" } }, /* @__PURE__ */ import_react13.default.createElement(
|
|
3740
4054
|
import_material9.Button,
|
|
3741
4055
|
{
|
|
@@ -3889,7 +4203,7 @@ var SocketProvider = ({ children }) => {
|
|
|
3889
4203
|
if (user || tenantToken) {
|
|
3890
4204
|
const userType = user ? "property_manager" : "tenant";
|
|
3891
4205
|
const authToken = user ? localStorage.getItem("token") : tenantToken;
|
|
3892
|
-
const socketUrl = process.env.REACT_APP_API_URL ? process.env.REACT_APP_API_URL.replace("/api", "") :
|
|
4206
|
+
const socketUrl = process.env.REACT_APP_API_URL ? process.env.REACT_APP_API_URL.replace("/api", "") : `${window.location.protocol}//${window.location.hostname}:5000`;
|
|
3893
4207
|
const newSocket = (0, import_socket.io)(socketUrl, {
|
|
3894
4208
|
auth: {
|
|
3895
4209
|
token: authToken,
|
|
@@ -5383,10 +5697,30 @@ var isTenantAuthenticated = () => {
|
|
|
5383
5697
|
0 && (module.exports = {
|
|
5384
5698
|
AuthLayout,
|
|
5385
5699
|
AuthProvider,
|
|
5700
|
+
Blockquote,
|
|
5701
|
+
Button,
|
|
5702
|
+
Card,
|
|
5703
|
+
CardContent,
|
|
5704
|
+
CardDescription,
|
|
5705
|
+
CardFooter,
|
|
5706
|
+
CardHeader,
|
|
5707
|
+
CardTitle,
|
|
5386
5708
|
CustomThemeProvider,
|
|
5387
5709
|
ErrorBoundary,
|
|
5710
|
+
H1,
|
|
5711
|
+
H2,
|
|
5712
|
+
H3,
|
|
5713
|
+
H4,
|
|
5714
|
+
Heading,
|
|
5715
|
+
InlineCode,
|
|
5716
|
+
Input,
|
|
5717
|
+
Label,
|
|
5718
|
+
Large,
|
|
5719
|
+
Lead,
|
|
5720
|
+
List,
|
|
5388
5721
|
LoadingSpinner,
|
|
5389
5722
|
ModernCard,
|
|
5723
|
+
Muted,
|
|
5390
5724
|
NOTIFICATION_CHANNELS,
|
|
5391
5725
|
NOTIFICATION_TYPES,
|
|
5392
5726
|
Navbar,
|
|
@@ -5394,13 +5728,17 @@ var isTenantAuthenticated = () => {
|
|
|
5394
5728
|
NotificationManager,
|
|
5395
5729
|
NotificationPatterns,
|
|
5396
5730
|
NotificationProvider,
|
|
5731
|
+
P,
|
|
5397
5732
|
PageHeader,
|
|
5398
5733
|
PageLayout,
|
|
5734
|
+
Small,
|
|
5399
5735
|
SocketProvider,
|
|
5400
5736
|
TenantLayout,
|
|
5401
5737
|
TenantThemeProvider,
|
|
5402
5738
|
api,
|
|
5403
5739
|
auditNotifications,
|
|
5740
|
+
buttonVariants,
|
|
5741
|
+
cn,
|
|
5404
5742
|
createContrastEnhancedComponents,
|
|
5405
5743
|
createNotificationAwareAPI,
|
|
5406
5744
|
darkenColor,
|