This commit is contained in:
MuslemRahimi 2024-11-10 14:14:07 +01:00
parent a4f621d5ec
commit 7bd2abb8f0
4 changed files with 33 additions and 19 deletions

View File

@ -405,7 +405,9 @@ export function abbreviateNumber(number, addDollarSign = false) {
: formattedNumber; : formattedNumber;
} else if (Math.abs(number) >= 0 && Math.abs(number) < 1000) { } else if (Math.abs(number) >= 0 && Math.abs(number) < 1000) {
return addDollarSign return addDollarSign
? (negative ? "-$" : "$") + number ? (negative ? "-$" : "$") + Math.abs(number)
: negative
? "-" + Math.abs(number)
: number.toString(); : number.toString();
} else { } else {
return addDollarSign ? "$0" : "0"; return addDollarSign ? "$0" : "0";
@ -413,6 +415,7 @@ export function abbreviateNumber(number, addDollarSign = false) {
} }
export const formatDate = (dateString) => { export const formatDate = (dateString) => {
const date = new Date(dateString); const date = new Date(dateString);
return formatDistanceToNow(date, { return formatDistanceToNow(date, {

View File

@ -3,7 +3,7 @@
numberOfUnreadNotification, numberOfUnreadNotification,
displayCompanyName, displayCompanyName,
screenWidth, screenWidth,
etfTicker, stockTicker,
setCache, setCache,
getCache, getCache,
} from "$lib/store"; } from "$lib/store";
@ -228,7 +228,7 @@
yAxisIndex: 1, // Use the second y-axis on the right yAxisIndex: 1, // Use the second y-axis on the right
data: ivData, // iv60Data (assumed to be passed as ivData) data: ivData, // iv60Data (assumed to be passed as ivData)
itemStyle: { itemStyle: {
color: "#FFD700", // Choose a color for the line (gold in this case) color: "#fff", // Choose a color for the line (gold in this case)
}, },
lineStyle: { lineStyle: {
width: 2, // Set the width of the line width: 2, // Set the width of the line
@ -311,7 +311,7 @@
type: "line", type: "line",
yAxisIndex: 0, yAxisIndex: 0,
itemStyle: { itemStyle: {
color: "#fff", // Change bar color to white color: "#fff",
}, },
showSymbol: false, showSymbol: false,
}, },
@ -474,7 +474,7 @@
isLoaded = false; isLoaded = false;
optionDetailsDesktopModal?.showModal(); optionDetailsDesktopModal?.showModal();
rawDataHistory = await getDailyTransactions($etfTicker + "-" + date); rawDataHistory = await getDailyTransactions($stockTicker + "-" + date);
rawDataHistory?.forEach((item) => { rawDataHistory?.forEach((item) => {
item.dte = daysLeft(item?.date_expiration); item.dte = daysLeft(item?.date_expiration);
@ -538,21 +538,21 @@
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<title> <title>
{$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""}
{$displayCompanyName} ({$etfTicker}) Options Activity · stocknear {$displayCompanyName} ({$stockTicker}) Options Activity · stocknear
</title> </title>
<meta <meta
name="description" name="description"
content={`Detailed informaton of unusual options activity for ${$displayCompanyName} (${$etfTicker}).`} content={`Detailed informaton of unusual options activity for ${$displayCompanyName} (${$stockTicker}).`}
/> />
<!-- Other meta tags --> <!-- Other meta tags -->
<meta <meta
property="og:title" property="og:title"
content={`${$displayCompanyName} (${$etfTicker}) Options Activity · stocknear`} content={`${$displayCompanyName} (${$stockTicker}) Options Activity · stocknear`}
/> />
<meta <meta
property="og:description" property="og:description"
content={`Detailed informaton of unusual options activity for ${$displayCompanyName} (${$etfTicker}).`} content={`Detailed informaton of unusual options activity for ${$displayCompanyName} (${$stockTicker}).`}
/> />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<!-- Add more Open Graph meta tags as needed --> <!-- Add more Open Graph meta tags as needed -->
@ -561,11 +561,11 @@
<meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:card" content="summary_large_image" />
<meta <meta
name="twitter:title" name="twitter:title"
content={`${$displayCompanyName} (${$etfTicker}) Options Activity · stocknear`} content={`${$displayCompanyName} (${$stockTicker}) Options Activity · stocknear`}
/> />
<meta <meta
name="twitter:description" name="twitter:description"
content={`Detailed informaton of unusual options activity for ${$displayCompanyName} (${$etfTicker}).`} content={`Detailed informaton of unusual options activity for ${$displayCompanyName} (${$stockTicker}).`}
/> />
<!-- Add more Twitter meta tags as needed --> <!-- Add more Twitter meta tags as needed -->
</svelte:head> </svelte:head>
@ -764,7 +764,9 @@
<div class="absolute inset-0 rounded-lg bg-[#fff]"></div> <div class="absolute inset-0 rounded-lg bg-[#fff]"></div>
{/if} {/if}
<span <span
class="relative text-sm block font-medium duration-200 text-white" class="relative text-sm block font-semibold {activeEX === i
? 'text-black'
: 'text-white'}"
> >
{item.title} {item.title}
</span> </span>
@ -797,7 +799,9 @@
<div class="absolute inset-0 rounded-lg bg-[#fff]"></div> <div class="absolute inset-0 rounded-lg bg-[#fff]"></div>
{/if} {/if}
<span <span
class="relative text-sm block font-medium duration-200 text-white" class="relative text-sm block font-semibold {activeIdx === i
? 'text-black'
: 'text-white'}"
> >
{item.title} {item.title}
</span> </span>
@ -873,7 +877,7 @@
<tr <tr
on:click={() => handleViewData(item?.date)} on:click={() => handleViewData(item?.date)}
on:mouseover={() => on:mouseover={() =>
getDailyTransactions($etfTicker + "+" + item?.date)} getDailyTransactions($stockTicker + "+" + item?.date)}
class="cursor-pointer sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] odd:bg-[#27272A] border-b-[#09090B] {index + class="cursor-pointer sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] odd:bg-[#27272A] border-b-[#09090B] {index +
1 === 1 ===
optionList?.slice(0, 3)?.length && optionList?.slice(0, 3)?.length &&

View File

@ -447,7 +447,7 @@
</td> </td>
<td <td
class="px-[5px] py-1.5 text-right font-semibold xs:px-2.5 xs:py-2" class="px-[5px] py-1.5 text-right font-semibold xs:px-2.5 xs:py-2"
>{abbreviateNumber(rawData?.revenuePerEmployee, true)}</td >{abbreviateNumber(rawData?.revenuePerEmployee)}</td
> >
</tr><tr class="border-y border-gray-600 odd:bg-[#27272A]" </tr><tr class="border-y border-gray-600 odd:bg-[#27272A]"
><td class="px-[5px] py-1.5 xs:px-2.5 xs:py-2" ><td class="px-[5px] py-1.5 xs:px-2.5 xs:py-2"
@ -455,7 +455,7 @@
</td> </td>
<td <td
class="px-[5px] py-1.5 text-right font-semibold xs:px-2.5 xs:py-2" class="px-[5px] py-1.5 text-right font-semibold xs:px-2.5 xs:py-2"
>{abbreviateNumber(rawData?.profitPerEmployee, true)}</td >{abbreviateNumber(rawData?.profitPerEmployee)}</td
> >
</tr><tr class="border-y border-gray-600 odd:bg-[#27272A]" </tr><tr class="border-y border-gray-600 odd:bg-[#27272A]"
><td class="px-[5px] py-1.5 xs:px-2.5 xs:py-2" ><td class="px-[5px] py-1.5 xs:px-2.5 xs:py-2"

View File

@ -30,6 +30,15 @@
let optionsGrowth; let optionsGrowth;
let dateDistance = false; let dateDistance = false;
function formatWithDollarSign(value) {
if (value == null) return "-";
const negative = value < 0;
const formattedValue = new Intl.NumberFormat("en").format(Math.abs(value));
return negative ? `-$${formattedValue}` : `$${formattedValue}`;
}
let sortBy = "Total"; let sortBy = "Total";
function sortByDate(liste) { function sortByDate(liste) {
@ -487,9 +496,7 @@
class="mt-0.5 text-lg font-semibold bp:text-xl sm:mt-1.5 sm:text-2xl" class="mt-0.5 text-lg font-semibold bp:text-xl sm:mt-1.5 sm:text-2xl"
> >
{#if Number(data?.getStockDeck?.profitPerEmployee)} {#if Number(data?.getStockDeck?.profitPerEmployee)}
${new Intl.NumberFormat("en")?.format( {formatWithDollarSign(data?.getStockDeck?.profitPerEmployee)}
data?.getStockDeck?.profitPerEmployee,
)}
{:else} {:else}
n/a n/a
{/if} {/if}