bugfixing

This commit is contained in:
MuslemRahimi 2024-09-05 23:35:46 +02:00
parent 794b2fe306
commit c1386f0015
3 changed files with 23 additions and 23 deletions

View File

@ -997,7 +997,7 @@ export const listOfRelevantCountries = [
"United States", // By far the most companies listed on the NYSE "United States", // By far the most companies listed on the NYSE
"China", "China",
"Canada", "Canada",
"UK", "United Kingdom",
"Japan", "Japan",
"Israel", "Israel",
"Brazil", "Brazil",

View File

@ -1,32 +1,30 @@
import { getCache, setCache } from '$lib/store'; import { getCache, setCache } from "$lib/store";
export const load = async ({ parent }) => {
export const load = async ({parent}) => {
const getUKStocksUS = async () => { const getUKStocksUS = async () => {
let output; let output;
// Get cached data for the specific tickerID // Get cached data for the specific tickerID
const cachedData = getCache('', 'getUKStocksUS'); const cachedData = getCache("", "getUKStocksUS");
if (cachedData) { if (cachedData) {
output = cachedData; output = cachedData;
} else { } else {
const { apiURL, apiKey } = await parent();
const{ apiURL, apiKey} = await parent();
const postData = {'filterList': 'UK'}
const response = await fetch(apiURL + '/filter-stock-list', { const postData = { filterList: "GB" };
method: 'POST',
const response = await fetch(apiURL + "/filter-stock-list", {
method: "POST",
headers: { headers: {
"Content-Type": "application/json", "X-API-KEY": apiKey "Content-Type": "application/json",
"X-API-KEY": apiKey,
}, },
body: JSON.stringify(postData), body: JSON.stringify(postData),
}); });
output = await response.json(); output = await response.json();
setCache('', output, 'getUKStocksUS'); setCache("", output, "getUKStocksUS");
} }
return output; return output;
@ -34,6 +32,6 @@ export const load = async ({parent}) => {
// Make sure to return a promise // Make sure to return a promise
return { return {
getUKStocksUS: await getUKStocksUS() getUKStocksUS: await getUKStocksUS(),
}; };
}; };

View File

@ -824,19 +824,18 @@ function handleInput(event) {
</div> </div>
</DropdownMenu.Label> </DropdownMenu.Label>
{:else} {:else}
<div class="relative z-40 focus:outline-none top-0 " <div class="relative sticky z-40 focus:outline-none -top-1"
tabindex="0" role="menu" style=""> tabindex="0" role="menu" style="">
<input bind:value={searchQuery} <input bind:value={searchQuery}
on:input={handleInput} on:input={handleInput}
autocomplete="off" autocomplete="off"
class="absolute fixed sticky top-0 w-full border-0 bg-[#09090B] border-b border-gray-200 class="absolute fixed sticky w-full border-0 bg-[#09090B] border-b border-gray-200
focus:border-gray-200 focus:ring-0 text-white placeholder:text-gray-300" focus:border-gray-200 focus:ring-0 text-white placeholder:text-gray-300"
ref={(node) => node?.focus()}
type="search" type="search"
placeholder="Search..."> placeholder="Search...">
</div> </div>
{/if} {/if}
<DropdownMenu.Group class="min-h-10"> <DropdownMenu.Group class="min-h-10 mt-2">
{#if row?.rule !== 'country'} {#if row?.rule !== 'country'}
{#each row?.step as newValue} {#each row?.step as newValue}
<DropdownMenu.Item class="sm:hover:bg-[#27272A]"> <DropdownMenu.Item class="sm:hover:bg-[#27272A]">
@ -850,9 +849,12 @@ function handleInput(event) {
{:else} {:else}
{#each (testList.length > 0 && searchQuery?.length > 0 ? testList : searchQuery?.length > 0 && testList?.length === 0 ? [] : listOfRelevantCountries) as item} {#each (testList.length > 0 && searchQuery?.length > 0 ? testList : searchQuery?.length > 0 && testList?.length === 0 ? [] : listOfRelevantCountries) as item}
<DropdownMenu.Item class="sm:hover:bg-[#27272A]"> <DropdownMenu.Item class="sm:hover:bg-[#27272A]">
<button on:click={() => {handleChangeValue(item)}} class="block w-full border-b border-gray-600 px-4 py-1.5 text-left text-sm sm:text-[1rem] rounded text-white last:border-0 sm:hover:bg-[#27272A] focus:bg-blue-100 focus:text-gray-900 focus:outline-none"> <div class="flex items-center">
{item} <label on:click={() => {handleChangeValue(item)}} class="text-white" for={item}>
</button> <input type="checkbox" checked={ruleOfList?.some(rule => rule?.value === item)} class="h-4 w-4 rounded bg-dark-500 border border-gray-500 text-blue-600 focus:ring-blue-500" id={item}>
<span class="ml-2">{item}</span>
</label>
</div>
</DropdownMenu.Item> </DropdownMenu.Item>
{/each} {/each}