bugfixing

This commit is contained in:
MuslemRahimi 2024-10-31 16:19:04 +01:00
parent b80a99efc0
commit 811627f30d

View File

@ -2,6 +2,7 @@
import { import {
numberOfUnreadNotification, numberOfUnreadNotification,
displayCompanyName, displayCompanyName,
screenWidth,
stockTicker, stockTicker,
} from "$lib/store"; } from "$lib/store";
import InfoModal from "$lib/components/InfoModal.svelte"; import InfoModal from "$lib/components/InfoModal.svelte";
@ -36,8 +37,8 @@
if (Object?.keys(analystRating)?.length !== 0) { if (Object?.keys(analystRating)?.length !== 0) {
numOfAnalyst = analystRating?.numOfAnalyst; numOfAnalyst = analystRating?.numOfAnalyst;
priceTarget = priceTarget =
analystRating?.priceTarget !== ("n/a" && 0) analystRating?.medianPriceTarget !== ("n/a" && 0)
? analystRating?.priceTarget ? analystRating?.medianPriceTarget
: "-"; : "-";
consensusRating = analystRating?.consensusRating; consensusRating = analystRating?.consensusRating;
changesPercentage = changesPercentage =
@ -93,6 +94,8 @@
window.removeEventListener("scroll", handleScroll); window.removeEventListener("scroll", handleScroll);
}; };
}); });
$: charNumber = $screenWidth < 640 ? 20 : 30;
</script> </script>
<svelte:head> <svelte:head>
@ -251,8 +254,18 @@
>Analyst</td >Analyst</td
> >
<td class="text-white font-semibold text-[1rem] text-start" <td class="text-white font-semibold text-[1rem] text-start"
>Firm</td
>
<td class="text-white font-semibold text-[1rem] text-end"
>Rating</td >Rating</td
> >
<td class="text-white font-semibold text-[1rem] text-end"
>Action</td
>
<td class="text-white font-semibold text-[1rem] text-end"
>Price Target</td
>
<td class="text-white font-semibold text-[1rem] text-end" <td class="text-white font-semibold text-[1rem] text-end"
>Date</td >Date</td
> >
@ -280,11 +293,6 @@
class="sm:hover:text-white text-blue-400" class="sm:hover:text-white text-blue-400"
>{item?.analyst_name} >{item?.analyst_name}
</a> </a>
<span class="text-white"
>{item?.analyst?.length > 15
? item?.analyst?.slice(0, 15) + "..."
: item?.analyst}</span
>
<div class="flex flex-row items-center mt-1"> <div class="flex flex-row items-center mt-1">
{#each Array.from({ length: 5 }) as _, i} {#each Array.from({ length: 5 }) as _, i}
@ -325,31 +333,47 @@
</td> </td>
<td <td
class="text-sm sm:text-[1rem] whitespace-nowrap text-center text-white" class="text-sm sm:text-[1rem] whitespace-nowrap text-start text-white"
> >
<div class="flex flex-col items-start"> {item?.analyst?.length > charNumber
<span ? item?.analyst?.slice(0, charNumber) + "..."
class="text-[1rem] font-medium {[ : item?.analyst}
'Strong Buy', </td>
'Buy',
]?.includes(item?.rating_current) <td
? 'text-[#00FC50]' class="text-sm sm:text-[1rem] whitespace-nowrap text-end text-white"
: item?.rating_current === 'Hold' >
? 'text-[#FF7070]' <span
: ['Strong Sell', 'Sell']?.includes( class="text-[1rem] font-medium {[
item?.rating_current, 'Strong Buy',
) 'Buy',
? 'text-[#FF2F1F]' ]?.includes(item?.rating_current)
: ''}" ? 'text-[#00FC50]'
> : item?.rating_current === 'Hold'
{item?.rating_current} ? 'text-[#FF7070]'
</span> : ['Strong Sell', 'Sell']?.includes(
<span class="font-medium text-white" item?.rating_current,
>{item?.action_company?.replace( )
"Initiates Coverage On", ? 'text-[#FF2F1F]'
"Initiates", : ''}"
)}</span >
> {item?.rating_current}
</span>
</td>
<td
class="text-sm sm:text-[1rem] whitespace-nowrap text-end text-white"
>
{item?.action_company?.replace(
"Initiates Coverage On",
"Initiates",
)}
</td>
<td
class="text-sm sm:text-[1rem] whitespace-nowrap text-end text-white"
>
<div class="flex flex-col items-end">
<div class="flex flex-row items-center"> <div class="flex flex-row items-center">
{#if Math?.ceil(item?.adjusted_pt_prior) !== 0} {#if Math?.ceil(item?.adjusted_pt_prior) !== 0}
<span class="text-gray-100 font-normal" <span class="text-gray-100 font-normal"