bugfixing

This commit is contained in:
MuslemRahimi 2024-11-30 13:24:44 +01:00
parent eaee3cf33d
commit 5587d056b3
3 changed files with 31 additions and 20 deletions

View File

@ -49,7 +49,7 @@ type FlyAndScaleParams = {
}
export const groupEarnings = (earnings) => {
return Object.entries(
return Object?.entries(
earnings
?.reduce((acc, item) => {
const dateKey = new Intl.DateTimeFormat('en-US', {
@ -59,7 +59,7 @@ export const groupEarnings = (earnings) => {
}).format(new Date(item?.date));
if (!acc[dateKey]) acc[dateKey] = [];
acc[dateKey].push(item);
acc[dateKey]?.push(item);
return acc;
}, {})
)
@ -68,9 +68,9 @@ export const groupEarnings = (earnings) => {
?.map(([date, earnings]) => [
date,
// Sort earnings within the date by time
earnings.sort((a, b) => {
const timeA = new Date(`1970-01-01T${a.time}`);
const timeB = new Date(`1970-01-01T${b.time}`);
earnings?.sort((a, b) => {
const timeA = new Date(`1970-01-01T${a?.time}`);
const timeB = new Date(`1970-01-01T${b?.time}`);
return timeB - timeA;
})
]);

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { numberOfUnreadNotification, globalForm } from "$lib/store";
import { numberOfUnreadNotification } from "$lib/store";
import { openLemonSqueezyUrl } from "$lib/lemonsqueezy";
//import Discount from '$lib/components/Discount.svelte';
import { onMount } from "svelte";
@ -52,12 +52,15 @@
subId = import.meta.env.VITE_LEMON_SQUEEZY_MONTHLY_ID;
value = 9.99;
}
try {
twq("event", "tw-onuuu-ospg6", {
value: value,
currency: "USD",
conversion_id: data?.user?.id,
});
} catch (e) {
console.log(e);
}
const isDarkMode =
window.matchMedia &&

View File

@ -246,9 +246,13 @@
const match = watchList?.find((w) => w?.symbol === item?.symbol);
return match ? { ...item, name: match?.name } : { ...item };
});
if (watchList?.length > 0) {
groupedEarnings = groupEarnings(earnings);
groupedNews = groupNews(news, watchList);
} else {
groupedEarnings = [];
groupedNews = [];
}
}
async function createWatchList(event) {
@ -424,9 +428,13 @@
});
allList = [...allList];
if (watchList?.length > 0) {
groupedNews = groupNews(news, watchList);
groupedEarnings = groupEarnings(earnings);
} else {
groupedEarnings = [];
groupedEarnings = [];
}
}
}
@ -1493,7 +1501,7 @@
the latest news.
</span>
{/if}
{:else if earnings?.length > 0}
{:else if groupedEarnings?.length > 0}
{#each groupedEarnings as [date, titleGroups]}
<h3 class="mb-1.5 mt-3 font-semibold text-faded">
{date}