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
"China",
"Canada",
"UK",
"United Kingdom",
"Japan",
"Israel",
"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 () => {
let output;
// Get cached data for the specific tickerID
const cachedData = getCache('', 'getUKStocksUS');
const cachedData = getCache("", "getUKStocksUS");
if (cachedData) {
output = cachedData;
} else {
const{ apiURL, apiKey} = await parent();
const postData = {'filterList': 'UK'}
const { apiURL, apiKey } = await parent();
const response = await fetch(apiURL + '/filter-stock-list', {
method: 'POST',
const postData = { filterList: "GB" };
const response = await fetch(apiURL + "/filter-stock-list", {
method: "POST",
headers: {
"Content-Type": "application/json", "X-API-KEY": apiKey
"Content-Type": "application/json",
"X-API-KEY": apiKey,
},
body: JSON.stringify(postData),
});
output = await response.json();
setCache('', output, 'getUKStocksUS');
setCache("", output, "getUKStocksUS");
}
return output;
@ -34,6 +32,6 @@ export const load = async ({parent}) => {
// Make sure to return a promise
return {
getUKStocksUS: await getUKStocksUS()
getUKStocksUS: await getUKStocksUS(),
};
};
};

View File

@ -824,19 +824,18 @@ function handleInput(event) {
</div>
</DropdownMenu.Label>
{: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="">
<input bind:value={searchQuery}
on:input={handleInput}
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"
ref={(node) => node?.focus()}
type="search"
placeholder="Search...">
</div>
{/if}
<DropdownMenu.Group class="min-h-10">
<DropdownMenu.Group class="min-h-10 mt-2">
{#if row?.rule !== 'country'}
{#each row?.step as newValue}
<DropdownMenu.Item class="sm:hover:bg-[#27272A]">
@ -850,9 +849,12 @@ function handleInput(event) {
{:else}
{#each (testList.length > 0 && searchQuery?.length > 0 ? testList : searchQuery?.length > 0 && testList?.length === 0 ? [] : listOfRelevantCountries) as item}
<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">
{item}
</button>
<div class="flex items-center">
<label on:click={() => {handleChangeValue(item)}} class="text-white" for={item}>
<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>
{/each}