From 118419c0ba934983419a012280754d66a33a6177 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Wed, 12 Mar 2025 17:40:32 +0100 Subject: [PATCH] ui fix --- src/routes/+layout.server.ts | 3 + src/routes/+layout.svelte | 2 +- src/routes/analysts/+page.svelte | 490 +++++++++++++++---------------- 3 files changed, 239 insertions(+), 256 deletions(-) diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index 856e0b9b..58fed78a 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -1,3 +1,6 @@ +export const ssr = true; + + export const load = ({ locals, cookies }) => { const { user, isUSRegion, wsURL } = locals; const themeMode = cookies.get("theme-mode") || "dark"; // Default to dark diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index e4abf4e0..0c78b673 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1246,7 +1246,7 @@ --> - + {#if Cookie && $showCookieConsent === true} diff --git a/src/routes/analysts/+page.svelte b/src/routes/analysts/+page.svelte index ed614fc1..0d2ed7f5 100644 --- a/src/routes/analysts/+page.svelte +++ b/src/routes/analysts/+page.svelte @@ -9,8 +9,6 @@ export let data; - let isLoaded = true; - let rawData = data?.getTopAnalyst; let originalData = [...rawData]; // Unaltered copy of raw data @@ -156,285 +154,267 @@

Top Wall Street Analysts

-

+

A list of Wall Street Analysts, ranked by their performance

-
- {#if isLoaded} -
+
+ -
- - - - - {#each analystList as item, index} - + + + + {#each analystList as item, index} + + + + +
+ {item?.analystName} + + +
+ {#each Array.from({ length: 5 }) as _, i} + {#if i < Math.floor(item?.analystScore)} + + {:else} + + {/if} + {/each} -
+ + - + - + - + - - - - {/each} - -
+ {item?.rank} + - - {item?.rank} - -
- {item?.analystName} - - -
- {#each Array.from({ length: 5 }) as _, i} - {#if i < Math.floor(item?.analystScore)} - - {:else} - - {/if} - {/each} - - - ({item?.analystScore !== null - ? item?.analystScore - : 0}) - -
+ + ({item?.analystScore !== null + ? item?.analystScore + : 0}) +
-
- {#if Number(item?.successRate) >= 0} - +{Number(item?.successRate)?.toFixed(2)}% - {/if} - + {#if Number(item?.successRate) >= 0} + +{Number(item?.successRate)?.toFixed(2)}% + {/if} + - {#if Number(item?.avgReturn) >= 0} - +{Number(item?.avgReturn)?.toFixed(2)}% - {:else} - {Number(item?.avgReturn)?.toFixed(2)}% - {/if} - + {#if Number(item?.avgReturn) >= 0} + +{Number(item?.avgReturn)?.toFixed(2)}% + {:else} + {Number(item?.avgReturn)?.toFixed(2)}% + {/if} + - {item?.totalRatings} - + {item?.totalRatings} + - {item?.lastRating !== null - ? new Date(item?.lastRating)?.toLocaleString( - "en-US", - { - month: "short", - day: "numeric", - year: "numeric", - daySuffix: "2-digit", - }, - ) - : "n/a"} -
-
- {:else} -
-
- -
-
- {/if} + + {item?.lastRating !== null + ? new Date(item?.lastRating)?.toLocaleString( + "en-US", + { + month: "short", + day: "numeric", + year: "numeric", + daySuffix: "2-digit", + }, + ) + : "n/a"} + + + {/each} + + +
- {#if isLoaded} - + -
-
-
-

- Analyst Star Rankings -

-

- Our analyst star rankings are based on these four factors -

-
-
-
-
-
-
+
+
+

+ Analyst Star Rankings +

+

+ Our analyst star rankings are based on these four factors +

+
+
+
+
+
+
+ - -
- Success Rate -
-
- The percentage of ratings that are profitable. -
-
-
-
-
+ Success Rate +
+
+ The percentage of ratings that are profitable. +
+
+
+
+
+ - -
- Average Return -
-
- The average percentage return within one year of the - rating. -
-
-
-
-
+ Average Return +
+
+ The average percentage return within one year of the + rating. +
+
+
+
+
+ - -
- Rating Count -
-
- The more ratings the analyst has provided, the higher - the score. -
-
-
-
-
+ Rating Count +
+
+ The more ratings the analyst has provided, the higher the + score. +
+
+
+
+
+ - -
- Recency -
-
- Ratings provided within the past year contribute to a - higher score. -
-
-
-
+
+ Recency +
+
+ Ratings provided within the past year contribute to a + higher score. +
+
+
- {/if} +