bugfixing

This commit is contained in:
MuslemRahimi 2024-11-27 16:23:02 +01:00
parent 419279453e
commit ef6e0d2261

View File

@ -34,36 +34,61 @@
let lowEPSList = []; let lowEPSList = [];
let highEPSList = []; let highEPSList = [];
let revenueGrowthList = []; let revenueAvgGrowthList = [];
let epsGrowthList = []; let revenueLowGrowthList = [];
let epsAvgGrowthList = [];
let displayData = "Revenue"; let displayData = "Revenue";
function computeGrowthSingleList(data, actualList) { function fillMissingDates(dates, highGrowthList) {
let lastNonNull = actualList // Create a map from the highGrowthList for quick lookup
?.filter((value) => value !== null) const highGrowthMap = new Map(
.slice(-1)[0]; highGrowthList?.map((item) => [`FY${item.FY}`, item]),
const newList = data; );
newList?.unshift(lastNonNull);
// Remove leading null values
while (newList?.length > 0 && newList[0] === null) {
newList?.shift();
}
let growthPercentages = []; // Generate the complete list based on the dates array
return dates.map(
(date) =>
highGrowthMap.get(date) || {
FY: date?.slice(2),
val: null,
growth: null,
},
);
}
function computeGrowthSingleList(data, actualList) {
// Find the last non-null entry in actualList
let lastNonNull = actualList
?.filter((entry) => entry?.val !== null)
?.slice(-1)[0];
// Add the last non-null entry from actualList to the beginning of data
const newList = [lastNonNull, ...data];
// Calculate growth and include it in the objects
let resultList = [];
for (let i = 1; i < newList?.length; i++) { for (let i = 1; i < newList?.length; i++) {
let previous = newList[i - 1]; let previous = newList[i - 1];
let current = newList[i]; let current = newList[i];
// Check if previous or current is null to avoid NaN results // Calculate growth only if both values are non-null
if (previous !== null && current !== null) { let growth = null;
let growth = (((current - previous) / previous) * 100)?.toFixed(2); if (previous.val !== null && current.val !== null) {
growthPercentages.push(Number(growth)); // Convert to number growth = (((current.val - previous.val) / previous.val) * 100)?.toFixed(
2,
);
} }
}
return growthPercentages; // Add FY, val, and growth to the result list
resultList.push({
FY: current.FY,
val: current.val,
growth: growth !== null ? Number(growth) : null, // Convert growth to number or leave as null
});
}
return resultList;
} }
function computeGrowthList(tableActualRevenue, tableForecastRevenue) { function computeGrowthList(tableActualRevenue, tableForecastRevenue) {
@ -188,26 +213,48 @@
// Assign to global variables based on dataType // Assign to global variables based on dataType
if (dataType === "Revenue") { if (dataType === "Revenue") {
revenueDateList = dates?.slice(currentYearIndex) || []; revenueDateList = dates?.slice(currentYearIndex) || [];
avgRevenueList = avgList?.slice(currentYearIndex) || []; avgRevenueList =
lowRevenueList = lowList?.slice(currentYearIndex) || []; avgList?.slice(currentYearIndex)?.map((val, index) => ({
highRevenueList = highList?.slice(currentYearIndex) || []; FY: revenueDateList[index]?.slice(2),
val: val,
})) || [];
lowRevenueList =
lowList?.slice(currentYearIndex)?.map((val, index) => ({
FY: revenueDateList[index]?.slice(2),
val: val,
})) || [];
highRevenueList =
highList?.slice(currentYearIndex)?.map((val, index) => ({
FY: revenueDateList[index]?.slice(2),
val: val,
})) || [];
} else if (dataType === "EPS") { } else if (dataType === "EPS") {
epsDateList = dates?.slice(currentYearIndex) || []; epsDateList = dates?.slice(currentYearIndex) || [];
avgEPSList = avgList?.slice(currentYearIndex) || []; avgEPSList =
lowEPSList = lowList?.slice(currentYearIndex) || []; avgList?.slice(currentYearIndex)?.map((val, index) => ({
highEPSList = highList?.slice(currentYearIndex) || []; FY: epsDateList[index]?.slice(2),
val: val,
})) || [];
lowEPSList =
lowList?.slice(currentYearIndex)?.map((val, index) => ({
FY: epsDateList[index]?.slice(2),
val: val,
})) || [];
highEPSList =
highList?.slice(currentYearIndex)?.map((val, index) => ({
FY: epsDateList[index]?.slice(2),
val: val,
})) || [];
} }
const growthList = dates.map((date) => { const growthList = dates?.map((date) => {
const fy = parseInt(date.replace("FY", ""), 10); // Extract numeric FY value const fy = parseInt(date.replace("FY", ""), 10); // Extract numeric FY value
const listToUse = const listToUse =
dataType === "Revenue" ? revenueGrowthList : epsGrowthList; // Select the correct growth list dataType === "Revenue" ? revenueAvgGrowthList : epsAvgGrowthList; // Select the correct growth list
const growth = listToUse.find((r) => r.FY === fy); // Find matching FY const growth = listToUse.find((r) => r.FY === fy); // Find matching FY
return growth ? growth.growth : null; // Return growth or null if not found return growth ? growth?.growth : null; // Return growth or null if not found
}); });
console.log(growthList);
const option = { const option = {
silent: true, silent: true,
tooltip: { tooltip: {
@ -294,6 +341,32 @@
], ],
}; };
let highGrowthList = [];
let lowGrowthList = [];
if (dataType === "Revenue") {
highGrowthList = computeGrowthSingleList(
highRevenueList,
tableActualRevenue,
);
lowGrowthList = computeGrowthSingleList(
lowRevenueList,
tableActualRevenue,
);
} else {
highGrowthList = computeGrowthSingleList(highEPSList, tableActualEPS);
lowGrowthList = computeGrowthSingleList(lowEPSList, tableActualEPS);
}
console.log(highGrowthList);
highGrowthList = fillMissingDates(dates, highGrowthList)?.map(
(item) => item?.growth,
);
console.log(highGrowthList);
lowGrowthList = fillMissingDates(dates, lowGrowthList)?.map(
(item) => item?.growth,
);
const optionsGrowth = { const optionsGrowth = {
animation: false, animation: false,
grid: { grid: {
@ -341,8 +414,18 @@
renderItem: (params, api) => { renderItem: (params, api) => {
const xValue = api.value(0); const xValue = api.value(0);
const yValue = api.value(1); const yValue = api.value(1);
const high = yValue + yValue / 2; // High value (half above the value)
const low = yValue - yValue / 2; // Low value (half below the value) // Select high and low lists based on dataType
const highList = highGrowthList;
const lowList = lowGrowthList;
// Retrieve the corresponding high and low values
const high = highList[params.dataIndex];
const low = lowList[params.dataIndex];
// Skip rendering error bars if high or low values are null or undefined
if (high == null || low == null) return; // Null or undefined values are skipped
const x = api.coord([xValue, yValue])[0]; const x = api.coord([xValue, yValue])[0];
const highCoord = api.coord([xValue, high])[1]; const highCoord = api.coord([xValue, high])[1];
const lowCoord = api.coord([xValue, low])[1]; const lowCoord = api.coord([xValue, low])[1];
@ -360,7 +443,7 @@
}, },
style: { style: {
stroke: "#fff", stroke: "#fff",
lineWidth: 1.5, // Set thicker line width lineWidth: 2, // Set thicker line width
}, },
}, },
{ {
@ -373,7 +456,7 @@
}, },
style: { style: {
stroke: "#fff", stroke: "#fff",
lineWidth: 1.5, // Set thicker line width lineWidth: 2, // Set thicker line width
}, },
}, },
{ {
@ -386,7 +469,7 @@
}, },
style: { style: {
stroke: "#fff", stroke: "#fff",
lineWidth: 1.5, // Set thicker line width lineWidth: 2, // Set thicker line width
}, },
}, },
], ],
@ -405,14 +488,20 @@
formatter: (params) => { formatter: (params) => {
const dataIndex = params[0].dataIndex; const dataIndex = params[0].dataIndex;
const mainValue = params[0].value; const mainValue = params[0].value;
const high = mainValue + mainValue / 2;
const low = mainValue - mainValue / 2; // Select high and low lists based on dataType
const highList = highGrowthList;
const lowList = lowGrowthList;
// Retrieve the corresponding high and low values
const high = highList[dataIndex];
const low = lowList[dataIndex];
return ` return `
<b>${dates[dataIndex]}</b><br> <b>${dates[dataIndex]}</b><br>
High: ${high?.toFixed(2) + "%"}<br> High: ${high ? high?.toFixed(2) : "N/A"}<br>
Avg: ${mainValue?.toFixed(2) + "%"}<br> Avg: ${mainValue?.toFixed(2)}<br>
Low: ${low?.toFixed(2) + "%"} Low: ${low ? low?.toFixed(2) : "N/A"}
`; `;
}, },
}, },
@ -435,8 +524,8 @@
tableActualEPS = []; tableActualEPS = [];
tableForecastEPS = []; tableForecastEPS = [];
revenueGrowthList = []; revenueAvgGrowthList = [];
epsGrowthList = []; epsAvgGrowthList = [];
let filteredData = let filteredData =
analystEstimateList?.filter((item) => item.date >= 2015) ?? []; analystEstimateList?.filter((item) => item.date >= 2015) ?? [];
@ -467,12 +556,12 @@
}); });
}); });
//Values coincide with table values for crosscheck //Values coincide with table values for crosscheck
revenueGrowthList = computeGrowthList( revenueAvgGrowthList = computeGrowthList(
tableActualRevenue, tableActualRevenue,
tableForecastRevenue, tableForecastRevenue,
); );
epsGrowthList = computeGrowthList(tableActualEPS, tableForecastEPS); epsAvgGrowthList = computeGrowthList(tableActualEPS, tableForecastEPS);
} }
$: { $: {
@ -724,7 +813,7 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>High</td >High</td
> >
{#each highRevenueList as val, index} {#each highRevenueList as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= highRevenueList?.length - 2} {#if data?.user?.tier !== "Pro" && index >= highRevenueList?.length - 2}
<a <a
@ -741,7 +830,7 @@
></a ></a
> >
{:else} {:else}
{abbreviateNumber(val)} {abbreviateNumber(item?.val)}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -749,7 +838,7 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>Avg</td >Avg</td
> >
{#each avgRevenueList as val, index} {#each avgRevenueList as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= avgRevenueList?.length - 2} {#if data?.user?.tier !== "Pro" && index >= avgRevenueList?.length - 2}
<a <a
@ -766,7 +855,7 @@
></a ></a
> >
{:else} {:else}
{abbreviateNumber(val)} {abbreviateNumber(item?.val)}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -774,7 +863,7 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>Low</td >Low</td
> >
{#each lowRevenueList as val, index} {#each lowRevenueList as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= lowRevenueList?.length - 2} {#if data?.user?.tier !== "Pro" && index >= lowRevenueList?.length - 2}
<a <a
@ -791,7 +880,7 @@
></a ></a
> >
{:else} {:else}
{abbreviateNumber(val)} {abbreviateNumber(item?.val)}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -821,9 +910,9 @@
class="p-1 text-left font-semibold text-sm sm:text-[1rem]" class="p-1 text-left font-semibold text-sm sm:text-[1rem]"
>Revenue Growth</th >Revenue Growth</th
> >
{#each revenueDateList as date} {#each revenueDateList as date, index}
<th class="p-1 font-semibold text-sm sm:text-[1rem]" <th class="p-1 font-semibold text-sm sm:text-[1rem]"
>{date}</th >{#if index !== 0}{date}{/if}</th
> >
{/each} {/each}
</tr></thead </tr></thead
@ -833,34 +922,37 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>High</td >High</td
> >
{#each computeGrowthSingleList(highRevenueList, tableActualRevenue) as val, index} {#each computeGrowthSingleList(highRevenueList, tableActualRevenue) as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= highRevenueList?.length - 2} {#if index !== 0}
<a {#if data?.user?.tier !== "Pro" && index >= highRevenueList?.length - 2}
class="inline-block ml-0.5 text-white" <a
href="/pricing" class="inline-block ml-0.5 text-white"
>Pro<svg href="/pricing"
class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]" >Pro<svg
xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
><path viewBox="0 0 24 24"
fill="currentColor" ><path
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z" fill="currentColor"
/></svg d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
></a /></svg
> ></a
{:else} >
<span {:else}
class={val !== null && val > 0 <span
? "text-[#00FC50] before:content-['+']" class={item?.growth !== null && item?.growth > 0
: val < 0 ? "text-[#00FC50] before:content-['+']"
? "text-[#FF2F1F]" : item?.growth < 0
: "text-white"} ? "text-[#FF2F1F]"
> : "text-white"}
{val !== null && Math.abs(val - 0) > 0 >
? abbreviateNumber(val) + "%" {item?.growth !== null &&
: "-"} Math.abs(item?.growth - 0) > 0
</span> ? abbreviateNumber(item?.growth) + "%"
: "-"}
</span>
{/if}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -868,34 +960,37 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>Avg</td >Avg</td
> >
{#each computeGrowthSingleList(avgRevenueList, tableActualRevenue) as val, index} {#each computeGrowthSingleList(avgRevenueList, tableActualRevenue) as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= avgRevenueList?.length - 2} {#if index !== 0}
<a {#if data?.user?.tier !== "Pro" && index >= avgRevenueList?.length - 2}
class="inline-block ml-0.5 text-white" <a
href="/pricing" class="inline-block ml-0.5 text-white"
>Pro<svg href="/pricing"
class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]" >Pro<svg
xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
><path viewBox="0 0 24 24"
fill="currentColor" ><path
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z" fill="currentColor"
/></svg d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
></a /></svg
> ></a
{:else} >
<span {:else}
class={val !== null && val > 0 <span
? "text-[#00FC50] before:content-['+']" class={item?.growth !== null && item?.growth > 0
: val < 0 ? "text-[#00FC50] before:content-['+']"
? "text-[#FF2F1F]" : item?.growth < 0
: "text-white"} ? "text-[#FF2F1F]"
> : "text-white"}
{val !== null && Math.abs(val - 0) > 0 >
? abbreviateNumber(val) + "%" {item?.growth !== null &&
: "-"} Math.abs(item?.growth - 0) > 0
</span> ? abbreviateNumber(item?.growth) + "%"
: "-"}
</span>
{/if}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -903,34 +998,37 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>Low</td >Low</td
> >
{#each computeGrowthSingleList(lowRevenueList, tableActualRevenue) as val, index} {#each computeGrowthSingleList(lowRevenueList, tableActualRevenue) as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= lowRevenueList?.length - 2} {#if index !== 0}
<a {#if data?.user?.tier !== "Pro" && index >= lowRevenueList?.length - 2}
class="inline-block ml-0.5 text-white" <a
href="/pricing" class="inline-block ml-0.5 text-white"
>Pro<svg href="/pricing"
class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]" >Pro<svg
xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
><path viewBox="0 0 24 24"
fill="currentColor" ><path
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z" fill="currentColor"
/></svg d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
></a /></svg
> ></a
{:else} >
<span {:else}
class={val !== null && val > 0 <span
? "text-[#00FC50] before:content-['+']" class={item?.growth !== null && item?.growth > 0
: val < 0 ? "text-[#00FC50] before:content-['+']"
? "text-[#FF2F1F]" : item?.growth < 0
: "text-white"} ? "text-[#FF2F1F]"
> : "text-white"}
{val !== null && Math.abs(val - 0) > 0 >
? abbreviateNumber(val) + "%" {item?.growth !== null &&
: "-"} Math.abs(item?.growth - 0) > 0
</span> ? abbreviateNumber(item?.growth) + "%"
: "-"}
</span>
{/if}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -972,7 +1070,7 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>High</td >High</td
> >
{#each highEPSList as val, index} {#each highEPSList as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= highEPSList?.length - 2} {#if data?.user?.tier !== "Pro" && index >= highEPSList?.length - 2}
<a <a
@ -989,7 +1087,7 @@
></a ></a
> >
{:else} {:else}
{abbreviateNumber(val)} {abbreviateNumber(item?.val)}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -997,7 +1095,7 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>Avg</td >Avg</td
> >
{#each avgEPSList as val, index} {#each avgEPSList as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= avgEPSList?.length - 2} {#if data?.user?.tier !== "Pro" && index >= avgEPSList?.length - 2}
<a <a
@ -1014,7 +1112,7 @@
></a ></a
> >
{:else} {:else}
{abbreviateNumber(val)} {abbreviateNumber(item?.val)}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -1022,7 +1120,7 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>Low</td >Low</td
> >
{#each lowEPSList as val, index} {#each lowEPSList as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= lowEPSList?.length - 2} {#if data?.user?.tier !== "Pro" && index >= lowEPSList?.length - 2}
<a <a
@ -1039,7 +1137,7 @@
></a ></a
> >
{:else} {:else}
{abbreviateNumber(val)} {abbreviateNumber(item?.val)}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -1067,9 +1165,9 @@
class="p-1 text-left font-semibold text-sm sm:text-[1rem]" class="p-1 text-left font-semibold text-sm sm:text-[1rem]"
>EPS Growth</th >EPS Growth</th
> >
{#each epsDateList as date} {#each epsDateList as date, index}
<th class="p-1 font-semibold text-sm sm:text-[1rem]" <th class="p-1 font-semibold text-sm sm:text-[1rem]"
>{date}</th >{#if index !== 0}{date}{/if}</th
> >
{/each} {/each}
</tr></thead </tr></thead
@ -1080,34 +1178,37 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>High</td >High</td
> >
{#each computeGrowthSingleList(highEPSList, tableActualEPS) as val, index} {#each computeGrowthSingleList(highEPSList, tableActualEPS) as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= highEPSList?.length - 2} {#if index !== 0}
<a {#if data?.user?.tier !== "Pro" && index >= highEPSList?.length - 2}
class="inline-block ml-0.5 text-white" <a
href="/pricing" class="inline-block ml-0.5 text-white"
>Pro<svg href="/pricing"
class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]" >Pro<svg
xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
><path viewBox="0 0 24 24"
fill="currentColor" ><path
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z" fill="currentColor"
/></svg d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
></a /></svg
> ></a
{:else} >
<span {:else}
class={val !== null && val > 0 <span
? "text-[#00FC50] before:content-['+']" class={item?.growth !== null && item?.growth > 0
: val < 0 ? "text-[#00FC50] before:content-['+']"
? "text-[#FF2F1F]" : item?.growth < 0
: "text-white"} ? "text-[#FF2F1F]"
> : "text-white"}
{val !== null && Math.abs(val - 0) > 0 >
? abbreviateNumber(val) + "%" {item?.growth !== null &&
: "-"} Math.abs(item?.growth - 0) > 0
</span> ? abbreviateNumber(item?.growth) + "%"
: "-"}
</span>
{/if}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -1115,34 +1216,37 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>Avg</td >Avg</td
> >
{#each computeGrowthSingleList(avgEPSList, tableActualEPS) as val, index} {#each computeGrowthSingleList(avgEPSList, tableActualEPS) as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= avgEPSList?.length - 2} {#if index !== 0}
<a {#if data?.user?.tier !== "Pro" && index >= avgEPSList?.length - 2}
class="inline-block ml-0.5 text-white" <a
href="/pricing" class="inline-block ml-0.5 text-white"
>Pro<svg href="/pricing"
class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]" >Pro<svg
xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
><path viewBox="0 0 24 24"
fill="currentColor" ><path
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z" fill="currentColor"
/></svg d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
></a /></svg
> ></a
{:else} >
<span {:else}
class={val !== null && val > 0 <span
? "text-[#00FC50] before:content-['+']" class={item?.growth !== null && item?.growth > 0
: val < 0 ? "text-[#00FC50] before:content-['+']"
? "text-[#FF2F1F]" : item?.growth < 0
: "text-white"} ? "text-[#FF2F1F]"
> : "text-white"}
{val !== null && Math.abs(val - 0) > 0 >
? abbreviateNumber(val) + "%" {item?.growth !== null &&
: "-"} Math.abs(item?.growth - 0) > 0
</span> ? abbreviateNumber(item?.growth) + "%"
: "-"}
</span>
{/if}
{/if} {/if}
</td> </td>
{/each} {/each}
@ -1150,34 +1254,37 @@
><td class="whitespace-nowrap px-1 py-[3px] text-left" ><td class="whitespace-nowrap px-1 py-[3px] text-left"
>Low</td >Low</td
> >
{#each computeGrowthSingleList(lowEPSList, tableActualEPS) as val, index} {#each computeGrowthSingleList(lowEPSList, tableActualEPS) as item, index}
<td class="px-1 py-[3px] text-sm sm:text-[1rem]"> <td class="px-1 py-[3px] text-sm sm:text-[1rem]">
{#if data?.user?.tier !== "Pro" && index >= lowEPSList?.length - 2} {#if index !== 0}
<a {#if data?.user?.tier !== "Pro" && index >= lowEPSList?.length - 2}
class="inline-block ml-0.5 text-white" <a
href="/pricing" class="inline-block ml-0.5 text-white"
>Pro<svg href="/pricing"
class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]" >Pro<svg
xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 ml-0.5 mb-1 inline-block text-[#A3A3A3]"
viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
><path viewBox="0 0 24 24"
fill="currentColor" ><path
d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z" fill="currentColor"
/></svg d="M17 9V7c0-2.8-2.2-5-5-5S7 4.2 7 7v2c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h10c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3M9 7c0-1.7 1.3-3 3-3s3 1.3 3 3v2H9z"
></a /></svg
> ></a
{:else} >
<span {:else}
class={val !== null && val > 0 <span
? "text-[#00FC50] before:content-['+']" class={item?.growth !== null && item?.growth > 0
: val < 0 ? "text-[#00FC50] before:content-['+']"
? "text-[#FF2F1F]" : item?.growth < 0
: "text-white"} ? "text-[#FF2F1F]"
> : "text-white"}
{val !== null && Math.abs(val - 0) > 0 >
? abbreviateNumber(val) + "%" {item?.growth !== null &&
: "-"} Math.abs(item?.growth - 0) > 0
</span> ? abbreviateNumber(item?.growth) + "%"
: "-"}
</span>
{/if}
{/if} {/if}
</td> </td>
{/each} {/each}