diff --git a/src/routes/crypto/[tickerID]/congress-trading/+page.svelte b/src/routes/crypto/[tickerID]/congress-trading/+page.svelte index dc21ee63..98a9f68d 100644 --- a/src/routes/crypto/[tickerID]/congress-trading/+page.svelte +++ b/src/routes/crypto/[tickerID]/congress-trading/+page.svelte @@ -4,9 +4,7 @@ import republicanBackground from "$lib/images/bg-republican.png"; import democraticBackground from "$lib/images/bg-democratic.png"; import otherBackground from "$lib/images/bg-other.png"; - import InfiniteLoading from '$lib/components/InfiniteLoading.svelte'; import { getPartyForPoliticians } from '$lib/utils'; - import { goto } from '$app/navigation'; export let data; @@ -17,7 +15,6 @@ let senateTradingList = []; let displayStructure = 'Card'; let isLoaded = false; - let images = {}; let cloudFrontUrl = import.meta.env.VITE_IMAGE_URL; @@ -56,20 +53,17 @@ const district = { } - -async function infiniteHandler({ detail: { loaded, complete } }) -{ - if (senateTradingList?.length === rawData?.length) { - complete(); - } else { - const nextIndex = senateTradingList?.length; - const newArticles = rawData?.slice(nextIndex, nextIndex + 20); - senateTradingList = [...senateTradingList, ...newArticles]; - loaded(); +async function handleScroll() { + const scrollThreshold = document.body.offsetHeight * 0.8; // 80% of the website height + const isBottom = window.innerHeight + window.scrollY >= scrollThreshold; + if (isBottom && senateTradingList?.length !== rawData?.length) { + const nextIndex = senateTradingList?.length; + const filteredNewResults = rawData?.slice(nextIndex, nextIndex + 25); + senateTradingList = [...senateTradingList, ...filteredNewResults]; } -} - + } + onMount(async () => { @@ -105,6 +99,13 @@ onMount(async () => { senateTradingList = rawData.slice(0, 20) ?? []; isLoaded = true; + + if(data?.user?.tier === 'Pro') { + window.addEventListener('scroll', handleScroll); + return () => { + window.removeEventListener('scroll', handleScroll); + }; + } }); @@ -169,7 +170,7 @@ onMount(async () => {
-
+
Buy/Sell @@ -196,7 +197,7 @@ onMount(async () => {
-
+
Dem/Rep @@ -253,7 +254,7 @@ onMount(async () => { {#each senateTradingList as item} - goto(`/politicians/${item?.id}`)} class="odd:bg-[#27272A] sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] bg-[#09090B] border-b-[#09090B] cursor-pointer"> +
@@ -262,7 +263,7 @@ onMount(async () => {
- {item?.representative?.replace('_',' ')} + {item?.representative?.replace('_',' ')} {item?.party}
@@ -294,7 +295,6 @@ onMount(async () => {
- {:else}
@@ -308,7 +308,7 @@ onMount(async () => { {:else} {/if} -
+
@@ -390,7 +390,6 @@ onMount(async () => { {/if} - {/if} diff --git a/src/routes/etf/[tickerID]/congress-trading/+page.svelte b/src/routes/etf/[tickerID]/congress-trading/+page.svelte index 7598cb41..367be8d3 100644 --- a/src/routes/etf/[tickerID]/congress-trading/+page.svelte +++ b/src/routes/etf/[tickerID]/congress-trading/+page.svelte @@ -4,9 +4,7 @@ import republicanBackground from "$lib/images/bg-republican.png"; import democraticBackground from "$lib/images/bg-democratic.png"; import otherBackground from "$lib/images/bg-other.png"; - import InfiniteLoading from '$lib/components/InfiniteLoading.svelte'; import { getPartyForPoliticians } from '$lib/utils'; - import { goto } from '$app/navigation'; export let data; @@ -55,20 +53,17 @@ const district = { } - -async function infiniteHandler({ detail: { loaded, complete } }) -{ - if (senateTradingList?.length === rawData?.length) { - complete(); - } else { - const nextIndex = senateTradingList?.length; - const newArticles = rawData?.slice(nextIndex, nextIndex + 20); - senateTradingList = [...senateTradingList, ...newArticles]; - loaded(); +async function handleScroll() { + const scrollThreshold = document.body.offsetHeight * 0.8; // 80% of the website height + const isBottom = window.innerHeight + window.scrollY >= scrollThreshold; + if (isBottom && senateTradingList?.length !== rawData?.length) { + const nextIndex = senateTradingList?.length; + const filteredNewResults = rawData?.slice(nextIndex, nextIndex + 25); + senateTradingList = [...senateTradingList, ...filteredNewResults]; } -} - + } + onMount(async () => { @@ -104,6 +99,13 @@ onMount(async () => { senateTradingList = rawData.slice(0, 20) ?? []; isLoaded = true; + + if(data?.user?.tier === 'Pro') { + window.addEventListener('scroll', handleScroll); + return () => { + window.removeEventListener('scroll', handleScroll); + }; + } }); @@ -168,7 +170,7 @@ onMount(async () => {
-
+
Buy/Sell @@ -195,7 +197,7 @@ onMount(async () => {
-
+
Dem/Rep @@ -252,7 +254,7 @@ onMount(async () => { {#each senateTradingList as item} - goto(`/politicians/${item?.id}`)} class="odd:bg-[#27272A] sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] bg-[#09090B] border-b-[#09090B] cursor-pointer"> +
@@ -261,7 +263,7 @@ onMount(async () => {
- {item?.representative?.replace('_',' ')} + {item?.representative?.replace('_',' ')} {item?.party}
@@ -293,7 +295,6 @@ onMount(async () => {
- {:else}
@@ -307,7 +308,7 @@ onMount(async () => { {:else} {/if} -
+
@@ -389,7 +390,6 @@ onMount(async () => { {/if} - {/if} diff --git a/src/routes/etf/[tickerID]/holdings/+page.svelte b/src/routes/etf/[tickerID]/holdings/+page.svelte index ddd3a57d..44eaef43 100644 --- a/src/routes/etf/[tickerID]/holdings/+page.svelte +++ b/src/routes/etf/[tickerID]/holdings/+page.svelte @@ -1,14 +1,11 @@ @@ -152,7 +125,7 @@ $: { changeOrder('weights')} class="text-white border-b border-[#09090B] bg-[#09090B] font-semibold text-end text-sm sm:text-[1rem] whitespace-nowrap cursor-pointer"> % Weight - + @@ -160,17 +133,17 @@ $: { {#each holdings as item} {#if item?.asset !== null} - stockSelector(item?.asset)} class="w-full sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] odd:bg-[#27272A] {item?.asset?.length !== 0 ? 'cursor-pointer' : ''}"> + - - {item?.asset?.length !== 0 ? item?.asset : '-'} + + {item?.asset?.length !== 0 ? item?.asset : '-'} {item?.name?.length > charNumber ? formatString(item?.name?.slice(0,charNumber)) + "..." : formatString(item?.name)} - + {abbreviateNumber(item?.sharesNumber)} @@ -196,14 +169,12 @@ $: {
- - {:else}

- No holdings are available for {$displayCompanyName} 🧐. + No holdings are available for {$displayCompanyName}.

{/if} diff --git a/src/routes/etf/[tickerID]/stats/+page.svelte b/src/routes/etf/[tickerID]/stats/+page.svelte index e28112f6..a81b91b1 100644 --- a/src/routes/etf/[tickerID]/stats/+page.svelte +++ b/src/routes/etf/[tickerID]/stats/+page.svelte @@ -1122,8 +1122,8 @@
{:else} -

- No data available +

+ Sorry for this ETF no data is available

{/if} diff --git a/src/routes/stocks/[tickerID]/stats/market-cap/+page.svelte b/src/routes/stocks/[tickerID]/stats/market-cap/+page.svelte index 2b0ec10f..b90356f3 100644 --- a/src/routes/stocks/[tickerID]/stats/market-cap/+page.svelte +++ b/src/routes/stocks/[tickerID]/stats/market-cap/+page.svelte @@ -332,7 +332,7 @@ async function plotData() -
    +