Add profit, styling

This commit is contained in:
Ian Philips 2022-09-23 12:19:12 -04:00
parent 90bf425acf
commit 9a2b24524e
3 changed files with 16 additions and 4 deletions

View File

@ -10,8 +10,8 @@ const formatter = new Intl.NumberFormat('en-US', {
export function formatMoney(amount: number, explicitPositiveSign?: boolean) { export function formatMoney(amount: number, explicitPositiveSign?: boolean) {
const newAmount = Math.round(amount) === 0 ? 0 : Math.floor(amount) // handle -0 case const newAmount = Math.round(amount) === 0 ? 0 : Math.floor(amount) // handle -0 case
return ( return (
(explicitPositiveSign && newAmount > 0 ? '+' : '') +
ENV_CONFIG.moneyMoniker + ENV_CONFIG.moneyMoniker +
(explicitPositiveSign && newAmount > 0 ? '+' : '') +
formatter.format(newAmount).replace('$', '') formatter.format(newAmount).replace('$', '')
) )
} }

View File

@ -51,7 +51,7 @@
margin: 0; vertical-align: middle;font-size:16px;display: inline; padding: 2px; border-radius: 5px; margin: 0; vertical-align: middle;font-size:16px;display: inline; padding: 2px; border-radius: 5px;
} }
p.prob{ p.prob{
font-size: 20px;display: inline; vertical-align: middle; font-size: 20px;display: inline; vertical-align: middle; font-weight: bold;
} }
a.question{ a.question{
font-size: 18px;display: inline; vertical-align: middle; padding-bottom: 25px; font-size: 18px;display: inline; vertical-align: middle; padding-bottom: 25px;
@ -229,7 +229,7 @@
<div <div
style="font-family:Arial, sans-serif;font-size:18px;letter-spacing:normal;line-height:1;text-align:left;color:#000000;"> style="font-family:Arial, sans-serif;font-size:18px;letter-spacing:normal;line-height:1;text-align:left;color:#000000;">
<p class="text-build-content" <p class="text-build-content"
style="line-height: 24px; margin: 10px 0; margin-top: 10px; margin-bottom: 10px;" style="line-height: 24px; margin: 10px 0; margin-top: 10px; margin-bottom: 0px;"
data-testid="4XoHRGw1Y"> data-testid="4XoHRGw1Y">
<span style="color:#000000;font-family:Arial, Helvetica, sans-serif;font-size:18px;"> <span style="color:#000000;font-family:Arial, Helvetica, sans-serif;font-size:18px;">
We ran the numbers and here's how you did this past week! We ran the numbers and here's how you did this past week!
@ -240,8 +240,18 @@
</tr> </tr>
<!--/ show 5 columns with headers titled: Investment value, 7-day change, current balance, tips received, and markets made/--> <!--/ show 5 columns with headers titled: Investment value, 7-day change, current balance, tips received, and markets made/-->
<tr> <tr>
<tr>
<th>
Profit
</th>
</tr>
<tr >
<td style='padding-bottom: 30px'>
{{profit}}
</td>
</tr>
<td align="center" <td align="center"
style="font-size:0px;padding:10px 25px;padding-top:0px;padding-bottom:0px;word-break:break-word;"> style="font-size:0px;padding:10px 20px;padding-top:0px;padding-bottom:0px;word-break:break-word;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" <table border="0" cellpadding="0" cellspacing="0" role="presentation"
style="border-collapse:collapse;border-spacing:0px;"> style="border-collapse:collapse;border-spacing:0px;">
<tbody> <tbody>

View File

@ -165,6 +165,7 @@ export async function sendPortfolioUpdateEmailsToAllUsers() {
) )
// get the difference // get the difference
const performanceData = { const performanceData = {
profit: formatMoney(user.profitCached.weekly, true),
investment_value: formatMoney( investment_value: formatMoney(
mostRecentPortfolioMetrics.investmentValue mostRecentPortfolioMetrics.investmentValue
), ),
@ -283,6 +284,7 @@ export type PerContractInvestmentsData = {
questionChangeStyle: string questionChangeStyle: string
} }
export type OverallPerformanceData = { export type OverallPerformanceData = {
profit: string
tips_received_style: string tips_received_style: string
investment_change_style: string investment_change_style: string
investment_value: string investment_value: string