0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Updated discount in account home page

This commit is contained in:
Peter Zimon 2022-01-05 15:03:53 +01:00
parent 86a8abdf30
commit 1a25cac7ad
4 changed files with 33 additions and 14 deletions

View file

@ -18,8 +18,8 @@ const React = require('react');
const DEV_MODE_DATA = { const DEV_MODE_DATA = {
showPopup: true, showPopup: true,
site: Fixtures.site, site: Fixtures.site,
member: Fixtures.member.free, member: Fixtures.member.paid,
page: 'offer', page: 'accountHome',
pageData: Fixtures.offer pageData: Fixtures.offer
}; };

View file

@ -250,7 +250,7 @@ const FrameStyles = `
letter-spacing: 0; letter-spacing: 0;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
background: var(--white); background: var(--white);
width: 400px; width: 440px;
margin: 0 auto; margin: 0 auto;
border-radius: 5px; border-radius: 5px;
box-shadow: 0 3.8px 2.2px rgba(0, 0, 0, 0.028), 0 9.2px 5.3px rgba(0, 0, 0, 0.04), 0 17.3px 10px rgba(0, 0, 0, 0.05), 0 30.8px 17.9px rgba(0, 0, 0, 0.06), 0 57.7px 33.4px rgba(0, 0, 0, 0.072), 0 138px 80px rgba(0, 0, 0, 0.1); box-shadow: 0 3.8px 2.2px rgba(0, 0, 0, 0.028), 0 9.2px 5.3px rgba(0, 0, 0, 0.04), 0 17.3px 10px rgba(0, 0, 0, 0.05), 0 30.8px 17.9px rgba(0, 0, 0, 0.06), 0 57.7px 33.4px rgba(0, 0, 0, 0.072), 0 138px 80px rgba(0, 0, 0, 0.1);
@ -472,7 +472,7 @@ const FrameStyles = `
letter-spacing: 0.3px; letter-spacing: 0.3px;
line-height: 1.25em; line-height: 1.25em;
padding: 0; padding: 0;
margin: 2px 0 0; margin: 4px 0 0;
color: var(--grey6); color: var(--grey6);
} }

View file

@ -99,6 +99,25 @@ export const AccountHomePageStyles = `
margin-right: 12px; margin-right: 12px;
border-radius: 2px; border-radius: 2px;
} }
.gh-portal-account-discountcontainer {
position: relative;
display: flex;
align-items: center;
}
.gh-portal-account-old-price {
text-decoration: line-through;
color: var(--grey9) !important;
}
.gh-portal-account-tagicon {
width: 16px;
height: 16px;
color: var(--brandcolor);
margin-right: 5px;
z-index: 999;
}
`; `;
const UserAvatar = ({avatar, brandColor}) => { const UserAvatar = ({avatar, brandColor}) => {
@ -152,7 +171,7 @@ function getOfferLabel({offer, price, subscriptionStartDate}) {
let offerEndDate = new Date(offerStartDate.setMonth(offerStartDate.getMonth() + durationInMonths)); let offerEndDate = new Date(offerStartDate.setMonth(offerStartDate.getMonth() + durationInMonths));
durationLabel = `Ends ${getDateString(offerEndDate)}`; durationLabel = `Ends ${getDateString(offerEndDate)}`;
} }
offerLabel = `${getUpdatedOfferPrice({offer, price, useFormatted: true})}/${price.interval} - ${durationLabel}`; offerLabel = `${getUpdatedOfferPrice({offer, price, useFormatted: true})}/${price.interval}${durationLabel ? ` ${durationLabel}` : ``}`;
} }
return offerLabel; return offerLabel;
} }
@ -191,14 +210,14 @@ const PaidAccountActions = () => {
} }
let oldPriceClassName = ''; let oldPriceClassName = '';
if (offerLabelStr) { if (offerLabelStr) {
oldPriceClassName = 'old-price'; oldPriceClassName = 'gh-portal-account-old-price';
} }
const OfferLabel = () => { const OfferLabel = () => {
if (offerLabelStr) { if (offerLabelStr) {
return ( return (
<p> <p className="gh-portal-account-discountcontainer">
<OfferTagIcon style={{width: '12px', height: '9px', marginLeft: '-10px'}}/> <OfferTagIcon className="gh-portal-account-tagicon" />
{offerLabelStr} <span>{offerLabelStr}</span>
</p> </p>
); );
} }

View file

@ -53,7 +53,7 @@ function getOfferData({
type = 'percent', type = 'percent',
cadence = 'month', cadence = 'month',
amount = 50, amount = 50,
duration = 'once', duration = 'repeating',
durationInMonths = null, durationInMonths = null,
currencyRestriction = false, currencyRestriction = false,
currency = null, currency = null,
@ -86,7 +86,7 @@ function getMemberData({
email = 'jamie@example.com', email = 'jamie@example.com',
firstname = 'Jamie', firstname = 'Jamie',
subscriptions = [], subscriptions = [],
paid = false, paid = true,
avatarImage: avatar_image = '', avatarImage: avatar_image = '',
subscribed = true subscribed = true
} = {}) { } = {}) {
@ -131,7 +131,7 @@ export function getProductsData({numOfProducts = 3} = {}) {
numOfBenefits: 3 numOfBenefits: 3
}), }),
getProductData({ getProductData({
name: 'Friends of the browser', name: 'Friends of the Blueprint',
description: 'Get access to everything and lock in early adopter pricing for life + listen to my podcast', description: 'Get access to everything and lock in early adopter pricing for life + listen to my podcast',
monthlyPrice: getPriceData({ monthlyPrice: getPriceData({
interval: 'month', interval: 'month',
@ -162,7 +162,6 @@ function getProductData({
monthlyPrice, monthlyPrice,
yearlyPrice, yearlyPrice,
benefits: getBenefits({numOfBenefits}) benefits: getBenefits({numOfBenefits})
}; };
} }
@ -213,7 +212,7 @@ function getSubscriptionData({
id = `sub_${objectId()}`, id = `sub_${objectId()}`,
status = 'active', status = 'active',
currency = 'USD', currency = 'USD',
interval = 'month', interval = 'year',
amount = (interval === 'month' ? 500 : 5000), amount = (interval === 'month' ? 500 : 5000),
nickname = (interval === 'month' ? 'Monthly' : 'Yearly'), nickname = (interval === 'month' ? 'Monthly' : 'Yearly'),
cardLast4 = '4242', cardLast4 = '4242',
@ -236,6 +235,7 @@ function getSubscriptionData({
interval, interval,
currency currency
}, },
offer,
status, status,
start_date, start_date,
default_payment_card_last4: cardLast4, default_payment_card_last4: cardLast4,