fix tables
This commit is contained in:
parent
52241ab520
commit
dded5ba854
@ -8,6 +8,7 @@
|
|||||||
} from "$lib/utils";
|
} from "$lib/utils";
|
||||||
|
|
||||||
import { goto } from "$app/navigation";
|
import { goto } from "$app/navigation";
|
||||||
|
import HoverStockChart from "$lib/components/HoverStockChart.svelte";
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
@ -62,7 +63,7 @@
|
|||||||
website = info?.website;
|
website = info?.website;
|
||||||
|
|
||||||
totalAssetPercentage = topHoldingList
|
totalAssetPercentage = topHoldingList
|
||||||
?.slice(0, 5)
|
?.slice(0, 10)
|
||||||
?.reduce((acc, current) => acc + current?.weightPercentage, 0)
|
?.reduce((acc, current) => acc + current?.weightPercentage, 0)
|
||||||
?.toFixed(2);
|
?.toFixed(2);
|
||||||
}
|
}
|
||||||
@ -117,31 +118,24 @@
|
|||||||
<div class="h-auto w-full">
|
<div class="h-auto w-full">
|
||||||
<!--Start Content-->
|
<!--Start Content-->
|
||||||
<div class="w-auto lg:w-full flex flex-col m-auto">
|
<div class="w-auto lg:w-full flex flex-col m-auto">
|
||||||
<h2
|
<h2 class="mb-2 text-2xl text-white flex flex-row items-center">
|
||||||
class="mb-2 text-2xl text-white font-semibold flex flex-row items-center"
|
<span class="font-bold">Top Sectors</span>
|
||||||
>
|
|
||||||
<span>Top Sectors</span>
|
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="mt-2 w-full overflow-hidden">
|
<div class="mt-2 w-full overflow-hidden">
|
||||||
<table class="w-full table table-sm table table-compact w-full">
|
<table class="w-full text-white">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr class="border-y border-gray-800">
|
||||||
<th
|
<th class="px-1 py-1.5 text-left xs:px-2">Sector</th>
|
||||||
class="text-white font-semibold text-sm text-start bg-default"
|
|
||||||
>Sector</th
|
|
||||||
>
|
|
||||||
|
|
||||||
<th class="text-white font-semibold text-sm text-end bg-default"
|
<th class="px-1 py-1.5 text-right xs:px-2">Weight %</th>
|
||||||
>Weight %</th
|
|
||||||
>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each topSectorList as item}
|
{#each topSectorList as item}
|
||||||
{#if item?.weightPercentage > 0}
|
{#if item?.weightPercentage > 0}
|
||||||
<tr class="text-white border-b border-[#27272A]">
|
<tr class="text-white border-b border-[#27272A]">
|
||||||
<td class="text-start text-sm sm:text-[1rem]">
|
<td class="px-1 py-1.5 text-left xs:px-2">
|
||||||
<a
|
<a
|
||||||
href={sectorNavigation?.find(
|
href={sectorNavigation?.find(
|
||||||
(listItem) => listItem?.title === item?.sector,
|
(listItem) => listItem?.title === item?.sector,
|
||||||
@ -152,7 +146,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="text-white font-semibold text-end">
|
<td class="px-1 py-1.5 text-right xs:px-2">
|
||||||
{abbreviateNumber(item?.weightPercentage?.toFixed(2))}%
|
{abbreviateNumber(item?.weightPercentage?.toFixed(2))}%
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -182,59 +176,44 @@
|
|||||||
<div class="h-auto w-full">
|
<div class="h-auto w-full">
|
||||||
<!--Start Content-->
|
<!--Start Content-->
|
||||||
<div class="w-auto lg:w-full flex flex-col m-auto">
|
<div class="w-auto lg:w-full flex flex-col m-auto">
|
||||||
<h2
|
<h2 class="mb-2 text-2xl text-white flex flex-row items-center">
|
||||||
class="mb-2 text-2xl text-white font-semibold flex flex-row items-center"
|
<span class="font-bold">Top 10 Holdings</span>
|
||||||
>
|
|
||||||
<span>Top Holdings</span>
|
|
||||||
<span class="text-white font-semibold ml-auto text-sm">
|
<span class="text-white font-semibold ml-auto text-sm">
|
||||||
{totalAssetPercentage}% of assets
|
{totalAssetPercentage}% of assets
|
||||||
</span>
|
</span>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="mt-2 w-full">
|
<div class="mt-2 w-full">
|
||||||
<table class="table table-sm table-compact w-full">
|
<table class="w-full text-white">
|
||||||
<thead>
|
<thead
|
||||||
<tr>
|
><tr class="border-y border-gray-800"
|
||||||
<th
|
><th class="px-1 py-1.5 text-left xs:px-2">Name</th>
|
||||||
class="text-white font-semibold text-sm text-start bg-default"
|
<th class="px-1 py-1.5 text-left xs:px-2">Symbol</th>
|
||||||
>Company</th
|
<th class="px-1 py-1.5 text-right xs:px-2">Weight</th></tr
|
||||||
|
></thead
|
||||||
>
|
>
|
||||||
|
|
||||||
<th class="text-white font-semibold text-sm text-end bg-default"
|
|
||||||
>Portfolio</th
|
|
||||||
>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each topHoldingList?.slice(0, 5) as item}
|
{#each topHoldingList?.slice(0, 10) as item}
|
||||||
{#if item?.symbol !== null}
|
{#if item?.symbol !== null}
|
||||||
<tr
|
<tr
|
||||||
on:click={() => stockSelector(item?.symbol)}
|
on:click={() => stockSelector(item?.symbol)}
|
||||||
class="lg:shake-ticker sm:hover:text-white text-blue-400 cursor-pointer lg:hover:bg-[#245073] lg:hover:bg-opacity-[0.2] [#09090B] border-b border-[#27272A]"
|
class="cursor-pointer lg:hover:bg-[#245073] lg:hover:bg-opacity-[0.2] [#09090B] border-b border-[#27272A]"
|
||||||
>
|
>
|
||||||
<td class="">
|
<td class="px-1 py-1.5 text-left xs:px-2">
|
||||||
<div class="flex flex-row items-center">
|
|
||||||
<div class="flex flex-col w-full">
|
|
||||||
<span class="text-sm font-medium"
|
|
||||||
>{item?.symbol ?? "n/a"}</span
|
|
||||||
>
|
|
||||||
<span class="text-white text-sm">
|
|
||||||
{#if typeof item?.name !== "undefined"}
|
{#if typeof item?.name !== "undefined"}
|
||||||
{item?.name?.length > 20
|
{item?.name?.length > 20
|
||||||
? formatString(item?.name?.slice(0, 20)) + "..."
|
? formatString(item?.name?.slice(0, 20)) + "..."
|
||||||
: formatString(item?.name)?.replace(
|
: formatString(item?.name)?.replace("Usd", "USD")}
|
||||||
"Usd",
|
|
||||||
"USD",
|
|
||||||
)}
|
|
||||||
{:else}
|
{:else}
|
||||||
n/a
|
n/a
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="text-white font-semibold text-end">
|
<td class="px-1 py-1.5 text-left xs:px-2">
|
||||||
|
<HoverStockChart symbol={item?.symbol} />
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="px-1 py-1.5 text-right xs:px-2">
|
||||||
{abbreviateNumber(item?.weightPercentage?.toFixed(2))}%
|
{abbreviateNumber(item?.weightPercentage?.toFixed(2))}%
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -248,7 +227,7 @@
|
|||||||
href={`/etf/${$etfTicker}/holdings`}
|
href={`/etf/${$etfTicker}/holdings`}
|
||||||
class="rounded cursor-pointer w-full m-auto py-2 h-full mt-6 text-[1rem] text-center font-semibold text-black sm:hover:hover:bg-gray-300 bg-[#ffff] transition duration-100"
|
class="rounded cursor-pointer w-full m-auto py-2 h-full mt-6 text-[1rem] text-center font-semibold text-black sm:hover:hover:bg-gray-300 bg-[#ffff] transition duration-100"
|
||||||
>
|
>
|
||||||
All Holdings
|
View More Holdings
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -265,36 +244,27 @@
|
|||||||
<div class="h-auto w-full">
|
<div class="h-auto w-full">
|
||||||
<!--Start Content-->
|
<!--Start Content-->
|
||||||
<div class="w-auto lg:w-full flex flex-col m-auto">
|
<div class="w-auto lg:w-full flex flex-col m-auto">
|
||||||
<h2
|
<h2 class="mb-2 text-2xl text-white flex flex-row items-center">
|
||||||
class="mb-2 text-2xl text-white font-semibold flex flex-row items-center"
|
<span class="font-bold">Dividends</span>
|
||||||
>
|
|
||||||
<span>Dividends</span>
|
|
||||||
<span class="text-white font-semibold ml-auto text-sm">
|
<span class="text-white font-semibold ml-auto text-sm">
|
||||||
Dividend Yield {dividendYield ?? "0"}%
|
Dividend Yield {dividendYield ?? "0"}%
|
||||||
</span>
|
</span>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="mt-2 w-full">
|
<div class="mt-2 w-full">
|
||||||
<table class="table table-sm table-compact text-start flex w-full">
|
<table class="w-full text-white">
|
||||||
<thead>
|
<thead
|
||||||
<tr>
|
><tr class="border-y border-gray-800"
|
||||||
<th
|
><th class="px-1 py-1.5 text-left xs:px-2">Ex-Dividend</th>
|
||||||
class="text-white font-semibold text-sm text-start bg-default"
|
<th class="px-1 py-1.5 text-left xs:px-2">Amount</th>
|
||||||
>Ex-Dividend</th
|
<th class="px-1 py-1.5 text-right xs:px-2">Payment Date</th></tr
|
||||||
|
></thead
|
||||||
>
|
>
|
||||||
<th class="text-white font-semibold text-sm text-end bg-default"
|
|
||||||
>Payment Date</th
|
|
||||||
>
|
|
||||||
<th class="text-white font-semibold text-sm text-end bg-default"
|
|
||||||
>Amount</th
|
|
||||||
>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each dividendHistoryList?.slice(0, 5) as item}
|
{#each dividendHistoryList?.slice(0, 5) as item}
|
||||||
<tr class="text-white bg-default border-b border-[#27272A]">
|
<tr class="text-white bg-default border-b border-[#27272A]">
|
||||||
<td class="text-start text-sm text-white font-medium">
|
<td class="px-1 py-1.5 text-left xs:px-2">
|
||||||
{new Date(item?.date)?.toLocaleString("en-US", {
|
{new Date(item?.date)?.toLocaleString("en-US", {
|
||||||
month: "short",
|
month: "short",
|
||||||
day: "numeric",
|
day: "numeric",
|
||||||
@ -303,7 +273,11 @@
|
|||||||
})}
|
})}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="text-end text-sm text-white font-medium">
|
<td class="px-1 py-1.5 text-left xs:px-2">
|
||||||
|
${item?.adjDividend?.toFixed(4)}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="px-1 py-1.5 text-right xs:px-2">
|
||||||
{item?.paymentDate?.length !== 0
|
{item?.paymentDate?.length !== 0
|
||||||
? new Date(item?.paymentDate)?.toLocaleString("en-US", {
|
? new Date(item?.paymentDate)?.toLocaleString("en-US", {
|
||||||
month: "short",
|
month: "short",
|
||||||
@ -313,10 +287,6 @@
|
|||||||
})
|
})
|
||||||
: "n/a"}
|
: "n/a"}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="text-end text-sm text-white font-medium">
|
|
||||||
${item?.adjDividend?.toFixed(2)}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@ -799,6 +799,7 @@
|
|||||||
<DropdownMenu.Trigger asChild let:builder>
|
<DropdownMenu.Trigger asChild let:builder>
|
||||||
<Button
|
<Button
|
||||||
size="icon"
|
size="icon"
|
||||||
|
aria-label="Settings"
|
||||||
class="overflow-hidden rounded-md bg-default sm:hover:bg-primary border border-gray-600 w-10 h-10"
|
class="overflow-hidden rounded-md bg-default sm:hover:bg-primary border border-gray-600 w-10 h-10"
|
||||||
builders={[builder]}
|
builders={[builder]}
|
||||||
>
|
>
|
||||||
@ -842,6 +843,7 @@
|
|||||||
<form class="cursor-pointer" action="/logout" method="POST">
|
<form class="cursor-pointer" action="/logout" method="POST">
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
|
aria-label="Logout"
|
||||||
class="w-full text-start cursor-pointer"
|
class="w-full text-start cursor-pointer"
|
||||||
>
|
>
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user