bugfixing
This commit is contained in:
parent
eaee3cf33d
commit
5587d056b3
@ -48,8 +48,8 @@ type FlyAndScaleParams = {
|
||||
return formattedTimeString;
|
||||
}
|
||||
|
||||
export const groupEarnings = (earnings) => {
|
||||
return Object.entries(
|
||||
export const groupEarnings = (earnings) => {
|
||||
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;
|
||||
})
|
||||
]);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
twq("event", "tw-onuuu-ospg6", {
|
||||
value: value,
|
||||
currency: "USD",
|
||||
conversion_id: data?.user?.id,
|
||||
});
|
||||
try {
|
||||
twq("event", "tw-onuuu-ospg6", {
|
||||
value: value,
|
||||
currency: "USD",
|
||||
conversion_id: data?.user?.id,
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
const isDarkMode =
|
||||
window.matchMedia &&
|
||||
|
||||
@ -246,9 +246,13 @@
|
||||
const match = watchList?.find((w) => w?.symbol === item?.symbol);
|
||||
return match ? { ...item, name: match?.name } : { ...item };
|
||||
});
|
||||
|
||||
groupedEarnings = groupEarnings(earnings);
|
||||
groupedNews = groupNews(news, watchList);
|
||||
if (watchList?.length > 0) {
|
||||
groupedEarnings = groupEarnings(earnings);
|
||||
groupedNews = groupNews(news, watchList);
|
||||
} else {
|
||||
groupedEarnings = [];
|
||||
groupedNews = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function createWatchList(event) {
|
||||
@ -424,9 +428,13 @@
|
||||
});
|
||||
|
||||
allList = [...allList];
|
||||
|
||||
groupedNews = groupNews(news, watchList);
|
||||
groupedEarnings = groupEarnings(earnings);
|
||||
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}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user