|
|
|
|
@@ -457,6 +457,7 @@ import { createProfileCache } from './js/profile-cache.mjs';
|
|
|
|
|
const timeElements = new Map();
|
|
|
|
|
const postImageCache = new Map();
|
|
|
|
|
const targetEventCache = new Map();
|
|
|
|
|
const detachedInteractionBars = new Map();
|
|
|
|
|
let interactions = null;
|
|
|
|
|
let notifInteractionsSubId = null;
|
|
|
|
|
let visibleNotificationsCount = NOTIFICATIONS_PAGE_SIZE;
|
|
|
|
|
@@ -1104,21 +1105,28 @@ import { createProfileCache } from './js/profile-cache.mjs';
|
|
|
|
|
// Add interaction menu items (Like, Comment, Quote, Zap, Nutzap) when
|
|
|
|
|
// the notification references a target post. The actual interaction
|
|
|
|
|
// logic (publishing, zap dialogs, balance checks) is handled by the
|
|
|
|
|
// post-interactions module via a hidden interaction bar appended to
|
|
|
|
|
// the row. Menu items trigger clicks on the corresponding buttons
|
|
|
|
|
// in that hidden bar.
|
|
|
|
|
// post-interactions module via a detached interaction bar (kept out of
|
|
|
|
|
// the DOM so it never shows up in the row). Menu items trigger clicks
|
|
|
|
|
// on the corresponding buttons in that detached bar.
|
|
|
|
|
console.log('[notifications] buildNotificationRow menu check', {
|
|
|
|
|
notifId: item.id,
|
|
|
|
|
kind: item.kind,
|
|
|
|
|
targetEventId: item.targetEventId,
|
|
|
|
|
hasInteractions: !!interactions
|
|
|
|
|
});
|
|
|
|
|
if (item.targetEventId && interactions) {
|
|
|
|
|
const targetPubkey = item.targetPubkey || currentPubkey;
|
|
|
|
|
const targetEventData = { id: item.targetEventId, pubkey: targetPubkey };
|
|
|
|
|
|
|
|
|
|
const hiddenBar = interactions.renderInteractionBar(
|
|
|
|
|
item.targetEventId,
|
|
|
|
|
targetEventData,
|
|
|
|
|
{ currentPubkey }
|
|
|
|
|
);
|
|
|
|
|
hiddenBar.style.display = 'none';
|
|
|
|
|
hiddenBar.dataset.notifHiddenBar = item.targetEventId;
|
|
|
|
|
row.appendChild(hiddenBar);
|
|
|
|
|
let hiddenBar = detachedInteractionBars.get(item.id);
|
|
|
|
|
if (!hiddenBar) {
|
|
|
|
|
hiddenBar = interactions.renderInteractionBar(
|
|
|
|
|
item.targetEventId,
|
|
|
|
|
targetEventData,
|
|
|
|
|
{ currentPubkey }
|
|
|
|
|
);
|
|
|
|
|
detachedInteractionBars.set(item.id, hiddenBar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const addMenuBtn = (label, selector) => {
|
|
|
|
|
const btn = document.createElement('button');
|
|
|
|
|
@@ -1206,6 +1214,7 @@ import { createProfileCache } from './js/profile-cache.mjs';
|
|
|
|
|
|
|
|
|
|
divNotifications.innerHTML = '';
|
|
|
|
|
timeElements.clear();
|
|
|
|
|
detachedInteractionBars.clear();
|
|
|
|
|
|
|
|
|
|
for (const item of visibleItems) {
|
|
|
|
|
const row = buildNotificationRow(item);
|
|
|
|
|
@@ -1502,6 +1511,7 @@ import { createProfileCache } from './js/profile-cache.mjs';
|
|
|
|
|
notificationsReadAt = readAt;
|
|
|
|
|
notificationsById.clear();
|
|
|
|
|
unreadNotificationsById.clear();
|
|
|
|
|
detachedInteractionBars.clear();
|
|
|
|
|
visibleNotificationsCount = NOTIFICATIONS_PAGE_SIZE;
|
|
|
|
|
renderNotifications();
|
|
|
|
|
|
|
|
|
|
|