bugfixing
This commit is contained in:
parent
eaee3cf33d
commit
5587d056b3
@ -48,8 +48,8 @@ type FlyAndScaleParams = {
|
|||||||
return formattedTimeString;
|
return formattedTimeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const groupEarnings = (earnings) => {
|
export const groupEarnings = (earnings) => {
|
||||||
return Object.entries(
|
return Object?.entries(
|
||||||
earnings
|
earnings
|
||||||
?.reduce((acc, item) => {
|
?.reduce((acc, item) => {
|
||||||
const dateKey = new Intl.DateTimeFormat('en-US', {
|
const dateKey = new Intl.DateTimeFormat('en-US', {
|
||||||
@ -59,7 +59,7 @@ export const groupEarnings = (earnings) => {
|
|||||||
}).format(new Date(item?.date));
|
}).format(new Date(item?.date));
|
||||||
|
|
||||||
if (!acc[dateKey]) acc[dateKey] = [];
|
if (!acc[dateKey]) acc[dateKey] = [];
|
||||||
acc[dateKey].push(item);
|
acc[dateKey]?.push(item);
|
||||||
return acc;
|
return acc;
|
||||||
}, {})
|
}, {})
|
||||||
)
|
)
|
||||||
@ -68,9 +68,9 @@ export const groupEarnings = (earnings) => {
|
|||||||
?.map(([date, earnings]) => [
|
?.map(([date, earnings]) => [
|
||||||
date,
|
date,
|
||||||
// Sort earnings within the date by time
|
// Sort earnings within the date by time
|
||||||
earnings.sort((a, b) => {
|
earnings?.sort((a, b) => {
|
||||||
const timeA = new Date(`1970-01-01T${a.time}`);
|
const timeA = new Date(`1970-01-01T${a?.time}`);
|
||||||
const timeB = new Date(`1970-01-01T${b.time}`);
|
const timeB = new Date(`1970-01-01T${b?.time}`);
|
||||||
return timeB - timeA;
|
return timeB - timeA;
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { numberOfUnreadNotification, globalForm } from "$lib/store";
|
import { numberOfUnreadNotification } from "$lib/store";
|
||||||
import { openLemonSqueezyUrl } from "$lib/lemonsqueezy";
|
import { openLemonSqueezyUrl } from "$lib/lemonsqueezy";
|
||||||
//import Discount from '$lib/components/Discount.svelte';
|
//import Discount from '$lib/components/Discount.svelte';
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
@ -52,12 +52,15 @@
|
|||||||
subId = import.meta.env.VITE_LEMON_SQUEEZY_MONTHLY_ID;
|
subId = import.meta.env.VITE_LEMON_SQUEEZY_MONTHLY_ID;
|
||||||
value = 9.99;
|
value = 9.99;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
twq("event", "tw-onuuu-ospg6", {
|
twq("event", "tw-onuuu-ospg6", {
|
||||||
value: value,
|
value: value,
|
||||||
currency: "USD",
|
currency: "USD",
|
||||||
conversion_id: data?.user?.id,
|
conversion_id: data?.user?.id,
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
const isDarkMode =
|
const isDarkMode =
|
||||||
window.matchMedia &&
|
window.matchMedia &&
|
||||||
|
|||||||
@ -246,9 +246,13 @@
|
|||||||
const match = watchList?.find((w) => w?.symbol === item?.symbol);
|
const match = watchList?.find((w) => w?.symbol === item?.symbol);
|
||||||
return match ? { ...item, name: match?.name } : { ...item };
|
return match ? { ...item, name: match?.name } : { ...item };
|
||||||
});
|
});
|
||||||
|
if (watchList?.length > 0) {
|
||||||
groupedEarnings = groupEarnings(earnings);
|
groupedEarnings = groupEarnings(earnings);
|
||||||
groupedNews = groupNews(news, watchList);
|
groupedNews = groupNews(news, watchList);
|
||||||
|
} else {
|
||||||
|
groupedEarnings = [];
|
||||||
|
groupedNews = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createWatchList(event) {
|
async function createWatchList(event) {
|
||||||
@ -424,9 +428,13 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
allList = [...allList];
|
allList = [...allList];
|
||||||
|
if (watchList?.length > 0) {
|
||||||
groupedNews = groupNews(news, watchList);
|
groupedNews = groupNews(news, watchList);
|
||||||
groupedEarnings = groupEarnings(earnings);
|
groupedEarnings = groupEarnings(earnings);
|
||||||
|
} else {
|
||||||
|
groupedEarnings = [];
|
||||||
|
groupedEarnings = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1493,7 +1501,7 @@
|
|||||||
the latest news.
|
the latest news.
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
{:else if earnings?.length > 0}
|
{:else if groupedEarnings?.length > 0}
|
||||||
{#each groupedEarnings as [date, titleGroups]}
|
{#each groupedEarnings as [date, titleGroups]}
|
||||||
<h3 class="mb-1.5 mt-3 font-semibold text-faded">
|
<h3 class="mb-1.5 mt-3 font-semibold text-faded">
|
||||||
{date}
|
{date}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user