frontend/src/routes/+page.svelte
MuslemRahimi e166bb7d19 ui fixes
2024-12-10 10:44:01 +01:00

821 lines
35 KiB
Svelte

<svelte:options immutable={true} />
<script lang="ts">
import { onMount } from "svelte";
import * as Card from "$lib/components/shadcn/card/index.ts";
import * as Table from "$lib/components/shadcn/table/index.ts";
import ArrowUpRight from "lucide-svelte/icons/arrow-up-right";
import { abbreviateNumber } from "$lib/utils";
import * as Tabs from "$lib/components/shadcn/tabs/index.js";
import HoverStockChart from "$lib/components/HoverStockChart.svelte";
import { screenWidth, numberOfUnreadNotification } from "$lib/store";
import { compareTimes, formatTime } from "$lib/utils";
export let data;
let optionsMode = "premium";
function reformatDate(dateString) {
return (
dateString.substring(5, 7) +
"/" +
dateString.substring(8) +
"/" +
dateString.substring(2, 4)
);
}
let optionsTable = data?.getDashboard?.optionsFlow?.premium || [];
let gainersList = data?.getDashboard?.marketMovers?.gainers || [];
let losersList = data?.getDashboard?.marketMovers?.losers || [];
let marketStatus = data?.getDashboard?.marketStatus ?? 0;
let analystReport = data?.getDashboard?.analystReport || {};
function changeTable(state) {
optionsMode = state;
if (optionsMode === "premium") {
optionsTable = data?.getDashboard?.optionsFlow?.premium || [];
} else if (optionsMode === "volume") {
optionsTable = data?.getDashboard?.optionsFlow?.volume || [];
} else {
optionsTable = data?.getDashboard?.optionsFlow?.openInterest || [];
}
}
let Feedback;
onMount(async () => {
Feedback = (await import("$lib/components/Feedback.svelte")).default;
});
$: charNumber = $screenWidth < 640 ? 20 : 15;
</script>
<svelte:head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>
{$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Stocknear
- Free Online Stock Analysis for Investors
</title>
<meta
name="description"
content="Stocknear has everything you need to analyze stocks with help of AI, including detailed financial data, statistics, news and charts."
/>
<!-- Other meta tags -->
<meta
property="og:title"
content="Stocknear - Free Online Stock Analysis for Investors"
/>
<meta
property="og:description"
content="Stocknear has everything you need to analyze stocks with help of AI, including detailed financial data, statistics, news and charts."
/>
<meta property="og:type" content="website" />
<!-- Add more Open Graph meta tags as needed -->
<!-- Twitter specific meta tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta
name="twitter:title"
content="Stocknear - Free Online Stock Analysis for Investors"
/>
<meta
name="twitter:description"
content="Stocknear has everything you need to analyze stocks with help of AI, including detailed financial data, statistics, news and charts."
/>
<!-- Add more Twitter meta tags as needed -->
</svelte:head>
<div
class="w-full xl:max-w-screen-2xl overflow-hidden m-auto min-h-screen bg-[#09090B] mb-40"
>
{#if data?.user?.tier !== "Pro" || data?.user?.freeTrial === true}
<div
class="mb-5 relative isolate sm:rounded text-center flex justify-center items-center gap-x-6 overflow-hidden bg-[#FFC233] px-6 py-3.5 sm:py-2.5 sm:px-3.5 sm:before:flex-1"
>
<div
class="absolute left-[max(-7rem,calc(50%-52rem))] top-1/2 -z-10 -translate-y-1/2 transform-gpu blur-2xl"
aria-hidden="true"
>
<div
class="aspect-[577/310] w-[36.0625rem] bg-gradient-to-r from-[#ff80b5] to-[#9089fc] opacity-30"
style="clip-path: polygon(74.8% 41.9%, 97.2% 73.2%, 100% 34.9%, 92.5% 0.4%, 87.5% 0%, 75% 28.6%, 58.5% 54.6%, 50.1% 56.8%, 46.9% 44%, 48.3% 17.4%, 24.7% 53.9%, 0% 27.9%, 11.9% 74.2%, 24.9% 54.1%, 68.6% 100%, 74.8% 41.9%)"
></div>
</div>
<div
class="absolute left-[max(45rem,calc(50%+8rem))] top-1/2 -z-10 -translate-y-1/2 transform-gpu blur-2xl"
aria-hidden="true"
>
<div
class="aspect-[577/310] w-[36.0625rem] bg-gradient-to-r from-[#ff80b5] to-[#9089fc] opacity-30"
style="clip-path: polygon(74.8% 41.9%, 97.2% 73.2%, 100% 34.9%, 92.5% 0.4%, 87.5% 0%, 75% 28.6%, 58.5% 54.6%, 50.1% 56.8%, 46.9% 44%, 48.3% 17.4%, 24.7% 53.9%, 0% 27.9%, 11.9% 74.2%, 24.9% 54.1%, 68.6% 100%, 74.8% 41.9%)"
></div>
</div>
<div
class="w-full m-auto flex flex-col sm:flex-row justify-center items-center gap-x-4 gap-y-2"
>
<p
class="text-md text-black font-semibold flex flex-col sm:flex-row items-center"
>
<!--<span class="text-black font-bold">Last Chance</span><svg
viewBox="0 0 2 2"
class="mx-2 inline h-0.5 w-0.5 fill-current hidden sm:inline-block"
aria-hidden="true"><circle cx="1" cy="1" r="1" /></svg
>-->
The Lifetime Deal officially ends permanently this Friday at 12:00 AM (CET).
</p>
<a
href="/pricing"
class="flex-none rounded-full m-auto sm:m-0 px-3.5 py-1 text-[1rem] font-semibold text-black shadow-sm sm:hover:bg-gray-100 bg-[#fff] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900"
>
Get Lifetime
</a>
</div>
</div>
{/if}
<div class="flex flex-col m-auto justify-center items-center">
<div class="text-center mb-10 w-full px-4 sm:px-3 mt-10">
{#if Feedback}
<Feedback {data} />
{/if}
<!--
<div class="text-center mb-10 relative w-fit flex justify-center m-auto">
<a
href="/insider-tracker"
class="text-white antialiased bg-primary w-full px-4 py-2 rounded m-auto font-medium text-[1rem] flex items-center"
>
<span class="text-white sm:hover:text-blue-400"
>Realtime Insider Tracker</span
>
</a>
<div class="absolute top-[-1.2rem] -right-5 sm:-right-8 rotate-[7deg]">
<span
class="bg-[#fff] text-black text-sm sm:text-[0.9rem] rounded font-semibold sm:me-2 px-2.5 py-0.5 rounded dark:bg-red-900 dark:text-red-300"
>
New
</span>
</div>
</div>
-->
<h1
class="hidden sm:block text-3xl lg:text-4xl text-white font-bold text-center mb-10 relative w-fit flex justify-center m-auto"
>
Clear & <span class="italic text-[#fff]">Simple</span> Market Insight.
</h1>
<h2
class="text-white text-2xl font-semibold text-start w-full pb-4 sm:pl-4 sm:pb-2"
>
Dashboard
</h2>
<main class="flex flex-1 flex-col gap-4 sm:p-4 md:gap-8">
<div class="grid gap-4 md:gap-8 grid-cols-1 lg:grid-cols-2 text-start">
<Card.Root
class="order-1 sm:order-2 overflow-x-scroll overflow-hidden overflow-y-auto no-scrollbar max-h-[450px]"
>
<Card.Header class="flex flex-row items-center">
<div class="flex flex-col items-start w-full">
<div class="flex flex-row w-full items-center">
<Card.Title
><a
href={`/market-mover/${marketStatus === 0 ? "gainers" : marketStatus === 1 ? "premarket/gainers" : "afterhours/gainers"}`}
class="text-xl sm:text-2xl tex-white font-semibold cursor-pointer sm:hover:underline sm:hover:underline-offset-4"
>
{marketStatus === 0
? "Top"
: marketStatus === 1
? "Pre-Market"
: "Afterhours"} Gainers
<svg
class="h-5 w-5 inline-block"
viewBox="0 0 20 20"
fill="currentColor"
style="max-width:40px"
aria-hidden="true"
><path
fill-rule="evenodd"
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
clip-rule="evenodd"
></path></svg
></a
>
</Card.Title>
</div>
</div>
</Card.Header>
<Card.Content>
<Table.Root class="overflow-x-scroll w-full">
<Table.Header>
<Table.Row>
<Table.Head class="text-white font-semibold"
>Symbol</Table.Head
>
<Table.Head
class="hidden sm:table-cell text-white font-semibold"
>Name</Table.Head
>
<Table.Head class="text-white text-right font-semibold"
>Price</Table.Head
>
<Table.Head class="text-white text-right font-semibold"
>Change</Table.Head
>
<Table.Head
class="text-white text-right font-semibold whitespace-nowrap"
>Market Cap</Table.Head
>
</Table.Row>
</Table.Header>
<Table.Body>
{#each gainersList as item}
<Table.Row>
<Table.Cell class="text-sm sm:text-[1rem]">
<HoverStockChart symbol={item?.symbol} />
</Table.Cell>
<Table.Cell
class="hidden sm:table-cell xl:table.-column text-sm sm:text-[1rem]"
>
{item?.name?.length > charNumber
? item?.name?.slice(0, charNumber) + "..."
: item?.name}
</Table.Cell>
<Table.Cell
class="text-right xl:table.-column text-sm sm:text-[1rem]"
>
{item?.price?.toFixed(2)}
</Table.Cell>
<Table.Cell
class="text-right md:table.-cell xl:table.-column text-sm sm:text-[1rem] text-white"
>
{#if item?.changesPercentage >= 0}
<span class="text-[#00FC50]"
>+{item?.changesPercentage >= 1000
? abbreviateNumber(item?.changesPercentage)
: item?.changesPercentage?.toFixed(2)}%</span
>
{:else}
<span class="text-[#FF2F1F]"
>{item?.changesPercentage <= -1000
? abbreviateNumber(item?.changesPercentage)
: item?.changesPercentage?.toFixed(2)}%
</span>
{/if}
</Table.Cell>
<Table.Cell
class="text-right xl:table.-column text-sm sm:text-[1rem]"
>
{abbreviateNumber(item?.marketCap)}
</Table.Cell>
</Table.Row>
{/each}
</Table.Body>
</Table.Root>
</Card.Content>
</Card.Root>
<Card.Root
class="order-1 sm:order-2 overflow-x-scroll overflow-hidden overflow-y-auto no-scrollbar max-h-[450px]"
>
<Card.Header class="flex flex-row items-center">
<div class="flex flex-col items-start w-full">
<div class="flex flex-row w-full items-center">
<Card.Title>
<a
href={`/market-mover/${marketStatus === 0 ? "losers" : marketStatus === 1 ? "premarket/losers" : "afterhours/losers"}`}
class="text-xl sm:text-2xl tex-white font-semibold cursor-pointer sm:hover:underline sm:hover:underline-offset-4"
>
{marketStatus === 0
? "Top"
: marketStatus === 1
? "Pre-Market"
: "Afterhours"} Losers
<svg
class="h-5 w-5 inline-block"
viewBox="0 0 20 20"
fill="currentColor"
style="max-width:40px"
aria-hidden="true"
><path
fill-rule="evenodd"
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
clip-rule="evenodd"
></path></svg
>
</a></Card.Title
>
</div>
</div>
</Card.Header>
<Card.Content>
<Table.Root class="overflow-x-scroll w-full">
<Table.Header>
<Table.Row>
<Table.Head class="text-white font-semibold"
>Symbol</Table.Head
>
<Table.Head
class="hidden sm:table-cell text-white font-semibold"
>Name</Table.Head
>
<Table.Head class="text-white text-right font-semibold"
>Price</Table.Head
>
<Table.Head class="text-white text-right font-semibold"
>Change</Table.Head
>
<Table.Head
class="text-white text-right font-semibold whitespace-nowrap"
>Market Cap</Table.Head
>
</Table.Row>
</Table.Header>
<Table.Body>
{#each losersList as item}
<Table.Row>
<Table.Cell class="text-sm sm:text-[1rem]">
<HoverStockChart symbol={item?.symbol} />
</Table.Cell>
<Table.Cell
class="hidden sm:table-cell xl:table.-column text-sm sm:text-[1rem]"
>
{item?.name?.length > charNumber
? item?.name?.slice(0, charNumber) + "..."
: item?.name}
</Table.Cell>
<Table.Cell
class="text-right xl:table.-column text-sm sm:text-[1rem]"
>
{item?.price?.toFixed(2)}
</Table.Cell>
<Table.Cell
class="text-right md:table.-cell xl:table.-column text-sm sm:text-[1rem] text-white"
>
{#if item?.changesPercentage >= 0}
<span class="text-[#00FC50]"
>+{item?.changesPercentage >= 1000
? abbreviateNumber(item?.changesPercentage)
: item?.changesPercentage?.toFixed(2)}%</span
>
{:else}
<span class="text-[#FF2F1F]"
>{item?.changesPercentage <= -1000
? abbreviateNumber(item?.changesPercentage)
: item?.changesPercentage?.toFixed(2)}%
</span>
{/if}
</Table.Cell>
<Table.Cell
class="text-right xl:table.-column text-sm sm:text-[1rem]"
>
{abbreviateNumber(item?.marketCap)}
</Table.Cell>
</Table.Row>
{/each}
</Table.Body>
</Table.Root>
</Card.Content>
</Card.Root>
</div>
<div class="grid gap-4 md:gap-8 grid-cols-1 lg:grid-cols-2 text-start">
<Card.Root class="overflow-x-scroll overflow-hidden overflow-y-auto">
<Card.Header class="flex flex-row items-center">
<div class="flex flex-col items-start w-full">
<div class="flex flex-row w-full items-center">
<Card.Title
class="text-xl sm:text-2xl tex-white font-semibold"
>Hottest Options Contract</Card.Title
>
<a
href="/options-flow"
class="ml-auto rounded-md text-xs sm:text-sm px-2 sm:px-3 py-2 font-semibold bg-[#fff] text-black"
>
View All
<ArrowUpRight
class="hidden sm:inline-block h-4 w-4 shrink-0 -mt-1 ml-0.5"
/>
</a>
</div>
<Card.Description class="mt-2 text-sm sm:text-[1rem]"
>Recent unusual options with the highest ...</Card.Description
>
<Tabs.Root value="premium" class="w-full sm:w-fit mt-5 ">
<Tabs.List class="grid w-full grid-cols-3 bg-secondary">
<Tabs.Trigger
on:click={() => changeTable("premium")}
value="premium"
class="text-sm">Premium</Tabs.Trigger
>
<Tabs.Trigger
on:click={() => changeTable("volume")}
value="volume"
class="text-sm">Volume</Tabs.Trigger
>
<Tabs.Trigger
on:click={() => changeTable("openInterest")}
value="openInterest"
class="text-sm"
>{$screenWidth < 640
? "OI"
: "Open Interest"}</Tabs.Trigger
>
</Tabs.List>
</Tabs.Root>
</div>
</Card.Header>
<Card.Content>
<Table.Root class="overflow-x-scroll w-full">
<Table.Header>
<Table.Row>
<Table.Head class="text-white font-semibold"
>Symbol</Table.Head
>
<Table.Head class="text-white text-right font-semibold"
>Prem</Table.Head
>
<Table.Head class="text-white text-right font-semibold"
>Strike</Table.Head
>
<Table.Head class="text-white text-right font-semibold"
>{optionsMode === "openInterest"
? "OI"
: "Vol"}</Table.Head
>
<Table.Head class="text-white text-right font-semibold"
>C/P</Table.Head
>
<Table.Head class="text-right text-white font-semibold"
>Expiry</Table.Head
>
</Table.Row>
</Table.Header>
<Table.Body>
{#each optionsTable as item}
<Table.Row>
<Table.Cell class="text-sm sm:text-[1rem]">
<HoverStockChart
symbol={item?.ticker}
assetType={item?.underlying_type}
/>
</Table.Cell>
<Table.Cell
class="text-right xl:table.-column text-sm sm:text-[1rem] {item?.put_call ===
'Calls'
? 'text-[#00FC50]'
: 'text-[#FF2F1F]'}"
>
{abbreviateNumber(item?.cost_basis, true)}
</Table.Cell>
<Table.Cell
class="text-right xl:table.-column text-sm sm:text-[1rem]"
>
${item?.strike_price}
</Table.Cell>
<Table.Cell
class="text-right md:table.-cell xl:table.-column text-sm sm:text-[1rem] text-white"
>
{abbreviateNumber(
optionsMode === "openInterest"
? item?.open_interest
: item?.volume,
)}
</Table.Cell>
<Table.Cell
class="text-right md:table.-cell xl:table.-column text-sm sm:text-[1rem] {item?.put_call ===
'Calls'
? 'text-[#00FC50]'
: 'text-[#FF2F1F]'}"
>
{item?.put_call}
</Table.Cell>
<Table.Cell class="text-right text-sm sm:text-[1rem]"
>{reformatDate(item?.date_expiration)}</Table.Cell
>
</Table.Row>
{/each}
</Table.Body>
</Table.Root>
</Card.Content>
</Card.Root>
<Card.Root
class="order-3 sm:order-1 overflow-x-scroll overflow-hidden overflow-y-auto no-scrollbar sm:max-h-[470px]"
>
<Card.Header class="flex flex-row items-center">
<div class="flex flex-col items-start w-full">
<div
class="whitespace-nowrap flex flex-row w-full items-center"
>
<Card.Title
class="text-xl sm:text-2xl tex-white font-semibold"
>AI Analyst report
</Card.Title>
{#if analystReport?.date}
<label
class="text-black bg-[#fff] inline-block ml-3 mt-1 font-semibold not-italic text-xs rounded px-2 py-0.5"
>New</label
>
<label
class="hidden sm:inline-block text-white text-sm italic ml-auto"
>Updated {analystReport?.date}</label
>
{/if}
</div>
{#if analystReport?.date}
<label class="sm:hidden text-white text-xs italic mt-2"
>Updated {analystReport?.date}</label
>
{/if}
</div>
</Card.Header>
<Card.Content>
{#if Object?.keys(analystReport)?.length > 0}
{analystReport?.insight}
<div class="text-white mt-4">
According to {analystReport?.numOfAnalyst} analyst ratings, the
average rating for <HoverStockChart
symbol={analystReport?.symbol}
/>
stock is "{analystReport?.consensusRating}" The 12-month stock
price forecast is ${analystReport?.highPriceTarget}, which is
an {analystReport?.highPriceChange > 0
? "increase"
: "decreas"} of {analystReport?.highPriceChange}% from the
latest price.
</div>
<table
class="w-full text-right text-tiny text-white xs:text-sm sm:text-base mt-5"
>
<thead
><tr
class="border-b border-gray-600 font-normal text-sm sm:text-[1rem]"
><th class="py-[3px] text-left font-semibold lg:py-0.5"
>Target</th
> <th class="font-semibold">Low</th>
<th class="font-semibold">Average</th>
<th class="font-semibold">Median</th>
<th class="font-semibold">High</th></tr
></thead
>
<tbody
><tr
class="border-b border-gray-600 font-normal text-sm sm:text-[1rem]"
><td class="py-[3px] text-left lg:py-0.5">Price</td>
<td>${analystReport?.lowPriceTarget}</td>
<td>${analystReport?.avgPriceTarget}</td>
<td>${analystReport?.medianPriceTarget}</td>
<td>${analystReport?.highPriceTarget}</td></tr
>
<tr class="text-sm sm:text-[1rem]"
><td class="py-[3px] text-left lg:py-0.5">Change</td>
<td
class={analystReport?.lowPriceChange > 0
? "before:content-['+'] text-[#00FC50]"
: "text-[#FF2F1F]"}
>{analystReport?.lowPriceChange}%</td
>
<td
class={analystReport?.avgPriceChange > 0
? "before:content-['+'] text-[#00FC50]"
: "text-[#FF2F1F]"}
>{analystReport?.avgPriceChange}%</td
>
<td
class={analystReport?.medianPriceChange > 0
? "before:content-['+'] text-[#00FC50]"
: "text-[#FF2F1F]"}
>{analystReport?.medianPriceChange}%</td
>
<td
class={analystReport?.highPriceChange > 0
? "before:content-['+'] text-[#00FC50]"
: "text-[#FF2F1F]"}
>{analystReport?.highPriceChange}%</td
></tr
></tbody
>
</table>
{:else}
<div
class="text-left text-white sm:p-5 w-fit rounded-md flex flex-row items-center sm:border sm:border-gray-600 text-[1rem]"
>
<svg
class="hidden sm:inline-block w-6 h-6 flex-shrink-0 sm:mr-2"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 256 256"
><path
fill="#fff"
d="M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m-4 48a12 12 0 1 1-12 12a12 12 0 0 1 12-12m12 112a16 16 0 0 1-16-16v-40a8 8 0 0 1 0-16a16 16 0 0 1 16 16v40a8 8 0 0 1 0 16"
/></svg
>
Currently, there are no new analyst reports available.
</div>
{/if}
</Card.Content>
</Card.Root>
<Card.Root
class="order-1 sm:order-2 overflow-x-scroll overflow-hidden overflow-y-auto no-scrollbar sm:max-h-[550px]"
>
<Card.Header class="flex flex-row items-center">
<div class="flex flex-col items-start w-full">
<div class="flex flex-row w-full items-center">
<Card.Title
class="text-xl sm:text-2xl tex-white font-semibold"
>Upcoming Earnings</Card.Title
>
<a
href="/earnings-calendar"
class="ml-auto rounded-md text-xs sm:text-sm px-2 sm:px-3 py-2 font-semibold bg-[#fff] text-black"
>
View All
<ArrowUpRight
class="hidden sm:inline-block h-4 w-4 shrink-0 -mt-1 ml-0.5"
/>
</a>
</div>
</div>
</Card.Header>
<Card.Content>
{#if data?.getDashboard?.upcomingEarnings?.length !== 0}
<ul style="padding-left: 5px;">
{#each data?.getDashboard?.upcomingEarnings as item}
<li
style="margin-left: 8px; line-height: 22px; margin-bottom: 30px; list-style-type: disc;"
>
<strong>{item?.name}</strong> (<HoverStockChart
symbol={item?.symbol}
/>)
{item?.isToday === true
? "will report today"
: [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
].includes(
new Date().toLocaleDateString("en-US", {
weekday: "long",
}),
)
? "will report tomorrow"
: "will report monday"}
{#if item?.time}
{#if compareTimes(item?.time, "16:00") >= 0}
after market closes.
{:else if compareTimes(item?.time, "09:30") <= 0}
before market opens.
{:else}
during market.
{/if}
{/if}Analysts estimate {abbreviateNumber(
item?.revenueEst,
)} in revenue ({(
(item?.revenueEst / item?.revenuePrior - 1) *
100
)?.toFixed(2)}% YoY) and {item?.epsEst} in earnings per share
{#if item?.epsPrior !== 0}
({((item?.epsEst / item?.epsPrior - 1) * 100)?.toFixed(
2,
)}% YoY).
{/if}
</li>
{/each}
</ul>
{:else}
<div
class="text-left text-white sm:p-5 w-fit rounded-md flex flex-row items-center sm:border sm:border-gray-600 text-[1rem]"
>
<svg
class="hidden sm:inline-block w-6 h-6 flex-shrink-0 sm:mr-2"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 256 256"
><path
fill="#fff"
d="M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m-4 48a12 12 0 1 1-12 12a12 12 0 0 1 12-12m12 112a16 16 0 0 1-16-16v-40a8 8 0 0 1 0-16a16 16 0 0 1 16 16v40a8 8 0 0 1 0 16"
/></svg
>
Currently, there are no upcoming earnings reports available that
include the latest analyst estimates.
</div>
{/if}
</Card.Content>
</Card.Root>
<Card.Root
class="order-2 sm:order-3 overflow-x-scroll overflow-hidden overflow-y-auto no-scrollbar sm:max-h-[550px]"
>
<Card.Header class="flex flex-row items-center">
<div class="flex flex-col items-start w-full">
<div class="flex flex-row w-full items-center">
<Card.Title
class="text-xl sm:text-2xl tex-white font-semibold"
>Recent Earnings <span class="text-sm text-gray-300"
>(NYSE Time)</span
></Card.Title
>
</div>
</div>
</Card.Header>
<Card.Content>
{#if data?.getDashboard?.recentEarnings?.length !== 0}
<ul style="padding-left: 5px;">
{#each data?.getDashboard?.recentEarnings as item}
<strong>{item?.name}</strong> (<HoverStockChart
symbol={item?.symbol}
/>) has released its quarterly earnings at {formatTime(
item?.time,
)}:
<li
style="color: #fff; line-height: 22px; margin-top:10px; margin-left: 30px; margin-bottom: 10px; list-style-type: disc;"
>
Revenue of {abbreviateNumber(item?.revenue)}
{item?.revenueSurprise > 0 ? "exceeds" : "misses"} estimates
by {abbreviateNumber(Math.abs(item?.revenueSurprise))},
with {(
(item?.revenue / item?.revenuePrior - 1) *
100
)?.toFixed(2)}% YoY {item?.revenue / item?.revenuePrior -
1 <
0
? "decline"
: "growth"}.
</li>
<li
style="color: #fff; line-height: 22px; margin-top:0px; margin-left: 30px; margin-bottom: 30px; list-style-type: disc;"
>
EPS of {item?.eps}
{item?.epsSurprise > 0 ? "exceeds" : "misses"} estimates by
{item?.epsSurprise?.toFixed(2)}, with {(
((item?.eps - item?.epsPrior) /
Math.abs(item?.epsPrior)) *
100
)?.toFixed(2)}% YoY {(item?.eps - item?.epsPrior) /
Math.abs(item?.epsPrior) <
0
? "decline"
: "growth"}.
</li>
{/each}
</ul>
{:else}
<div
class="text-left text-white sm:p-5 w-fit rounded-md flex flex-row items-center sm:border sm:border-gray-600 text-[1rem]"
>
<svg
class="hidden sm:inline-block w-6 h-6 flex-shrink-0 sm:mr-2"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 256 256"
><path
fill="#fff"
d="M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m-4 48a12 12 0 1 1-12 12a12 12 0 0 1 12-12m12 112a16 16 0 0 1-16-16v-40a8 8 0 0 1 0-16a16 16 0 0 1 16 16v40a8 8 0 0 1 0 16"
/></svg
>
Currently, there are no recent earnings reports available.
</div>
{/if}
</Card.Content>
</Card.Root>
</div>
</main>
</div>
</div>
</div>
<style>
.scrollbar {
display: grid;
grid-gap: 90px;
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
grid-auto-flow: column;
overflow-x: auto;
scrollbar-width: thin; /* Hide the default scrollbar in Firefox */
scrollbar-color: transparent transparent; /* Hide the default scrollbar in Firefox */
}
/* Custom scrollbar for Webkit (Chrome, Safari) */
.scrollbar::-webkit-scrollbar {
width: 0; /* Hide the width of the scrollbar */
height: 0; /* Hide the height of the scrollbar */
}
.scrollbar::-webkit-scrollbar-thumb {
background: transparent; /* Make the thumb transparent */
}
.stroke-text {
font-size: 56px; /* Adjust the font size as needed */
font-weight: bold; /* Adjust the font weight as needed */
color: transparent; /* Make the text transparent */
-webkit-text-stroke: 1px #cbd5e1; /* Add a black stroke outline with a thickness of 2px */
}
</style>