mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 17:21:05 +00:00
fix(GH): nightly release workflow issues
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
injectArchivedForUser,
|
||||
mountArchivedNotificationInjection,
|
||||
} from "./injectArchivedNotifications";
|
||||
import styles from "./styles.css?inline";
|
||||
|
||||
const notificationCollectorSettings = {
|
||||
saveLocally: booleanSetting({
|
||||
@@ -46,6 +47,10 @@ const notificationCollectorPlugin: Plugin<
|
||||
return () => {};
|
||||
}
|
||||
|
||||
const styleEl = document.createElement("style");
|
||||
styleEl.textContent = styles;
|
||||
document.head.appendChild(styleEl);
|
||||
|
||||
await api.storage.loaded;
|
||||
await api.settings.loaded;
|
||||
|
||||
@@ -208,6 +213,7 @@ const notificationCollectorPlugin: Plugin<
|
||||
teardownInjection();
|
||||
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
||||
pageChangeUnregister.unregister();
|
||||
styleEl.remove();
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -10,6 +10,12 @@ import {
|
||||
|
||||
const LIST_SELECTOR = '[class*="notifications__list___"]';
|
||||
const ITEMS_SELECTOR = '[class*="notifications__items___"]';
|
||||
const ITEM_SELECTOR = '[class*="notifications__item___"]';
|
||||
const BACKED_UP_CLASS = "bsplus-notification-backed-up";
|
||||
const BACKUP_BADGE_CLASS = "bsplus-notification-backup-badge";
|
||||
|
||||
const BACKUP_CHECK_SVG =
|
||||
'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>';
|
||||
|
||||
function notificationTimestamp(item: Record<string, unknown>): number {
|
||||
const ms = new Date(String(item.timestamp ?? 0)).getTime();
|
||||
@@ -61,9 +67,33 @@ async function tryInjectArchived(archive: ArchiveMap): Promise<boolean> {
|
||||
async function injectWithRetries(archive: ArchiveMap, attempts = 10) {
|
||||
for (let i = 0; i < attempts; i++) {
|
||||
const done = await tryInjectArchived(archive);
|
||||
if (done) return;
|
||||
if (done) break;
|
||||
await delay(120);
|
||||
}
|
||||
applyBackupBadges(archive);
|
||||
}
|
||||
|
||||
export function applyBackupBadges(archive: ArchiveMap) {
|
||||
const backedUpIds = new Set(Object.keys(archive));
|
||||
|
||||
for (const itemEl of document.querySelectorAll<HTMLElement>(ITEM_SELECTOR)) {
|
||||
const id = itemEl.getAttribute("data-id");
|
||||
if (!id) continue;
|
||||
|
||||
if (backedUpIds.has(id)) {
|
||||
itemEl.classList.add(BACKED_UP_CLASS);
|
||||
if (!itemEl.querySelector(`.${BACKUP_BADGE_CLASS}`)) {
|
||||
const badge = document.createElement("span");
|
||||
badge.className = BACKUP_BADGE_CLASS;
|
||||
badge.title = "Saved locally";
|
||||
badge.innerHTML = BACKUP_CHECK_SVG;
|
||||
itemEl.appendChild(badge);
|
||||
}
|
||||
} else {
|
||||
itemEl.classList.remove(BACKED_UP_CLASS);
|
||||
itemEl.querySelector(`.${BACKUP_BADGE_CLASS}`)?.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function mountArchivedNotificationInjection(
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
[class*="notifications__item___"].bsplus-notification-backed-up {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.bsplus-notification-backup-badge {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 6px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-radius: 50%;
|
||||
background: var(--better-main, #22c55e);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
z-index: 2;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.bsplus-notification-backup-badge svg {
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
color: #fff;
|
||||
}
|
||||
Reference in New Issue
Block a user