This commit is contained in:
MuslemRahimi 2025-01-07 14:12:34 +01:00
parent b3228fb1ca
commit 16e62d4bea
2 changed files with 36 additions and 33 deletions

View File

@ -50,9 +50,13 @@
} }
function loadMoreData() { function loadMoreData() {
const nextIndex = newsList?.length; const nextIndex = newsList.length; // Start from the current length of newsList
const newArticles = rawData?.slice(nextIndex, nextIndex + 20); const remainingArticles = rawData?.slice(nextIndex, nextIndex + 20); // Get the next 20 articles
newsList = [...newsList, ...newArticles];
// Append the new articles to the newsList
if (remainingArticles.length > 0) {
newsList = [...newsList, ...remainingArticles];
}
} }
$: filteredNewsList = $: filteredNewsList =
@ -93,11 +97,7 @@
</div> </div>
</div> </div>
<div <div class=" mt-1 sm:mt-0 text-white">
class="{$page?.url?.pathname.includes('etf')
? 'hidden'
: ''} mt-1 sm:mt-0 text-white"
>
<div <div
class="hflex flex-row items-center justify-between overflow-x-auto border-b border-gray-600 py-1.5" class="hflex flex-row items-center justify-between overflow-x-auto border-b border-gray-600 py-1.5"
> >
@ -113,27 +113,31 @@
: ''}">All</button : ''}">All</button
> >
</li> </li>
<li> {#if rawData.some((item) => checkIfYoutubeVideo(item.url) !== null)}
<button <li>
on:click={() => (displaySection = "videos")} <button
class="rounded-md px-3 py-0.5 ml-2 sm:hover:bg-secondary {displaySection === on:click={() => (displaySection = "videos")}
'videos' class="rounded-md px-3 py-0.5 ml-2 sm:hover:bg-secondary {displaySection ===
? 'bg-secondary' 'videos'
: ''}">Videos</button ? 'bg-secondary'
> : ''}">Videos</button
</li> >
<li> </li>
<button {/if}
on:click={() => getPressRelease()} {#if !$page?.url?.pathname.includes("etf")}
class="rounded-md px-3 py-0.5 ml-2 sm:hover:bg-secondary {displaySection === <li>
'press-releases' <button
? 'bg-secondary' on:click={() => getPressRelease()}
: ''}" class="rounded-md px-3 py-0.5 ml-2 sm:hover:bg-secondary {displaySection ===
><span class="inline sm:hidden">Press</span><span 'press-releases'
class="hidden sm:inline">Press Releases</span ? 'bg-secondary'
></button : ''}"
> ><span class="inline sm:hidden">Press</span><span
</li> class="hidden sm:inline">Press Releases</span
></button
>
</li>
{/if}
</ul> </ul>
</div> </div>
</div> </div>
@ -261,10 +265,10 @@
</div> </div>
</div> </div>
{/if} {/if}
{#if newsList?.length !== rawData?.length && filteredNewsList?.length > 0} {#if newsList?.length !== rawData?.length && filteredNewsList?.length > 0 && displaySection === "all"}
<label <label
on:click={loadMoreData} on:click={loadMoreData}
class="shadow-lg rounded-md cursor-pointer w-5/6 sm:w-full sm:max-w-3xl flex justify-center items-center py-3 h-full text-sm sm:text-[1rem] text-center font-semibold text-black m-auto sm:hover:bg-gray-300 bg-[#fff]" class="shadow-lg rounded-md cursor-pointer w-5/6 sm:w-full flex justify-center items-center py-3 h-full text-sm sm:text-[1rem] text-center font-semibold text-black m-auto sm:hover:bg-gray-300 bg-[#fff]"
> >
Load More News Load More News
</label> </label>

View File

@ -1339,10 +1339,9 @@
class="mt-6 flex flex-col lg:flex-row gap-x-14 items-start w-full justify-between" class="mt-6 flex flex-col lg:flex-row gap-x-14 items-start w-full justify-between"
> >
<div <div
class="lg:space-y-6 lg:order-2 lg:pt-1 sm:pl-7 lg:pl-0 w-full lg:w-[45%] sm:ml-auto" class="lg:space-y-6 lg:order-2 lg:pt-1 sm:pl-7 lg:pl-0 w-full lg:w-[45%] sm:ml-auto max-w-[400px]"
> >
<Sidecard {data} /> <Sidecard {data} />
<div class="lg:sticky lg:top-20"></div>
</div> </div>
<div class="w-full lg:w-[65%] 2xl:w-[70%]"> <div class="w-full lg:w-[65%] 2xl:w-[70%]">