This commit is contained in:
MuslemRahimi 2024-10-28 08:59:09 +01:00
parent c7f8f9c48c
commit 4af983ec14
2 changed files with 62 additions and 71 deletions

View File

@ -159,27 +159,12 @@
<div class="w-auto lg:w-full flex flex-col m-auto pb-14 sm:pb-10"> <div class="w-auto lg:w-full flex flex-col m-auto pb-14 sm:pb-10">
<h2 class="mb-2 text-2xl text-white font-semibold">Analyst Forecast</h2> <h2 class="mb-2 text-2xl text-white font-semibold">Analyst Forecast</h2>
<p class="text-gray-200"> <p class="text-gray-200">
According to 40 analysts, the average rating for NVDA stock is "Strong According to {numOfAnalyst} analysts, the average rating for NVDA stock is
Buy." The 12-month stock price forecast is $145.84, which is an increase "{consensusRating}." The 12-month stock price forecast is ${priceTarget},
of 3.04% from the latest price. which is {changesPercentage > 0 ? "an increase" : "a decrease"} of {changesPercentage}%
from the latest price.
</p> </p>
<div class="text-white mt-6">
{#if changesPercentage < 0}
The Stock Price has a downside of
<span style="color: #FF2F1F; font-weight: 500"
>{abbreviateNumber(Math.abs(changesPercentage))}%</span
>
{:else if changesPercentage >= 0}
The Stock Price has an upside of
<span style="color: #37C97D; font-weight: 500"
>{abbreviateNumber(Math.abs(changesPercentage))}%</span
>
{/if}
based on <span style="font-weight: 600">{numOfAnalyst}</span> analysts in
the past 12 months.
</div>
<div class="mt-5 w-full m-auto flex justify-center items-center mb-5"> <div class="mt-5 w-full m-auto flex justify-center items-center mb-5">
<div class="flex flex-col items-center w-full"> <div class="flex flex-col items-center w-full">
<!--Start Progress--> <!--Start Progress-->
@ -240,7 +225,7 @@
href={`/stocks/${$stockTicker}/forecast/analyst`} href={`/stocks/${$stockTicker}/forecast/analyst`}
class="rounded-md cursor-pointer w-full m-auto py-2 h-full mt-6 text-lg text-center font-bold text-white hover:bg-purple-700 bg-purple-600 transition duration-100" class="rounded-md cursor-pointer w-full m-auto py-2 h-full mt-6 text-lg text-center font-bold text-white hover:bg-purple-700 bg-purple-600 transition duration-100"
> >
Analyst Ratings Stock Forecasts
</a> </a>
</div> </div>
</div> </div>

View File

@ -370,24 +370,25 @@
</h2> </h2>
<div <div
class="text-white p-3 sm:p-5 mb-5 rounded-lg flex flex-row items-center border border-gray-800 text-sm sm:text-[1rem]" class="text-white p-3 sm:p-5 mb-5 rounded-md border border-gray-800"
> >
<svg <span class="inline-block align-text-bottom">
class="w-6 h-6 flex-shrink-0 inline-block sm:mr-2" <svg
xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 inline-block align-text-bottom"
viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"
><path viewBox="0 0 256 256"
fill="#a474f6" >
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" <path
/></svg fill="#a474f6"
> 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>
</span>
{#if employeeHistory?.length !== 0 && !dateDistance} {#if employeeHistory?.length !== 0 && !dateDistance}
<div> <span>
{$displayCompanyName} {$displayCompanyName} had {new Intl.NumberFormat("en")?.format(
had employees,
{abbreviateNumber(employees)} )} employees on
employees on
{new Date( {new Date(
employeeHistory[employeeHistory?.length - 1]["filingDate"], employeeHistory[employeeHistory?.length - 1]["filingDate"],
)?.toLocaleString("en-US", { )?.toLocaleString("en-US", {
@ -397,30 +398,34 @@
daySuffix: "2-digit", daySuffix: "2-digit",
})}. The number of employees {changeRate >= 0 })}. The number of employees {changeRate >= 0
? "increased" ? "increased"
: "decreased"} by : "decreased"}
{abbreviateNumber(changeRate)} by {new Intl.NumberFormat("en")?.format(changeRate)} or
or
<span <span
class={changeRate >= 0 ? "text-[#37C97D]" : "text-[#FF2F1F]"} class={changeRate >= 0 ? "text-[#37C97D]" : "text-[#FF2F1F]"}
> >
{growthRate}% {growthRate}%
</span> </span>
compared to the previous year. compared to the previous year.
</div> </span>
{:else if employeeHistory?.length !== 0 && dateDistance} {:else if employeeHistory?.length !== 0 && dateDistance}
{$displayCompanyName} had {abbreviateNumber(employees)} employees on <span>
{new Date( {$displayCompanyName} had {abbreviateNumber(employees)} employees
employeeHistory[employeeHistory?.length - 1]["filingDate"], on
)?.toLocaleString("en-US", { {new Date(
month: "short", employeeHistory[employeeHistory?.length - 1]["filingDate"],
day: "numeric", )?.toLocaleString("en-US", {
year: "numeric", month: "short",
daySuffix: "2-digit", day: "numeric",
})}. Since then, the company has not submitted any additional year: "numeric",
employee data for more than a year. daySuffix: "2-digit",
})}. Since then, the company has not submitted any additional
employee data for more than a year.
</span>
{:else} {:else}
No employee history for {$displayCompanyName}. Probably, no <span>
records of past employees. No employee history for {$displayCompanyName}. Probably, no
records of past employees.
</span>
{/if} {/if}
</div> </div>
</div> </div>
@ -429,57 +434,58 @@
class="mb-4 grid grid-cols-2 grid-rows-1 divide-gray-500 rounded-lg border border-gray-600 bg-[#272727] shadow md:grid-cols-3 md:grid-rows-1 md:divide-x" class="mb-4 grid grid-cols-2 grid-rows-1 divide-gray-500 rounded-lg border border-gray-600 bg-[#272727] shadow md:grid-cols-3 md:grid-rows-1 md:divide-x"
> >
<div class="p-4 bp:p-5 sm:p-6"> <div class="p-4 bp:p-5 sm:p-6">
<label <span
for="totalAnalystInfo" class="mr-1 flex flex-row items-center text-white text-lg sm:text-xl"
class="mr-1 cursor-pointer flex flex-row items-center text-white text-[1rem]"
> >
Total Employees Total Employees
</label> </span>
<div <div
class="mt-1 break-words font-semibold leading-8 text-light text-lg" class="mt-1 break-words font-semibold leading-8 text-light text-lg sm:text-xl"
> >
{abbreviateNumber(employees)} {#if Number(employees)}
{new Intl.NumberFormat("en")?.format(employees)}
{:else}
-
{/if}
</div> </div>
</div> </div>
<div <div
class="p-4 bp:p-5 sm:p-6 border-l border-b border-contrast md:border-0" class="p-4 bp:p-5 sm:p-6 border-l border-b border-contrast md:border-0"
> >
<label <span
for="consensusRatingInfo" class="mr-1 flex flex-row items-center text-white text-lg sm:text-xl"
class="mr-1 cursor-pointer flex flex-row items-center text-white text-[1rem]"
> >
Change (1Y) Change (1Y)
</label> </span>
<div <div
class="mt-1 break-words font-semibold leading-8 text-light text-lg" class="mt-1 break-words font-semibold leading-8 text-light text-lg sm:text-xl"
> >
{#if dateDistance} {#if dateDistance}
n/a n/a
{:else} {:else}
{abbreviateNumber(changeRate)} {new Intl.NumberFormat("en")?.format(changeRate)}
{/if} {/if}
</div> </div>
</div> </div>
<div <div
class="p-4 bp:p-5 sm:p-6 border-t border-r border-contrast md:border-0" class="p-4 bp:p-5 sm:p-6 border-t border-r border-contrast md:border-0"
> >
<label <span
for="priceTargetInfo" class="mr-1 flex flex-row items-center text-white text-lg sm:text-xl"
class="mr-1 cursor-pointer flex flex-row items-center text-white text-[1rem]"
> >
Growth (1Y) Growth (1Y)
</label> </span>
<div <div
class="mt-1 break-words font-semibold leading-8 text-light text-xl" class="mt-1 break-words font-semibold leading-8 text-light text-lg sm:text-xl"
> >
{#if growthRate >= 0} {#if growthRate >= 0}
<span class="text-white text-md font-medium"> <span class="text-white">
<span class="text-[#37C97D] text-lg">+{growthRate}%</span> <span class="text-[#37C97D] text-lg">+{growthRate}%</span>
</span> </span>
{:else if growthRate < 0} {:else if growthRate < 0}
<div class="text-white text-md font-medium"> <div class="text-white">
<span class="text-[#FF2F1F] text-lg">{growthRate}%</span> <span class="text-[#FF2F1F] text-lg">{growthRate}%</span>
</div> </div>
{:else} {:else}