mirror of
https://github.com/andrei0x309/yup-live-chrome-extension.git
synced 2024-10-26 16:00:56 +00:00
chore: changes for 1.1.5
This commit is contained in:
parent
68bbb0d095
commit
a2c11eebff
@ -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
|
||||
|
@ -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)
|
||||
|
@ -13,6 +13,8 @@
|
||||
const numImages = notif?.senders?.length ?? 0;
|
||||
let loaders: ImgLoader[] = Array(numImages).fill(null);
|
||||
|
||||
console.log(notif)
|
||||
|
||||
</script>
|
||||
|
||||
{#if notif.eventType === "vote"}
|
||||
@ -23,8 +25,8 @@
|
||||
<div class="flex flex-row notifBody">
|
||||
<LikeIcon solid={true} className={'w-9 mx-auto p-4'} />
|
||||
<div class="ml-4 text-left" style="width: 97%">
|
||||
<p class="text-xs text-gray-200 my-0 mt-1">
|
||||
by
|
||||
<p class="text-xs text-gray-200 my-0 mt-2">
|
||||
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}
|
||||
</p>
|
||||
<p class="text-xs text-gray-200 my-0 mt-1">
|
||||
<p class="text-xs text-gray-200 my-0 mt-1 cursor-pointer">
|
||||
<span
|
||||
on:click={() => extrenalNavigate(`${YUP_APP_BASE}/post/${notif.meta.postid}`)}
|
||||
aria-hidden
|
||||
class="text-blue-200 interactive-svg">{finalUrl}</span
|
||||
class="text-blue-200 interactive-svg">view the post</span
|
||||
>
|
||||
</p>
|
||||
<p class="text-xs text-gray-200 my-1 text-right mr-2">
|
||||
@ -126,6 +128,62 @@
|
||||
{timeSince(new Date(notif.createdAt))}
|
||||
</p>
|
||||
</div>
|
||||
{:else if ["comment"].includes(notif.eventType)}
|
||||
<div class="flex flex-col notifBody">
|
||||
{#each notif.senders as sender, i}
|
||||
<div class="flex flex-row items-center">
|
||||
<ImgLoader bind:this={loaders[i]} source="{sender?.avatar}" >
|
||||
<img
|
||||
class="notificationImage"
|
||||
on:load={() => loaders[i]?.onLoad()}
|
||||
on:error={() => loaders[i]?.onError()}
|
||||
style={$mainStore.settings.theme === "light" ? "filter: invert(0.9);" : ""}
|
||||
slot="img"
|
||||
src={sender.avatar}
|
||||
alt="preview"
|
||||
/>
|
||||
<svg
|
||||
class="notificationImage"
|
||||
style={$mainStore.settings.theme === "light" ? "filter: invert(0.9);" : ""}
|
||||
slot="error"
|
||||
viewBox="0 0 512 512"
|
||||
><g
|
||||
><polygon
|
||||
points="40,38.999 40,468.998 215,293.998 270,348.998 360,258.998 470,358.998 470,38.999 "
|
||||
style="fill:#EFF3F6;"
|
||||
/>
|
||||
<g><circle cx="150" cy="158.999" r="40" style="fill:#FCD884;" /></g><g
|
||||
><polygon
|
||||
points="470,358.998 470,468.998 385,468.998 385,463.998 270,348.998 360,258.998 "
|
||||
style="fill:#70993F;"
|
||||
/></g
|
||||
><g><polygon points="385,463.998 385,468.998 40,468.998 215,293.998 270,348.998" style="fill:#80AF52;" /></g
|
||||
></g
|
||||
><g /></svg
|
||||
>
|
||||
</ImgLoader>
|
||||
<div class="ml-4 text-left" style="width: 97%">
|
||||
<p
|
||||
aria-hidden
|
||||
class="text-xs text-gray-200 my-0 mt-1 cursor-pointer"
|
||||
on:click={() => extrenalNavigate(`${YUP_APP_BASE}/post/${notif?.meta?.commentId}`)}
|
||||
>
|
||||
<b>{sender?.handle || `${sender?._id?.slice(0, 6)}...`}</b>
|
||||
commented on yout post, click to view.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
<p class="text-xs text-gray-200 my-1 text-right mr-2">
|
||||
<svg class="w-3 inline" viewBox="0 0 20 20"
|
||||
><path
|
||||
fill="#fff"
|
||||
d="M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm-1-7.59V4h2v5.59l3.95 3.95-1.41 1.41L9 10.41z"
|
||||
/></svg
|
||||
>
|
||||
{timeSince(new Date(notif.createdAt))}
|
||||
</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex flex-row items-center notifBody">
|
||||
<div class="ml-4 text-left" style="width: 97%">
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ export interface Vote {
|
||||
postid?: string
|
||||
url?: string
|
||||
message?: string
|
||||
commentId?: string
|
||||
}
|
||||
image: string
|
||||
createdAt: string
|
||||
|
Loading…
Reference in New Issue
Block a user