mirror of
https://github.com/andrei0x309/yup-live-chrome-extension.git
synced 2024-11-09 18:10:57 +00:00
fix: one link and some chrome notif logic
This commit is contained in:
parent
9470e6e475
commit
f9bafa818f
@ -83,9 +83,11 @@ const alarmHandler = async () => {
|
|||||||
|
|
||||||
if (store.settings?.chromeNotifWhenAbleToVote) {
|
if (store.settings?.chromeNotifWhenAbleToVote) {
|
||||||
const lastReset = (await getActionUsage(store?.user?.auth?.userId))?.data?.lastReset
|
const lastReset = (await getActionUsage(store?.user?.auth?.userId))?.data?.lastReset
|
||||||
|
const storeTs = store?.settings?.refilNotifTimestamp ?? 0
|
||||||
|
|
||||||
if (lastReset) {
|
if (lastReset) {
|
||||||
const isReset = getTimeRemaining(lastReset).total <= 0;
|
const isReset = getTimeRemaining(lastReset).total <= 0;
|
||||||
if (!closeTo(new Date(lastReset), new Date(store?.settings?.refilNotifTimestamp), 3.6e6) && isReset) {
|
if (!closeTo(new Date(lastReset), new Date(storeTs), 36e5) && isReset) {
|
||||||
updateSettings.refilNotifTimestamp = lastReset
|
updateSettings.refilNotifTimestamp = lastReset
|
||||||
chrome.notifications.create({
|
chrome.notifications.create({
|
||||||
type: 'basic',
|
type: 'basic',
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// import { storage } from "@/storage";
|
|
||||||
import { extrenalNavigate } from "@/utils/chrome-misc";
|
import { extrenalNavigate } from "@/utils/chrome-misc";
|
||||||
import ImgLoader from "@/components/ImgLoader.svelte";
|
import ImgLoader from "@/components/ImgLoader.svelte";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
// https://yup-live.pages.dev
|
|
||||||
import { APP_BASE } from "@/constants/config";
|
import { APP_BASE } from "@/constants/config";
|
||||||
import type { StorageType } from "@/utils/storage";
|
|
||||||
import RateWebsite from "@/components/RateWebsite.svelte";
|
import RateWebsite from "@/components/RateWebsite.svelte";
|
||||||
import { mainStore } from "@/utils/store";
|
import { mainStore } from "@/utils/store";
|
||||||
import { formatNumber, truncteEVMAddr } from "@/utils/misc";
|
import { formatNumber, truncteEVMAddr } from "@/utils/misc";
|
||||||
@ -85,7 +82,7 @@
|
|||||||
<span class="text-[0.6rem] mt-4 -ml-1">{handle.length >= 12 ? handle.slice(0, 10) + "..." : handle}</span>
|
<span class="text-[0.6rem] mt-4 -ml-1">{handle.length >= 12 ? handle.slice(0, 10) + "..." : handle}</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div on:click={() => extrenalNavigate(`${APP_BASE}/profile/${$mainStore.user.auth.userId}`)} aria-hidden class="flex flex-col w-16 mt-1 ml-4 px-2 py-3 link">
|
<div on:click={() => extrenalNavigate(`${APP_BASE}/raw-influence/${$mainStore.user.auth.userId}`)} aria-hidden class="flex flex-col w-16 mt-1 ml-4 px-2 py-3 link">
|
||||||
<span class="text-[0.6rem] mb-2">Influence</span><span class="text-[0.95rem] mb-2"
|
<span class="text-[0.6rem] mb-2">Influence</span><span class="text-[0.95rem] mb-2"
|
||||||
>{$mainStore?.user?.profile?.yup?.weight}</span
|
>{$mainStore?.user?.profile?.yup?.weight}</span
|
||||||
><span class="text-[0.7rem]">10<br />MAX</span>
|
><span class="text-[0.7rem]">10<br />MAX</span>
|
||||||
|
@ -95,7 +95,7 @@ export const setNotifStorageNotifs = async (notifs: any[]) => {
|
|||||||
|
|
||||||
export const setNotifStorageLastRewardNotif = async (lastRewardNotif) => {
|
export const setNotifStorageLastRewardNotif = async (lastRewardNotif) => {
|
||||||
const notifsStorage = await getNotifStorage()
|
const notifsStorage = await getNotifStorage()
|
||||||
await chrome.storage.local.set({ ...notifsStorage, lastRewardNotif: lastRewardNotif })
|
await chrome.storage.local.set({ ...notifsStorage, ...{ notifs: { lastRewardNotif } } })
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setAuth = async (auth) => {
|
export const setAuth = async (auth) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user