From 4af983ec1455b55c32d5e02b5857179a11f3bbce Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Mon, 28 Oct 2024 08:59:09 +0100 Subject: [PATCH] ui fixes --- src/lib/components/Sidecard.svelte | 25 +--- .../statistics/employees/+page.svelte | 108 +++++++++--------- 2 files changed, 62 insertions(+), 71 deletions(-) diff --git a/src/lib/components/Sidecard.svelte b/src/lib/components/Sidecard.svelte index cc2b5b97..5ccb43fc 100644 --- a/src/lib/components/Sidecard.svelte +++ b/src/lib/components/Sidecard.svelte @@ -159,27 +159,12 @@

Analyst Forecast

- According to 40 analysts, the average rating for NVDA stock is "Strong - Buy." The 12-month stock price forecast is $145.84, which is an increase - of 3.04% from the latest price. + According to {numOfAnalyst} analysts, the average rating for NVDA stock is + "{consensusRating}." The 12-month stock price forecast is ${priceTarget}, + which is {changesPercentage > 0 ? "an increase" : "a decrease"} of {changesPercentage}% + from the latest price.

-
- {#if changesPercentage < 0} - The Stock Price has a downside of - {abbreviateNumber(Math.abs(changesPercentage))}% - {:else if changesPercentage >= 0} - The Stock Price has an upside of - {abbreviateNumber(Math.abs(changesPercentage))}% - {/if} - based on {numOfAnalyst} analysts in - the past 12 months. -
-
@@ -240,7 +225,7 @@ 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" > - Analyst Ratings + Stock Forecasts
diff --git a/src/routes/stocks/[tickerID]/statistics/employees/+page.svelte b/src/routes/stocks/[tickerID]/statistics/employees/+page.svelte index 877e4364..411334ca 100644 --- a/src/routes/stocks/[tickerID]/statistics/employees/+page.svelte +++ b/src/routes/stocks/[tickerID]/statistics/employees/+page.svelte @@ -370,24 +370,25 @@
- - + + + + + {#if employeeHistory?.length !== 0 && !dateDistance} -
- {$displayCompanyName} - had - {abbreviateNumber(employees)} - employees on + + {$displayCompanyName} had {new Intl.NumberFormat("en")?.format( + employees, + )} employees on {new Date( employeeHistory[employeeHistory?.length - 1]["filingDate"], )?.toLocaleString("en-US", { @@ -397,30 +398,34 @@ daySuffix: "2-digit", })}. The number of employees {changeRate >= 0 ? "increased" - : "decreased"} by - {abbreviateNumber(changeRate)} - or + : "decreased"} + by {new Intl.NumberFormat("en")?.format(changeRate)} or = 0 ? "text-[#37C97D]" : "text-[#FF2F1F]"} > {growthRate}% compared to the previous year. -
+ {:else if employeeHistory?.length !== 0 && dateDistance} - {$displayCompanyName} had {abbreviateNumber(employees)} employees on - {new Date( - employeeHistory[employeeHistory?.length - 1]["filingDate"], - )?.toLocaleString("en-US", { - month: "short", - day: "numeric", - year: "numeric", - daySuffix: "2-digit", - })}. Since then, the company has not submitted any additional - employee data for more than a year. + + {$displayCompanyName} had {abbreviateNumber(employees)} employees + on + {new Date( + employeeHistory[employeeHistory?.length - 1]["filingDate"], + )?.toLocaleString("en-US", { + month: "short", + day: "numeric", + year: "numeric", + daySuffix: "2-digit", + })}. Since then, the company has not submitted any additional + employee data for more than a year. + {:else} - No employee history for {$displayCompanyName}. Probably, no - records of past employees. + + No employee history for {$displayCompanyName}. Probably, no + records of past employees. + {/if}
@@ -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" >
- +
- {abbreviateNumber(employees)} + {#if Number(employees)} + {new Intl.NumberFormat("en")?.format(employees)} + {:else} + - + {/if}
- +
{#if dateDistance} n/a {:else} - {abbreviateNumber(changeRate)} + {new Intl.NumberFormat("en")?.format(changeRate)} {/if}
- +
{#if growthRate >= 0} - + +{growthRate}% {:else if growthRate < 0} -
+
{growthRate}%
{:else}