ui fixes
This commit is contained in:
parent
569a221f21
commit
e4b17138c0
@ -8,21 +8,8 @@
|
|||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let isLoaded = false;
|
let rawData = data?.getCorporateLobbyingTracker ?? [];
|
||||||
let rawData = [];
|
let displayList = rawData?.slice(0, 50) ?? [];
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
async function infiniteHandler({ detail: { loaded, complete } }) {
|
async function infiniteHandler({ detail: { loaded, complete } }) {
|
||||||
if (displayList?.length === rawData?.length) {
|
if (displayList?.length === rawData?.length) {
|
||||||
@ -48,21 +35,6 @@
|
|||||||
|
|
||||||
return `${year}/${month}/${day} ${hours}:${minutes} ${ampm}`;
|
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;
|
$: charNumber = $screenWidth < 640 ? 15 : 20;
|
||||||
|
|
||||||
@ -206,7 +178,6 @@
|
|||||||
Track the latest lobbying spendings of US stock companies
|
Track the latest lobbying spendings of US stock companies
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{#if isLoaded}
|
|
||||||
<div
|
<div
|
||||||
class="w-screen sm:w-full flex flex-row items-start mt-20 sm:mt-10"
|
class="w-screen sm:w-full flex flex-row items-start mt-20 sm:mt-10"
|
||||||
>
|
>
|
||||||
@ -290,18 +261,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<InfiniteLoading on:infinite={infiniteHandler} />
|
<InfiniteLoading on:infinite={infiniteHandler} />
|
||||||
</div>
|
</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
|
<UpgradeToPro
|
||||||
{data}
|
{data}
|
||||||
title="Get the latest lobbying spendings in realtime of US stock companies"
|
title="Get the latest lobbying spendings in realtime of US stock companies"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user