seo fix
This commit is contained in:
parent
f22f98e541
commit
64954a3f64
@ -13,7 +13,7 @@ export const load = async ({ locals, params }) => {
|
|||||||
body: JSON.stringify(postData),
|
body: JSON.stringify(postData),
|
||||||
});
|
});
|
||||||
|
|
||||||
const output = await response.json();
|
const output = await response.json() || {};
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import HoverStockChart from "$lib/components/HoverStockChart.svelte";
|
import HoverStockChart from "$lib/components/HoverStockChart.svelte";
|
||||||
import RatingsChart from "$lib/components/RatingsChart.svelte";
|
import RatingsChart from "$lib/components/RatingsChart.svelte";
|
||||||
|
import Infobox from "$lib/components/Infobox.svelte";
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let analystStats = data?.getAnalystStats;
|
let analystStats = data?.getAnalystStats;
|
||||||
@ -16,7 +18,7 @@
|
|||||||
|
|
||||||
let analystScore = analystStats?.analystScore;
|
let analystScore = analystStats?.analystScore;
|
||||||
let rank = analystStats?.rank;
|
let rank = analystStats?.rank;
|
||||||
let analystName = analystStats?.analystName;
|
let analystName = analystStats?.analystName ?? "n/a";
|
||||||
let companyName = analystStats?.companyName;
|
let companyName = analystStats?.companyName;
|
||||||
let totalRatings = analystStats?.totalRatings;
|
let totalRatings = analystStats?.totalRatings;
|
||||||
let successRate = analystStats?.successRate;
|
let successRate = analystStats?.successRate;
|
||||||
@ -30,7 +32,7 @@
|
|||||||
function processTickerData(data) {
|
function processTickerData(data) {
|
||||||
const tickerMap = new Map();
|
const tickerMap = new Map();
|
||||||
|
|
||||||
data.forEach((item) => {
|
data?.forEach((item) => {
|
||||||
const { ticker } = item;
|
const { ticker } = item;
|
||||||
|
|
||||||
if (!ticker) return; // Skip if ticker is not defined
|
if (!ticker) return; // Skip if ticker is not defined
|
||||||
@ -212,7 +214,7 @@
|
|||||||
<li><a href="/" class="text-gray-300">Home</a></li>
|
<li><a href="/" class="text-gray-300">Home</a></li>
|
||||||
<li><a href="/analysts" class="text-gray-300">Analyst</a></li>
|
<li><a href="/analysts" class="text-gray-300">Analyst</a></li>
|
||||||
|
|
||||||
<li class="text-gray-300">{analystName}</li>
|
<li class="text-gray-300">{analystName ?? "n/a"}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -242,15 +244,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mt-0 pt-0.5 text-left">
|
<div class="mt-0 pt-0.5 text-left">
|
||||||
<h1 class="mb-0 text-2xl font-bold text-white">
|
<h1 class="mb-0 text-2xl font-bold text-white">
|
||||||
{analystName}
|
{analystName ?? "n/a"}
|
||||||
</h1>
|
</h1>
|
||||||
<p class="mb-0.5 text-[1rem] font-semibold text-gray-300">
|
<p class="mb-0.5 text-[1rem] font-semibold text-gray-300">
|
||||||
Stock Analyst at {companyName}
|
Stock Analyst at {companyName ?? "n/a"}
|
||||||
</p>
|
</p>
|
||||||
<div class="inline-flex items-center">
|
<div class="inline-flex items-center">
|
||||||
<div class="flex flex-row items-center">
|
<div class="flex flex-row items-center">
|
||||||
{#each Array.from({ length: 5 }) as _, i}
|
{#each Array.from({ length: 5 }) as _, i}
|
||||||
{#if i < Math.floor(analystScore)}
|
{#if i < Math?.floor(analystScore)}
|
||||||
<svg
|
<svg
|
||||||
class="w-5 h-5 text-[#FBCE3C]"
|
class="w-5 h-5 text-[#FBCE3C]"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
@ -278,7 +280,7 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<span class="ml-1 text-[1rem] text-white"
|
<span class="ml-1 text-[1rem] text-white"
|
||||||
>({analystScore})</span
|
>({analystScore ?? "n/a"})</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -288,19 +290,19 @@
|
|||||||
>
|
>
|
||||||
<div class="flex flex-col px-4 py-2 bp:px-6 md:py-6">
|
<div class="flex flex-col px-4 py-2 bp:px-6 md:py-6">
|
||||||
<div class="text-2xl font-semibold tracking-tight text-white">
|
<div class="text-2xl font-semibold tracking-tight text-white">
|
||||||
# {rank}
|
# {rank ?? "n/a"}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="text-[1rem] font-semibold leading-6 text-gray-300"
|
class="text-[1rem] font-semibold leading-6 text-gray-300"
|
||||||
>
|
>
|
||||||
Out of {numOfAnalysts} analysts
|
Out of {numOfAnalysts ?? "n/a"} analysts
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex flex-col px-4 py-2 bp:px-6 sm:border-l sm:border-gray-600 md:py-6"
|
class="flex flex-col px-4 py-2 bp:px-6 sm:border-l sm:border-gray-600 md:py-6"
|
||||||
>
|
>
|
||||||
<div class="text-2xl font-bold tracking-tight text-white">
|
<div class="text-2xl font-bold tracking-tight text-white">
|
||||||
{totalRatings}
|
{totalRatings ?? "n/a"}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="text-[1rem] font-semibold leading-6 text-gray-300"
|
class="text-[1rem] font-semibold leading-6 text-gray-300"
|
||||||
@ -313,9 +315,14 @@
|
|||||||
>
|
>
|
||||||
<div class="text-2xl font-bold tracking-tight">
|
<div class="text-2xl font-bold tracking-tight">
|
||||||
<span
|
<span
|
||||||
class={successRate >= 0
|
class={successRate >= 0 && successRate !== undefined
|
||||||
? "before:content-['+'] text-[#36D984]"
|
? "before:content-['+'] text-[#36D984]"
|
||||||
: "text-[#EF4444]"}>{successRate?.toFixed(2)}%</span
|
: successRate < 0 && successRate !== undefined
|
||||||
|
? "text-[#EF4444]"
|
||||||
|
: "text-white"}
|
||||||
|
>{successRate !== undefined
|
||||||
|
? successRate?.toFixed(2) + "%"
|
||||||
|
: "n/a"}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@ -329,9 +336,14 @@
|
|||||||
>
|
>
|
||||||
<div class="text-2xl font-bold tracking-tight text-white">
|
<div class="text-2xl font-bold tracking-tight text-white">
|
||||||
<span
|
<span
|
||||||
class={avgReturn >= 0
|
class={avgReturn >= 0 && avgReturn !== undefined
|
||||||
? "before:content-['+'] text-[#36D984]"
|
? "before:content-['+'] text-[#36D984]"
|
||||||
: "text-[#EF4444]"}>{avgReturn?.toFixed(2)}%</span
|
: avgReturn < 0 && avgReturn !== undefined
|
||||||
|
? "text-[#EF4444]"
|
||||||
|
: "text-white"}
|
||||||
|
>{avgReturn !== undefined
|
||||||
|
? avgReturn?.toFixed(2) + "%"
|
||||||
|
: "n/a"}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@ -343,6 +355,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if data?.getAnalystStats?.mainSectors?.length > 0}
|
||||||
<div class="mb-10 mt-10 text-white">
|
<div class="mb-10 mt-10 text-white">
|
||||||
<div
|
<div
|
||||||
class="relative my-3 space-y-2 rounded border border-gray-600 sm:my-6 p-4"
|
class="relative my-3 space-y-2 rounded border border-gray-600 sm:my-6 p-4"
|
||||||
@ -379,7 +392,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if rawData?.length > 0}
|
||||||
<span class="text-white font-semibold text-xl sm:text-2xl">
|
<span class="text-white font-semibold text-xl sm:text-2xl">
|
||||||
{numOfStocks} Stocks
|
{numOfStocks} Stocks
|
||||||
</span>
|
</span>
|
||||||
@ -604,6 +619,13 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="pt-5">
|
||||||
|
<Infobox
|
||||||
|
text="No data is available for the searched analyst."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user