lazy loading stock splits

This commit is contained in:
MuslemRahimi 2024-07-27 09:22:13 +02:00
parent d431683e8b
commit 0ed2a92497

View File

@ -45,13 +45,7 @@
onMount(async() => {
if (chart) {
chart.timeScale().fitContent();
}
WIIM = (await import('$lib/components/WIIM.svelte')).default;
StockSplits = (await import('$lib/components/StockSplits.svelte')).default;
})
@ -61,7 +55,6 @@
//==========================//
$: {
@ -903,7 +896,6 @@ function changeChartType() {
</h2>
{:else}
<div class="chart-container">
<Chart {...options} autoSize={true} ref={(ref) => chart = ref} on:crosshairMove={handleCrosshairMove} >
{#if displayData === '1D'}
@ -1123,7 +1115,6 @@ function changeChartType() {
{/if}
</Chart>
</div>
{/if}
</div>
@ -1432,14 +1423,14 @@ function changeChartType() {
<!--Start DCF -->
<!--
<Lazy>
<div class="w-full pt-10 sm:pl-6 sm:pb-6 sm:pt-6 m-auto {!$dcfComponent ? 'hidden' : ''}">
{#await import('$lib/components/DCF.svelte') then {default: Comp}}
<svelte:component this={Comp} data={data}/>
{/await}
</div>
<!--End DCF-->
</Lazy>
<!--
<div class="w-full m-auto pt-10 sm:pl-6 sm:pb-6 sm:pt-6 {!$correlationComponent ? 'hidden' : ''}">
@ -1449,15 +1440,13 @@ function changeChartType() {
</div>
-->
<!--Start Stock Splits-->
{#if StockSplits && stockDeck?.at(0)?.stockSplits?.length !== 0}
<div class="w-full pt-10 sm:pl-6 sm:pb-6 sm:pt-6 m-auto rounded-2xl mb-10">
<StockSplits
stockDeck={stockDeck}
/>
<Lazy>
<div class="w-full pt-10 sm:pl-6 sm:pb-6 sm:pt-6 m-auto {stockDeck?.at(0)?.stockSplits?.length === 0 ? 'hidden' : ''}">
{#await import('$lib/components/StockSplits.svelte') then {default: Comp}}
<svelte:component this={Comp} stockDeck={stockDeck}/>
{/await}
</div>
{/if}
<!--End Stock Splits-->
</Lazy>
@ -1480,12 +1469,6 @@ function changeChartType() {
<style lang='scss'>
.chart-container {
width: 100%;
height: 350px;
min-height: 300px;
display: block; /* Ensures the container is visible */
}
canvas {
width: 100%;