ui fixes
This commit is contained in:
parent
569a221f21
commit
e4b17138c0
@ -8,21 +8,8 @@
|
||||
|
||||
export let data;
|
||||
|
||||
let isLoaded = false;
|
||||
let rawData = [];
|
||||
let displayList = [];
|
||||
|
||||
let order = "highToLow";
|
||||
|
||||
const sortByAmount = (tickerList) => {
|
||||
return tickerList?.sort(function (a, b) {
|
||||
if (order === "highToLow") {
|
||||
return b?.amount - a?.amount;
|
||||
} else {
|
||||
return a?.amount - b?.amount;
|
||||
}
|
||||
});
|
||||
};
|
||||
let rawData = data?.getCorporateLobbyingTracker ?? [];
|
||||
let displayList = rawData?.slice(0, 50) ?? [];
|
||||
|
||||
async function infiniteHandler({ detail: { loaded, complete } }) {
|
||||
if (displayList?.length === rawData?.length) {
|
||||
@ -48,21 +35,6 @@
|
||||
|
||||
return `${year}/${month}/${day} ${hours}:${minutes} ${ampm}`;
|
||||
}
|
||||
onMount(() => {
|
||||
rawData = data?.getCorporateLobbyingTracker ?? [];
|
||||
displayList = rawData?.slice(0, 50) ?? [];
|
||||
isLoaded = true;
|
||||
});
|
||||
|
||||
function changeOrder(state: string) {
|
||||
if (state === "highToLow") {
|
||||
order = "lowToHigh";
|
||||
} else {
|
||||
order = "highToLow";
|
||||
}
|
||||
|
||||
displayList = sortByAmount(rawData)?.slice(0, 50);
|
||||
}
|
||||
|
||||
$: charNumber = $screenWidth < 640 ? 15 : 20;
|
||||
|
||||
@ -206,7 +178,6 @@
|
||||
Track the latest lobbying spendings of US stock companies
|
||||
</p>
|
||||
</div>
|
||||
{#if isLoaded}
|
||||
<div
|
||||
class="w-screen sm:w-full flex flex-row items-start mt-20 sm:mt-10"
|
||||
>
|
||||
@ -290,18 +261,7 @@
|
||||
</div>
|
||||
<InfiniteLoading on:infinite={infiniteHandler} />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex justify-center items-center h-80">
|
||||
<div class="relative">
|
||||
<label
|
||||
class="bg-[#09090B] rounded-xl h-14 w-14 flex justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
|
||||
>
|
||||
<span class="loading loading-spinner loading-md text-gray-400"
|
||||
></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<UpgradeToPro
|
||||
{data}
|
||||
title="Get the latest lobbying spendings in realtime of US stock companies"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user