From 2e649fc96eee85814315482a13f5615deab45fb7 Mon Sep 17 00:00:00 2001 From: rgrgogu Date: Mon, 3 Aug 2026 18:08:40 +0800 Subject: [PATCH] added more things --- .../notifications/AlertLayoutPreview.jsx | 42 ++++++++---- .../AddNotificationBroadcast.jsx | 65 +++++++++++-------- .../EditNotificationBroadcast.jsx | 65 +++++++++++-------- 3 files changed, 108 insertions(+), 64 deletions(-) diff --git a/src/modules/admin/components/notifications/AlertLayoutPreview.jsx b/src/modules/admin/components/notifications/AlertLayoutPreview.jsx index 1917548..34233ea 100644 --- a/src/modules/admin/components/notifications/AlertLayoutPreview.jsx +++ b/src/modules/admin/components/notifications/AlertLayoutPreview.jsx @@ -1,29 +1,47 @@ import { resolveAssetSrc } from "@/utils/media.util"; +import { Button } from "@/components/ui/button"; +import { XIcon } from "lucide-react"; -// Mirrors components/generic/AnnouncementDetailsDialog.jsx's real layout +// Mirrors components/generic/AnnouncementDetailsDialog.jsx's real markup/classes // (text left, optional image right, single column when no image) so what's // shown here while composing an alert is what recipients actually see when -// they open it from the sticky banner. +// they open it from the sticky banner. Plain divs, not an actual Dialog — +// this renders inline inside the admin wizard, not as an overlay. export default function AlertLayoutPreview({ title, message, imageAsset, linkLabel }) { const imageSrc = imageAsset ? resolveAssetSrc(imageAsset) : null; return ( -
+
+ +
-
-

{title || "Alert"}

-

- {message || "Your message will appear here."} -

+
+
+

{title || "Alert"}

+

+ {message || "Your message will appear here."} +

+
+ {linkLabel && ( - - {linkLabel} - +
+ +
)}
{imageSrc && ( -
+
)} diff --git a/src/modules/admin/pages/notifications/AddNotificationBroadcast.jsx b/src/modules/admin/pages/notifications/AddNotificationBroadcast.jsx index 6500879..75ea2e5 100644 --- a/src/modules/admin/pages/notifications/AddNotificationBroadcast.jsx +++ b/src/modules/admin/pages/notifications/AddNotificationBroadcast.jsx @@ -26,7 +26,7 @@ import { DateTimePicker } from "@/components/ui/date-time-picker"; import { TARGET_TYPE_OPTIONS, TARGET_TYPE_MAP } from "@/data/notificationBroadcast.data"; import { useUnsavedChangesGuard } from "@/hooks/useUnsavedChangesGuard"; -import { TIER_COLOR_OPTIONS, getTierColor, shadeColor, getContrastText } from "@/utils/tierColors"; +import { TIER_COLOR_OPTIONS, getTierColor, getContrastText } from "@/utils/tierColors"; import { normalizeExternalUrl } from "@/components/generic/notificationDisplay"; import { resolveAssetSrc } from "@/utils/media.util"; @@ -451,36 +451,26 @@ export default function AddNotificationBroadcast() { {showInSticky && (
-
+
{TIER_COLOR_OPTIONS.map((opt) => { const selected = (color || "indigo") === opt.key; - const bg = selected ? shadeColor(opt.swatch, -20) : opt.swatch; return ( + className={[ + "w-5 h-5 rounded-full border-2 transition-all", + selected + ? "border-foreground scale-110 shadow-sm" + : "border-transparent hover:border-muted-foreground/50", + ].join(" ")} + style={{ backgroundColor: opt.swatch }} + /> ); })}
-
- {watch("title") || "Sticky banner preview"} - {linkMode === "link" && ( - - )} -
)} @@ -547,12 +537,35 @@ export default function AddNotificationBroadcast() { {showInSticky && ( - +
+
+

Sticky banner (collapsed):

+
+ {watch("title") || "Sticky banner preview"} + {linkMode === "link" && ( + + )} +
+
+ +
+

When clicked (full content):

+ +
+
)} diff --git a/src/modules/admin/pages/notifications/EditNotificationBroadcast.jsx b/src/modules/admin/pages/notifications/EditNotificationBroadcast.jsx index dc9260a..4041a37 100644 --- a/src/modules/admin/pages/notifications/EditNotificationBroadcast.jsx +++ b/src/modules/admin/pages/notifications/EditNotificationBroadcast.jsx @@ -30,7 +30,7 @@ import { import { TARGET_TYPE_OPTIONS, TARGET_TYPE_MAP } from "@/data/notificationBroadcast.data"; import { useUnsavedChangesGuard } from "@/hooks/useUnsavedChangesGuard"; -import { TIER_COLOR_OPTIONS, getTierColor, shadeColor, getContrastText } from "@/utils/tierColors"; +import { TIER_COLOR_OPTIONS, getTierColor, getContrastText } from "@/utils/tierColors"; import { normalizeExternalUrl } from "@/components/generic/notificationDisplay"; import { resolveAssetSrc } from "@/utils/media.util"; @@ -493,36 +493,26 @@ export default function EditNotificationBroadcast() { {showInSticky && (
-
+
{TIER_COLOR_OPTIONS.map((opt) => { const selected = (color || "indigo") === opt.key; - const bg = selected ? shadeColor(opt.swatch, -20) : opt.swatch; return ( + className={[ + "w-5 h-5 rounded-full border-2 transition-all", + selected + ? "border-foreground scale-110 shadow-sm" + : "border-transparent hover:border-muted-foreground/50", + ].join(" ")} + style={{ backgroundColor: opt.swatch }} + /> ); })}
-
- {watch("title") || "Sticky banner preview"} - {linkMode === "link" && ( - - )} -
)} @@ -589,12 +579,35 @@ export default function EditNotificationBroadcast() { {showInSticky && ( - +
+
+

Sticky banner (collapsed):

+
+ {watch("title") || "Sticky banner preview"} + {linkMode === "link" && ( + + )} +
+
+ +
+

When clicked (full content):

+ +
+
)}