@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.js CHANGED
@@ -4814,19 +4814,19 @@ var sizeConfig = {
4814
4814
  button: "h-8 w-8",
4815
4815
  icon: "w-4 h-4",
4816
4816
  badge: "min-w-[16px] h-4 text-[10px] -top-1 -right-1",
4817
- dot: "w-2.5 h-2.5 -top-0.5 -right-0.5"
4817
+ dot: "w-2.5 h-2.5 top-0 right-0"
4818
4818
  },
4819
4819
  md: {
4820
4820
  button: "h-9 w-9",
4821
4821
  icon: "w-5 h-5",
4822
4822
  badge: "min-w-[18px] h-[18px] text-[11px] -top-1 -right-1",
4823
- dot: "w-3 h-3 -top-0.5 -right-0.5"
4823
+ dot: "w-3 h-3 top-0 right-0"
4824
4824
  },
4825
4825
  lg: {
4826
4826
  button: "h-10 w-10",
4827
4827
  icon: "w-6 h-6",
4828
4828
  badge: "min-w-[20px] h-5 text-xs -top-1.5 -right-1.5",
4829
- dot: "w-3.5 h-3.5 -top-0.5 -right-0.5"
4829
+ dot: "w-3.5 h-3.5 top-0 right-0"
4830
4830
  }
4831
4831
  };
4832
4832
  var typeConfig = {
@@ -4998,6 +4998,24 @@ function NotificationsWidget({
4998
4998
  getIsReadRef.current = getIsRead;
4999
4999
  }, [getIsRead]);
5000
5000
  const unreadCount = notifications.filter((n) => !getIsRead(n)).length;
5001
+ React2.useEffect(() => {
5002
+ setOptimisticReadIds((prev) => {
5003
+ const next = new Set(prev);
5004
+ let changed = false;
5005
+ prev.forEach((id) => {
5006
+ const notification = notifications.find((n) => n.id === id);
5007
+ if (notification?.read === true) {
5008
+ next.delete(id);
5009
+ changed = true;
5010
+ console.log(
5011
+ "[NotificationsWidget] Clearing optimistic state for server-confirmed read:",
5012
+ id
5013
+ );
5014
+ }
5015
+ });
5016
+ return changed ? next : prev;
5017
+ });
5018
+ }, [notifications]);
5001
5019
  React2.useEffect(() => {
5002
5020
  console.log(
5003
5021
  "[NotificationsWidget] Notifications received:",
@@ -5058,14 +5076,9 @@ function NotificationsWidget({
5058
5076
  try {
5059
5077
  await Promise.resolve(onMarkAsRead(notificationId));
5060
5078
  console.log(
5061
- "[NotificationsWidget] Successfully marked as read:",
5079
+ "[NotificationsWidget] Successfully marked as read (keeping optimistic state):",
5062
5080
  notificationId
5063
5081
  );
5064
- setOptimisticReadIds((prev) => {
5065
- const next = new Set(prev);
5066
- next.delete(notificationId);
5067
- return next;
5068
- });
5069
5082
  } catch (error) {
5070
5083
  console.error(
5071
5084
  "[NotificationsWidget] Failed to mark as read, reverting:",
@@ -5212,7 +5225,11 @@ function NotificationsWidget({
5212
5225
  initial: { scale: 0, opacity: 0 },
5213
5226
  animate: { scale: 1, opacity: 1 },
5214
5227
  exit: { scale: 0, opacity: 0 },
5215
- className: cn("absolute rounded-full", dotBgColor, styles.dot)
5228
+ className: cn(
5229
+ "absolute rounded-full z-10",
5230
+ dotBgColor,
5231
+ styles.dot
5232
+ )
5216
5233
  }
5217
5234
  ) }),
5218
5235
  /* @__PURE__ */ jsx(AnimatePresence, { children: unreadCount > 0 && showPulse && pulseStyle !== "none" && /* @__PURE__ */ jsx(
@@ -5221,7 +5238,11 @@ function NotificationsWidget({
5221
5238
  initial: { scale: 1, opacity: 0.5 },
5222
5239
  animate: pulseVariants[pulseStyle].animate,
5223
5240
  transition: pulseVariants[pulseStyle].transition,
5224
- className: cn("absolute rounded-full", dotBgColor, styles.dot)
5241
+ className: cn(
5242
+ "absolute rounded-full z-0",
5243
+ dotBgColor,
5244
+ styles.dot
5245
+ )
5225
5246
  }
5226
5247
  ) })
5227
5248
  ]