diff --git a/CHANGELOG.MD b/CHANGELOG.MD index de70ccf..b9f2b9c 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,5 +1,10 @@ # Change Log +## [Version 1.1.5] + +- improved notification handling and display +- lowerd coinGecko api calls due to recent changes in free tier limit + ## [Version 1.1.4] - minor fix edge case of no notifications diff --git a/src/background/index.ts b/src/background/index.ts index f451012..5ea57e5 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -110,14 +110,15 @@ const alarmHandler = async () => { } catch (error) { console.error('Error fetching profile', error) } + const fiveHours = 18e5 + const isExpiredCoinGecko = store?.settings?.coinGeckoPrice && (new Date().getTime() - store.settings.lastCoinGeckoPriceCheckTimestamp) > fiveHours try { const coinGecko = await requests.coinGecko as Response const coinGeckoJson = await coinGecko.json() const coinGeckoPrice = coinGeckoJson.yup.usd - const store = await getStore() if (store.settings.coinGeckoPrice !== coinGeckoPrice) { - await chrome.storage.local.set({ store: { ...store, settings: { ...store.settings, coinGeckoPrice } } }) + await chrome.storage.local.set({ store: { ...store, settings: { ...store.settings, coinGeckoPrice, lastCoinGeckoPriceCheckTimestamp: new Date().getTime() } } }) } } catch (error) { console.error('Error fetching coinGecko', error) diff --git a/src/components/Notification.svelte b/src/components/Notification.svelte index 99524a8..4c8b3d4 100644 --- a/src/components/Notification.svelte +++ b/src/components/Notification.svelte @@ -13,6 +13,8 @@ const numImages = notif?.senders?.length ?? 0; let loaders: ImgLoader[] = Array(numImages).fill(null); + console.log(notif) + {#if notif.eventType === "vote"} @@ -23,8 +25,8 @@
-

- by +

+ your post was liked {#if notif?.senders?.length > 1} {notif?.senders[0].handle} {#if notif.senders?.length - 1 > 0} @@ -34,11 +36,11 @@ {notif.senders[0].handle?.length > 12 ? notif.senders[0]?.handle?.slice(0, 12) + "..." : notif.senders[0]?.handle ?? ''} {/if}

-

+

extrenalNavigate(`${YUP_APP_BASE}/post/${notif.meta.postid}`)} aria-hidden - class="text-blue-200 interactive-svg">{finalUrl}view the post

@@ -126,6 +128,62 @@ {timeSince(new Date(notif.createdAt))}

+{:else if ["comment"].includes(notif.eventType)} +
+ {#each notif.senders as sender, i} +
+ + loaders[i]?.onLoad()} + on:error={() => loaders[i]?.onError()} + style={$mainStore.settings.theme === "light" ? "filter: invert(0.9);" : ""} + slot="img" + src={sender.avatar} + alt="preview" + /> + + + +
+

extrenalNavigate(`${YUP_APP_BASE}/post/${notif?.meta?.commentId}`)} + > + {sender?.handle || `${sender?._id?.slice(0, 6)}...`} + commented on yout post, click to view. +

+
+
+ {/each} +

+ + {timeSince(new Date(notif.createdAt))} +

+
{:else}
diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 15c054a..0c0d465 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -44,6 +44,7 @@ export const storageDefault = { injectEmbed: false, chromeNotifWhenReward: false, chromeNotifWhenAbleToVote: false, + lastCoinGeckoPriceCheckTimestamp: 0, coinGeckoPrice: 0, hasNewNotifications: false, refilNotifTimestamp: 0, @@ -55,7 +56,7 @@ export const storageDefault = { enableFollowNotif: false, lastfollowNotif: 0, lastCommentNotif: 0, - lastMentionNotif: 0, + lastMentionNotif: 0 } } diff --git a/src/utils/types.ts b/src/utils/types.ts index f3ea9a3..457eb9f 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -24,6 +24,7 @@ export interface Vote { postid?: string url?: string message?: string + commentId?: string } image: string createdAt: string