@janovix/blocks 1.2.0-rc.10 → 1.2.0-rc.12
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.cjs +32 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4842,19 +4842,19 @@ var sizeConfig = {
|
|
|
4842
4842
|
button: "h-8 w-8",
|
|
4843
4843
|
icon: "w-4 h-4",
|
|
4844
4844
|
badge: "min-w-[16px] h-4 text-[10px] -top-1 -right-1",
|
|
4845
|
-
dot: "w-2.5 h-2.5
|
|
4845
|
+
dot: "w-2.5 h-2.5 top-0 right-0"
|
|
4846
4846
|
},
|
|
4847
4847
|
md: {
|
|
4848
4848
|
button: "h-9 w-9",
|
|
4849
4849
|
icon: "w-5 h-5",
|
|
4850
4850
|
badge: "min-w-[18px] h-[18px] text-[11px] -top-1 -right-1",
|
|
4851
|
-
dot: "w-3 h-3
|
|
4851
|
+
dot: "w-3 h-3 top-0 right-0"
|
|
4852
4852
|
},
|
|
4853
4853
|
lg: {
|
|
4854
4854
|
button: "h-10 w-10",
|
|
4855
4855
|
icon: "w-6 h-6",
|
|
4856
4856
|
badge: "min-w-[20px] h-5 text-xs -top-1.5 -right-1.5",
|
|
4857
|
-
dot: "w-3.5 h-3.5
|
|
4857
|
+
dot: "w-3.5 h-3.5 top-0 right-0"
|
|
4858
4858
|
}
|
|
4859
4859
|
};
|
|
4860
4860
|
var typeConfig = {
|
|
@@ -5026,6 +5026,24 @@ function NotificationsWidget({
|
|
|
5026
5026
|
getIsReadRef.current = getIsRead;
|
|
5027
5027
|
}, [getIsRead]);
|
|
5028
5028
|
const unreadCount = notifications.filter((n) => !getIsRead(n)).length;
|
|
5029
|
+
React2__namespace.useEffect(() => {
|
|
5030
|
+
setOptimisticReadIds((prev) => {
|
|
5031
|
+
const next = new Set(prev);
|
|
5032
|
+
let changed = false;
|
|
5033
|
+
prev.forEach((id) => {
|
|
5034
|
+
const notification = notifications.find((n) => n.id === id);
|
|
5035
|
+
if (notification?.read === true) {
|
|
5036
|
+
next.delete(id);
|
|
5037
|
+
changed = true;
|
|
5038
|
+
console.log(
|
|
5039
|
+
"[NotificationsWidget] Clearing optimistic state for server-confirmed read:",
|
|
5040
|
+
id
|
|
5041
|
+
);
|
|
5042
|
+
}
|
|
5043
|
+
});
|
|
5044
|
+
return changed ? next : prev;
|
|
5045
|
+
});
|
|
5046
|
+
}, [notifications]);
|
|
5029
5047
|
React2__namespace.useEffect(() => {
|
|
5030
5048
|
console.log(
|
|
5031
5049
|
"[NotificationsWidget] Notifications received:",
|
|
@@ -5086,14 +5104,9 @@ function NotificationsWidget({
|
|
|
5086
5104
|
try {
|
|
5087
5105
|
await Promise.resolve(onMarkAsRead(notificationId));
|
|
5088
5106
|
console.log(
|
|
5089
|
-
"[NotificationsWidget] Successfully marked as read:",
|
|
5107
|
+
"[NotificationsWidget] Successfully marked as read (keeping optimistic state):",
|
|
5090
5108
|
notificationId
|
|
5091
5109
|
);
|
|
5092
|
-
setOptimisticReadIds((prev) => {
|
|
5093
|
-
const next = new Set(prev);
|
|
5094
|
-
next.delete(notificationId);
|
|
5095
|
-
return next;
|
|
5096
|
-
});
|
|
5097
5110
|
} catch (error) {
|
|
5098
5111
|
console.error(
|
|
5099
5112
|
"[NotificationsWidget] Failed to mark as read, reverting:",
|
|
@@ -5240,7 +5253,11 @@ function NotificationsWidget({
|
|
|
5240
5253
|
initial: { scale: 0, opacity: 0 },
|
|
5241
5254
|
animate: { scale: 1, opacity: 1 },
|
|
5242
5255
|
exit: { scale: 0, opacity: 0 },
|
|
5243
|
-
className: cn(
|
|
5256
|
+
className: cn(
|
|
5257
|
+
"absolute rounded-full z-10",
|
|
5258
|
+
dotBgColor,
|
|
5259
|
+
styles.dot
|
|
5260
|
+
)
|
|
5244
5261
|
}
|
|
5245
5262
|
) }),
|
|
5246
5263
|
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: unreadCount > 0 && showPulse && pulseStyle !== "none" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5249,7 +5266,11 @@ function NotificationsWidget({
|
|
|
5249
5266
|
initial: { scale: 1, opacity: 0.5 },
|
|
5250
5267
|
animate: pulseVariants[pulseStyle].animate,
|
|
5251
5268
|
transition: pulseVariants[pulseStyle].transition,
|
|
5252
|
-
className: cn(
|
|
5269
|
+
className: cn(
|
|
5270
|
+
"absolute rounded-full z-0",
|
|
5271
|
+
dotBgColor,
|
|
5272
|
+
styles.dot
|
|
5273
|
+
)
|
|
5253
5274
|
}
|
|
5254
5275
|
) })
|
|
5255
5276
|
]
|