This commit is contained in:
MuslemRahimi 2025-03-12 17:40:32 +01:00
parent efbcc006ea
commit 118419c0ba
3 changed files with 239 additions and 256 deletions

View File

@ -1,3 +1,6 @@
export const ssr = true;
export const load = ({ locals, cookies }) => { export const load = ({ locals, cookies }) => {
const { user, isUSRegion, wsURL } = locals; const { user, isUSRegion, wsURL } = locals;
const themeMode = cookies.get("theme-mode") || "dark"; // Default to dark const themeMode = cookies.get("theme-mode") || "dark"; // Default to dark

View File

@ -1246,7 +1246,7 @@
--> -->
<slot /> <slot />
<ModeWatcher /> <ModeWatcher defaultMode="light"/>
<Toaster position="top-center" /> <Toaster position="top-center" />
{#if Cookie && $showCookieConsent === true} {#if Cookie && $showCookieConsent === true}
<Cookie /> <Cookie />

View File

@ -9,8 +9,6 @@
export let data; export let data;
let isLoaded = true;
let rawData = data?.getTopAnalyst; let rawData = data?.getTopAnalyst;
let originalData = [...rawData]; // Unaltered copy of raw data let originalData = [...rawData]; // Unaltered copy of raw data
@ -156,285 +154,267 @@
<h1 class="mb-1 text-2xl sm:text-3xl font-bold"> <h1 class="mb-1 text-2xl sm:text-3xl font-bold">
Top Wall Street Analysts Top Wall Street Analysts
</h1> </h1>
<p class="mb-3 px-1 font-semibold text-muted sm:px-0"> <p class="mb-3 px-1 font-semibold sm:px-0">
A list of Wall Street Analysts, ranked by their performance A list of Wall Street Analysts, ranked by their performance
</p> </p>
</div> </div>
<div class="w-full m-auto mt-16"> <div class="w-full m-auto mt-10">
{#if isLoaded} <div
<div class="w-full m-auto rounded-none sm:rounded-md mb-4 overflow-x-auto sm:overflow-hidden"
class="w-full m-auto rounded-none sm:rounded-md mb-4 overflow-x-auto sm:overflow-hidden" >
<table
class="table table-sm table-compact no-scrollbar rounded-none sm:rounded-md w-full bg-white dark:bg-table border border-gray-300 dark:border-gray-800 m-auto"
> >
<table <thead>
class="table table-sm table-compact no-scrollbar rounded-none sm:rounded-md w-full bg-white dark:bg-table border border-gray-300 dark:border-gray-800 m-auto" <TableHeader {columns} {sortOrders} {sortData} />
> </thead>
<thead> <tbody>
<TableHeader {columns} {sortOrders} {sortData} /> {#each analystList as item, index}
</thead> <tr
<tbody> class="dark:sm:hover:bg-[#245073]/10 odd:bg-[#F6F7F8] dark:odd:bg-odd{index +
{#each analystList as item, index} 1 ===
<tr rawData?.length &&
class="dark:sm:hover:bg-[#245073]/10 odd:bg-[#F6F7F8] dark:odd:bg-odd{index + !['Pro', 'Plus']?.includes(data?.user?.tier)
1 === ? 'opacity-[0.1]'
rawData?.length && : ''}"
!['Pro', 'Plus']?.includes(data?.user?.tier) >
? 'opacity-[0.1]' <td class=" text-sm sm:text-[1rem] text-center">
: ''}" {item?.rank}
</td>
<td
class="text-start text-sm sm:text-[1rem] whitespace-nowrap"
> >
<td class=" text-sm sm:text-[1rem] text-center"> <div class="flex flex-col items-start">
{item?.rank} <a
</td> href={"/analysts/" + item?.analystId}
class="font-semibold dark:font-normal text-blue-500 sm:hover:text-muted dark:sm:hover:text-white dark:text-blue-400"
>{item?.analystName}
</a>
<!--<span class="">{item?.companyName} </span>-->
<div class="flex flex-row items-center mt-1">
{#each Array.from({ length: 5 }) as _, i}
{#if i < Math.floor(item?.analystScore)}
<svg
class="w-3.5 h-3.5 text-[#FBCE3C]"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 22 20"
>
<path
d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"
/>
</svg>
{:else}
<svg
class="w-3.5 h-3.5 text-gray-400 dark:text-gray-500"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 22 20"
>
<path
d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"
/>
</svg>
{/if}
{/each}
<td <span class="ml-1 dark:text-gray-400">
class="text-start text-sm sm:text-[1rem] whitespace-nowrap" ({item?.analystScore !== null
> ? item?.analystScore
<div class="flex flex-col items-start"> : 0})
<a </span>
href={"/analysts/" + item?.analystId}
class="font-semibold dark:font-normal text-blue-500 sm:hover:text-muted dark:sm:hover:text-white dark:text-blue-400"
>{item?.analystName}
</a>
<!--<span class="">{item?.companyName} </span>-->
<div class="flex flex-row items-center mt-1">
{#each Array.from({ length: 5 }) as _, i}
{#if i < Math.floor(item?.analystScore)}
<svg
class="w-3.5 h-3.5 text-[#FBCE3C]"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 22 20"
>
<path
d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"
/>
</svg>
{:else}
<svg
class="w-3.5 h-3.5 text-gray-400 dark:text-gray-500"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 22 20"
>
<path
d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"
/>
</svg>
{/if}
{/each}
<span class="ml-1 dark:text-gray-400">
({item?.analystScore !== null
? item?.analystScore
: 0})
</span>
</div>
</div> </div>
</td> </div>
</td>
<td <td
class="text-end text-sm sm:text-[1rem] whitespace-nowrap" class="text-end text-sm sm:text-[1rem] whitespace-nowrap"
> >
{#if Number(item?.successRate) >= 0} {#if Number(item?.successRate) >= 0}
<span <span
class="font-semibold dark:font-normal text-green-600 dark:text-[#00FC50]" class="font-semibold dark:font-normal text-green-600 dark:text-[#00FC50]"
>+{Number(item?.successRate)?.toFixed(2)}%</span >+{Number(item?.successRate)?.toFixed(2)}%</span
> >
{/if} {/if}
</td> </td>
<td <td
class="text-end text-sm sm:text-[1rem] whitespace-nowrap" class="text-end text-sm sm:text-[1rem] whitespace-nowrap"
> >
{#if Number(item?.avgReturn) >= 0} {#if Number(item?.avgReturn) >= 0}
<span <span
class="font-semibold dark:font-normal text-green-600 dark:text-[#00FC50]" class="font-semibold dark:font-normal text-green-600 dark:text-[#00FC50]"
>+{Number(item?.avgReturn)?.toFixed(2)}%</span >+{Number(item?.avgReturn)?.toFixed(2)}%</span
> >
{:else} {:else}
<span <span
class="font-semibold dark:font-normal text-[#B84242]" class="font-semibold dark:font-normal text-[#B84242]"
>{Number(item?.avgReturn)?.toFixed(2)}%</span >{Number(item?.avgReturn)?.toFixed(2)}%</span
> >
{/if} {/if}
</td> </td>
<td <td
class="text-end text-sm sm:text-[1rem] whitespace-nowrap" class="text-end text-sm sm:text-[1rem] whitespace-nowrap"
> >
{item?.totalRatings} {item?.totalRatings}
</td> </td>
<!-- <!--
<td class=" text-sm sm:text-[1rem] whitespace-nowrap text-end"> <td class=" text-sm sm:text-[1rem] whitespace-nowrap text-end">
{item?.mainSectors?.at(0)} {item?.mainSectors?.at(0)}
</td> </td>
--> -->
<td <td
class="text-end text-sm sm:text-[1rem] whitespace-nowrap" class="text-end text-sm sm:text-[1rem] whitespace-nowrap"
> >
{item?.lastRating !== null {item?.lastRating !== null
? new Date(item?.lastRating)?.toLocaleString( ? new Date(item?.lastRating)?.toLocaleString(
"en-US", "en-US",
{ {
month: "short", month: "short",
day: "numeric", day: "numeric",
year: "numeric", year: "numeric",
daySuffix: "2-digit", daySuffix: "2-digit",
}, },
) )
: "n/a"} : "n/a"}
</td> </td>
</tr> </tr>
{/each} {/each}
</tbody> </tbody>
</table> </table>
</div> </div>
{:else}
<div class="flex justify-center items-center h-80">
<div class="relative">
<label
class="bg-secondary rounded-md h-14 w-14 flex justify-center items-center absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
>
<span
class="loading loading-spinner loading-md text-gray-400"
></span>
</label>
</div>
</div>
{/if}
</div> </div>
{#if isLoaded} <UpgradeToPro {data} />
<UpgradeToPro {data} />
<div class="mt-4 py-6 xl:mt-10 border-t border-gray-200"> <div class="mt-4 py-6 xl:mt-10 border-t border-gray-200">
<div class="mx-auto max-w-7xl px-3 xs:px-6 lg:px-8"> <div class="mx-auto max-w-7xl px-3 xs:px-6 lg:px-8">
<div class="mx-auto max-w-2xl md:text-center"> <div class="mx-auto max-w-2xl md:text-center">
<h3 <h3 class="mt-2 text-2xl font-bold tracking-tight bp:text-3xl">
class="mt-2 text-2xl font-bold tracking-tight bp:text-3xl" Analyst Star Rankings
> </h3>
Analyst Star Rankings <p class="mt-3 leading-8 xl:text-lg">
</h3> Our analyst star rankings are based on these four factors
<p class="mt-3 leading-8 xl:text-lg"> </p>
Our analyst star rankings are based on these four factors </div>
</p> <div class="mx-auto mt-6 max-w-2xl lg:max-w-5xl">
</div> <dl
<div class="mx-auto mt-6 max-w-2xl lg:max-w-5xl"> class="grid grid-cols-1 gap-x-8 gap-y-10 md:grid-cols-2 lg:max-w-none lg:grid-cols-4 lg:gap-y-16"
<dl >
class="grid grid-cols-1 gap-x-8 gap-y-10 md:grid-cols-2 lg:max-w-none lg:grid-cols-4 lg:gap-y-16" <div class="relative pl-14">
> <dt class=" font-semibold leading-4 md:leading-7">
<div class="relative pl-14"> <div
<dt class=" font-semibold leading-4 md:leading-7"> class="absolute left-0 top-0 flex h-10 w-10 items-center justify-center rounded-md bg-[#3B82F6] dark:bg-[#fff]"
<div >
class="absolute left-0 top-0 flex h-10 w-10 items-center justify-center rounded-md bg-[#3B82F6] dark:bg-[#fff]" <svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="h-6 w-6 text-white dark:text-black"
><path
stroke-linecap="round"
stroke-linejoin="round"
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
></path></svg
> >
<svg </div>
xmlns="http://www.w3.org/2000/svg" Success Rate
fill="none" </dt>
viewBox="0 0 24 24" <dd class="mt-2 leading-7">
stroke-width="1.5" The percentage of ratings that are profitable.
stroke="currentColor" </dd>
class="h-6 w-6 text-white dark:text-black" </div>
><path <div class="relative pl-14">
stroke-linecap="round" <dt class=" font-semibold leading-4 md:leading-7">
stroke-linejoin="round" <div
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" class="absolute left-0 top-0 flex h-10 w-10 items-center justify-center rounded-md bg-[#3B82F6] dark:bg-[#fff]"
></path></svg >
> <svg
</div> xmlns="http://www.w3.org/2000/svg"
Success Rate fill="none"
</dt> viewBox="0 0 24 24"
<dd class="mt-2 leading-7"> stroke-width="1.5"
The percentage of ratings that are profitable. stroke="currentColor"
</dd> class="h-6 w-6 text-white dark:text-black"
</div> ><path
<div class="relative pl-14"> stroke-linecap="round"
<dt class=" font-semibold leading-4 md:leading-7"> stroke-linejoin="round"
<div d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z"
class="absolute left-0 top-0 flex h-10 w-10 items-center justify-center rounded-md bg-[#3B82F6] dark:bg-[#fff]" ></path></svg
> >
<svg </div>
xmlns="http://www.w3.org/2000/svg" Average Return
fill="none" </dt>
viewBox="0 0 24 24" <dd class="mt-2 leading-7">
stroke-width="1.5" The average percentage return within one year of the
stroke="currentColor" rating.
class="h-6 w-6 text-white dark:text-black" </dd>
><path </div>
stroke-linecap="round" <div class="relative pl-14">
stroke-linejoin="round" <dt class=" font-semibold leading-4 md:leading-7">
d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z" <div
></path></svg class="absolute left-0 top-0 flex h-10 w-10 items-center justify-center rounded-md bg-[#3B82F6] dark:bg-[#fff]"
> >
</div> <svg
Average Return xmlns="http://www.w3.org/2000/svg"
</dt> fill="none"
<dd class="mt-2 leading-7"> viewBox="0 0 24 24"
The average percentage return within one year of the stroke-width="1.5"
rating. stroke="currentColor"
</dd> class="h-6 w-6 text-white dark:text-black"
</div> ><path
<div class="relative pl-14"> stroke-linecap="round"
<dt class=" font-semibold leading-4 md:leading-7"> stroke-linejoin="round"
<div d="M15.75 15.75V18m-7.5-6.75h.008v.008H8.25v-.008zm0 2.25h.008v.008H8.25V13.5zm0 2.25h.008v.008H8.25v-.008zm0 2.25h.008v.008H8.25V18zm2.498-6.75h.007v.008h-.007v-.008zm0 2.25h.007v.008h-.007V13.5zm0 2.25h.007v.008h-.007v-.008zm0 2.25h.007v.008h-.007V18zm2.504-6.75h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V13.5zm0 2.25h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V18zm2.498-6.75h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V13.5zM8.25 6h7.5v2.25h-7.5V6zM12 2.25c-1.892 0-3.758.11-5.593.322C5.307 2.7 4.5 3.65 4.5 4.757V19.5a2.25 2.25 0 002.25 2.25h10.5a2.25 2.25 0 002.25-2.25V4.757c0-1.108-.806-2.057-1.907-2.185A48.507 48.507 0 0012 2.25z"
class="absolute left-0 top-0 flex h-10 w-10 items-center justify-center rounded-md bg-[#3B82F6] dark:bg-[#fff]" ></path></svg
> >
<svg </div>
xmlns="http://www.w3.org/2000/svg" Rating Count
fill="none" </dt>
viewBox="0 0 24 24" <dd class="mt-2 leading-7">
stroke-width="1.5" The more ratings the analyst has provided, the higher the
stroke="currentColor" score.
class="h-6 w-6 text-white dark:text-black" </dd>
><path </div>
stroke-linecap="round" <div class="relative pl-14">
stroke-linejoin="round" <dt class=" font-semibold leading-4 md:leading-7">
d="M15.75 15.75V18m-7.5-6.75h.008v.008H8.25v-.008zm0 2.25h.008v.008H8.25V13.5zm0 2.25h.008v.008H8.25v-.008zm0 2.25h.008v.008H8.25V18zm2.498-6.75h.007v.008h-.007v-.008zm0 2.25h.007v.008h-.007V13.5zm0 2.25h.007v.008h-.007v-.008zm0 2.25h.007v.008h-.007V18zm2.504-6.75h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V13.5zm0 2.25h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V18zm2.498-6.75h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V13.5zM8.25 6h7.5v2.25h-7.5V6zM12 2.25c-1.892 0-3.758.11-5.593.322C5.307 2.7 4.5 3.65 4.5 4.757V19.5a2.25 2.25 0 002.25 2.25h10.5a2.25 2.25 0 002.25-2.25V4.757c0-1.108-.806-2.057-1.907-2.185A48.507 48.507 0 0012 2.25z" <div
></path></svg class="absolute left-0 top-0 flex h-10 w-10 items-center justify-center rounded-md bg-[#3B82F6] dark:bg-[#fff]"
> >
</div> <svg
Rating Count xmlns="http://www.w3.org/2000/svg"
</dt> fill="none"
<dd class="mt-2 leading-7"> viewBox="0 0 24 24"
The more ratings the analyst has provided, the higher stroke-width="1.5"
the score. stroke="currentColor"
</dd> class="h-6 w-6 text-white dark:text-black"
</div> ><path
<div class="relative pl-14"> stroke-linecap="round"
<dt class=" font-semibold leading-4 md:leading-7"> stroke-linejoin="round"
<div d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"
class="absolute left-0 top-0 flex h-10 w-10 items-center justify-center rounded-md bg-[#3B82F6] dark:bg-[#fff]" ></path></svg
> >
<svg </div>
xmlns="http://www.w3.org/2000/svg" Recency
fill="none" </dt>
viewBox="0 0 24 24" <dd class="mt-2 leading-7">
stroke-width="1.5" Ratings provided within the past year contribute to a
stroke="currentColor" higher score.
class="h-6 w-6 text-white dark:text-black" </dd>
><path </div>
stroke-linecap="round" </dl>
stroke-linejoin="round"
d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"
></path></svg
>
</div>
Recency
</dt>
<dd class="mt-2 leading-7">
Ratings provided within the past year contribute to a
higher score.
</dd>
</div>
</dl>
</div>
</div> </div>
</div> </div>
{/if} </div>
</main> </main>
<aside class="hidden lg:block relative fixed w-1/4 ml-4"> <aside class="hidden lg:block relative fixed w-1/4 ml-4">
<div <div