refactor hedge fund page
This commit is contained in:
parent
9ea2ceae99
commit
7aca116da6
@ -1,4 +1,4 @@
|
||||
export const load = async ({ locals, setHeaders }) => {
|
||||
export const load = async ({ locals }) => {
|
||||
const getAllHedgeFunds = async () => {
|
||||
const { apiURL, apiKey } = locals;
|
||||
const response = await fetch(apiURL + "/all-hedge-funds", {
|
||||
@ -10,7 +10,6 @@ export const load = async ({ locals, setHeaders }) => {
|
||||
});
|
||||
|
||||
const output = await response.json();
|
||||
setHeaders({ "cache-control": "public, max-age=3000" });
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import cardBackground from "$lib/images/bg-hedge-funds.png";
|
||||
|
||||
import { numberOfUnreadNotification } from "$lib/store";
|
||||
import { abbreviateNumber } from "$lib/utils";
|
||||
import { abbreviateNumber, formatString } from "$lib/utils";
|
||||
import { onMount } from "svelte";
|
||||
// import * as XLSX from 'xlsx';
|
||||
|
||||
@ -14,8 +14,6 @@
|
||||
let displayList = rawData?.slice(0, 20) ?? [];
|
||||
let filterQuery = "";
|
||||
|
||||
let isLoaded = true;
|
||||
|
||||
async function handleScroll() {
|
||||
const scrollThreshold = document.body.offsetHeight * 0.8; // 80% of the website height
|
||||
const isBottom = window.innerHeight + window.scrollY >= scrollThreshold;
|
||||
@ -191,7 +189,7 @@
|
||||
<span
|
||||
class="text-white text-md font-semibold mt-2 mb-2 w-64 text-center"
|
||||
>
|
||||
{item?.name}
|
||||
{formatString(item?.name)}
|
||||
</span>
|
||||
<span class="text-white text-md mb-8">
|
||||
AUM: {abbreviateNumber(item?.marketValue, true)}
|
||||
|
||||
@ -11,8 +11,6 @@
|
||||
let stockList = rawData?.slice(0, 50) ?? [];
|
||||
let companyName = data?.getHedgeFundsData?.name ?? "Company Data";
|
||||
|
||||
let analystName = hedgeFundStats?.analystName;
|
||||
|
||||
async function handleScroll() {
|
||||
const scrollThreshold = document.body.offsetHeight * 0.8; // 80% of the website height
|
||||
const isBottom = window.innerHeight + window.scrollY >= scrollThreshold;
|
||||
@ -273,13 +271,33 @@
|
||||
>
|
||||
<div class="flex flex-col sm:flex-row">
|
||||
<div class="mb-2 font-semibold sm:mb-0">Main Sectors:</div>
|
||||
<div class="flex flex-wrap gap-x-2 gap-y-px sm:ml-2"></div>
|
||||
<div class="flex flex-wrap gap-x-2 gap-y-px sm:ml-2">
|
||||
{#each data?.getHedgeFundsData?.mainSectors as item}
|
||||
<a
|
||||
href={sectorNavigation?.find(
|
||||
(listItem) => listItem?.title === item,
|
||||
)?.link}
|
||||
class="px-3 text-sm py-1 sm:text-[1rem] rounded-lg bg-white bg-opacity-[0.1] sm:hover:bg-opacity-[0.2] ml-0"
|
||||
>
|
||||
{item}
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col sm:flex-row">
|
||||
<div class="mb-2 whitespace-nowrap font-semibold sm:mb-0">
|
||||
Top Industries:
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-x-2 gap-y-3 sm:ml-2"></div>
|
||||
<div class="flex flex-wrap gap-x-2 gap-y-3 sm:ml-2">
|
||||
{#each data?.getHedgeFundsData?.mainIndustries as item}
|
||||
<a
|
||||
href={`/list/industry/${item?.replace(/ /g, "-")?.replace(/&/g, "and")?.replace(/-{2,}/g, "-")?.toLowerCase()}`}
|
||||
class="px-3 text-sm py-1 sm:text-[1rem] rounded-lg bg-white bg-opacity-[0.1] sm:hover:bg-opacity-[0.2] ml-0"
|
||||
>
|
||||
{item}
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user