update similar ticker component

This commit is contained in:
MuslemRahimi 2024-08-02 15:21:34 +02:00
parent 4d0ecf5e3f
commit 184b437f56
2 changed files with 5 additions and 8 deletions

View File

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import {stockTicker, similarTickerClicked, screenWidth} from '$lib/store'; import {similarTickerClicked, screenWidth} from '$lib/store';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { abbreviateNumber } from '$lib/utils'; import { abbreviateNumber } from '$lib/utils';
@ -9,12 +9,12 @@ export let similarstock;
async function stockSelector(state) async function stockSelector(symbol)
{ {
window?.scroll({ top: 0, left: 0, behavior: 'smooth' }); window?.scroll({ top: 0, left: 0, behavior: 'smooth' });
stockTicker.update(value => state); //stockTicker.update(value => symbol);
$similarTickerClicked = true; $similarTickerClicked = true;
goto("/stocks/"+state+"/") goto("/stocks/"+symbol)
} }
@ -34,8 +34,7 @@ export let similarstock;
</h2> </h2>
{#if similarstock?.length !== 0} {#if similarstock?.length !== 0}
<div class="flex justify-start items-center w-full m-auto "> <div class="flex justify-start items-center w-full m-auto ">
<table class="table table-sm table-compact mt-3 text-start flex justify-start items-center w-full px-3 m-auto"> <table class="table table-sm table-compact mt-3 text-start flex justify-start items-center w-full px-3 m-auto">
<thead> <thead>

View File

@ -24,10 +24,8 @@ import { displayCompanyName, stockTicker, assetType, isOpen, isAfterMarketClose,
export const load = async ({ params, data }) => { export const load = async ({ params, data }) => {
stockTicker.update( value => params.tickerID?.toUpperCase()); stockTicker.update( value => params.tickerID?.toUpperCase());
assetType.update( value => 'stock'); assetType.update( value => 'stock');
displayCompanyName.update(value => data?.companyName) displayCompanyName.update(value => data?.companyName)
await checkMarketHour(); await checkMarketHour();