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