Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
248 commits
Select commit Hold shift + click to select a range
c51da9b
Starting
Nov 24, 2019
486cc33
Continue
Nov 24, 2019
e483293
Continue
Nov 25, 2019
6e0270f
Export components
Nov 25, 2019
29133a8
Review
Nov 25, 2019
814dade
Review
Nov 25, 2019
49f6247
Continue
EpokK Nov 27, 2019
9b47250
Continue
Nov 27, 2019
b7dfc02
Continue
Nov 29, 2019
709007f
Continue
Nov 29, 2019
10b914e
Continue
Nov 29, 2019
ecbf9fe
Continue
Nov 29, 2019
ad107d2
Continue
EpokK Dec 4, 2019
3371c5a
Continue
EpokK Dec 5, 2019
477ee53
Continue
EpokK Dec 6, 2019
d3810b1
Continue
EpokK Dec 6, 2019
912b87b
Continue
EpokK Dec 9, 2019
50918ee
Continue
EpokK Dec 9, 2019
40ad5c4
Continue
EpokK Dec 9, 2019
0e4547f
Continue
EpokK Dec 9, 2019
0101d47
Continue
EpokK Dec 10, 2019
06fe1c2
Continue
EpokK Dec 10, 2019
4436494
Continue
EpokK Dec 10, 2019
a2105ff
Continue
EpokK Dec 12, 2019
b79770f
Continue
EpokK Dec 12, 2019
8d5c59b
Continue
EpokK Dec 12, 2019
fd3ca46
Continue
EpokK Dec 13, 2019
cf70db7
Continue
EpokK Dec 13, 2019
8cfb860
Continue
EpokK Dec 17, 2019
f1e49cb
Add VPN icons
EpokK Dec 17, 2019
38ef96e
Continue
EpokK Dec 18, 2019
d41ee00
Continue
EpokK Dec 19, 2019
53126a0
Continue
EpokK Dec 19, 2019
253f891
Continue
EpokK Dec 19, 2019
586d009
Continue
EpokK Dec 20, 2019
ac57840
Continue
EpokK Dec 20, 2019
af99d5d
Update style for black mode
EpokK Jan 6, 2020
b342970
Review
EpokK Jan 6, 2020
345a252
Review
EpokK Jan 6, 2020
337203f
Review
EpokK Jan 6, 2020
69bc11c
Fix - UI/responsive fixes
nico3333fr Jan 7, 2020
7287e35
Fix - some alignments
nico3333fr Jan 7, 2020
d942f6c
Fix - spacing in responsive
nico3333fr Jan 7, 2020
5520320
Handle VPN plans in PlansSection component
EpokK Jan 8, 2020
f6c11cd
Update components/image/QRCode.js
EpokK Jan 8, 2020
59cb289
Review with @econdepe
EpokK Jan 8, 2020
49ba8a5
Update containers/payments/Card.js
EpokK Jan 8, 2020
6d75e01
Update containers/payments/Card.js
EpokK Jan 8, 2020
46a2ab8
Review
EpokK Jan 8, 2020
8fade43
Update containers/payments/subscription/SubscriptionAddonRow.js
EpokK Jan 8, 2020
26793bd
Review
EpokK Jan 8, 2020
1fd9598
Review with @mmso
EpokK Jan 8, 2020
3afa991
Review with @econdepe
EpokK Jan 8, 2020
dd6a796
Review
EpokK Jan 8, 2020
6a26919
Click on customize on FREE plan should display the modal
EpokK Jan 8, 2020
98630bc
Hotfix from QA
EpokK Jan 8, 2020
1011652
Review with QA
EpokK Jan 8, 2020
8ffd5fa
Hotfix: Hide visionary plan for free user in the subscription modal
EpokK Jan 8, 2020
c2751ba
Review
EpokK Jan 9, 2020
b6092bc
Review
EpokK Jan 9, 2020
c7909c9
Review to manage offline mode
EpokK Jan 9, 2020
6d36663
Review
EpokK Jan 10, 2020
8f09053
Review
EpokK Jan 10, 2020
8a30e14
Review
EpokK Jan 10, 2020
ab1faac
Handle case when we remove the gift code
EpokK Jan 12, 2020
982fbee
Review
EpokK Jan 13, 2020
8cbb5c9
Update containers/payments/subscription/SubscriptionAddonRow.js
EpokK Jan 13, 2020
9ec5d88
Update containers/payments/subscription/SubscriptionAddonRow.js
EpokK Jan 13, 2020
a3cdbfa
Remove useless selector
EpokK Jan 13, 2020
0d4a489
Now we can Cancel when adding a gift code
EpokK Jan 13, 2020
1fe0dc8
Hotfix
EpokK Jan 13, 2020
87f02f9
Hotfix
EpokK Jan 13, 2020
327ae17
Changes with @jovanjovanovski
EpokK Jan 14, 2020
28f1176
Fix - UI review/updates
nico3333fr Jan 14, 2020
7b5e365
Accept node for title
EpokK Jan 15, 2020
de1f240
Generate payment token for card, existing card and existing paypal me…
EpokK Jan 15, 2020
03af9b2
Review from last @deepspaceharbor report
EpokK Jan 15, 2020
9df833f
Starting
Nov 24, 2019
cd2ae26
Continue
Nov 24, 2019
1e6c7b5
Continue
Nov 25, 2019
dea2829
Export components
Nov 25, 2019
fab7f84
Review
Nov 25, 2019
fcd35cc
Review
Nov 25, 2019
aef5032
Continue
EpokK Nov 27, 2019
21e7706
Continue
Nov 27, 2019
6264620
Continue
Nov 29, 2019
285f7d1
Continue
Nov 29, 2019
3990830
Continue
Nov 29, 2019
d7b768d
Continue
Nov 29, 2019
c1584c3
Continue
EpokK Dec 4, 2019
06fa105
Continue
EpokK Dec 5, 2019
a2a1b6d
Continue
EpokK Dec 6, 2019
090c355
Continue
EpokK Dec 6, 2019
37ffc7a
Continue
EpokK Dec 9, 2019
a525fa9
Continue
EpokK Dec 9, 2019
382c9fc
Continue
EpokK Dec 9, 2019
b458ecd
Continue
EpokK Dec 9, 2019
aa677cf
Continue
EpokK Dec 10, 2019
520bf9e
Continue
EpokK Dec 10, 2019
a98af44
Continue
EpokK Dec 10, 2019
337bde8
Continue
EpokK Dec 12, 2019
a4f036d
Continue
EpokK Dec 12, 2019
6d230ab
Continue
EpokK Dec 12, 2019
9f2ab6f
Continue
EpokK Dec 13, 2019
4cd61eb
Continue
EpokK Dec 13, 2019
62bcdef
Continue
EpokK Dec 17, 2019
7bab6dd
Add VPN icons
EpokK Dec 17, 2019
f97ace7
Continue
EpokK Dec 18, 2019
aff9fbf
Continue
EpokK Dec 19, 2019
5c956da
Continue
EpokK Dec 19, 2019
4c802c7
Continue
EpokK Dec 19, 2019
5e53083
Continue
EpokK Dec 20, 2019
cbc242c
Continue
EpokK Dec 20, 2019
c311f94
Update style for black mode
EpokK Jan 6, 2020
c547657
Review
EpokK Jan 6, 2020
bb96091
Review
EpokK Jan 6, 2020
513b002
Review
EpokK Jan 6, 2020
da07c35
Fix - UI/responsive fixes
nico3333fr Jan 7, 2020
2868712
Fix - some alignments
nico3333fr Jan 7, 2020
3d829f6
Fix - spacing in responsive
nico3333fr Jan 7, 2020
6877dc4
Handle VPN plans in PlansSection component
EpokK Jan 8, 2020
e3cc95e
Update components/image/QRCode.js
EpokK Jan 8, 2020
7e4e006
Review with @econdepe
EpokK Jan 8, 2020
b806280
Update containers/payments/Card.js
EpokK Jan 8, 2020
1695757
Update containers/payments/Card.js
EpokK Jan 8, 2020
c1ba812
Review
EpokK Jan 8, 2020
f7ff48b
Update containers/payments/subscription/SubscriptionAddonRow.js
EpokK Jan 8, 2020
a1cb342
Review
EpokK Jan 8, 2020
ba11b2f
Review with @mmso
EpokK Jan 8, 2020
e0f8268
Review with @econdepe
EpokK Jan 8, 2020
a717a90
Review
EpokK Jan 8, 2020
b946c1c
Click on customize on FREE plan should display the modal
EpokK Jan 8, 2020
8f76368
Hotfix from QA
EpokK Jan 8, 2020
044406d
Review with QA
EpokK Jan 8, 2020
81bcdd1
Hotfix: Hide visionary plan for free user in the subscription modal
EpokK Jan 8, 2020
4e05589
Review
EpokK Jan 9, 2020
cf617e7
Review
EpokK Jan 9, 2020
476d3f9
Review to manage offline mode
EpokK Jan 9, 2020
5ed8730
Review
EpokK Jan 10, 2020
6e2b8fc
Review
EpokK Jan 10, 2020
42e99e6
Review
EpokK Jan 10, 2020
66f87d8
Handle case when we remove the gift code
EpokK Jan 12, 2020
c93a82f
Review
EpokK Jan 13, 2020
0247a73
Update containers/payments/subscription/SubscriptionAddonRow.js
EpokK Jan 13, 2020
d827c18
Update containers/payments/subscription/SubscriptionAddonRow.js
EpokK Jan 13, 2020
974187a
Remove useless selector
EpokK Jan 13, 2020
65cce3d
Now we can Cancel when adding a gift code
EpokK Jan 13, 2020
b037a62
Hotfix
EpokK Jan 13, 2020
b47515d
Hotfix
EpokK Jan 13, 2020
0548923
Changes with @jovanjovanovski
EpokK Jan 14, 2020
682ea80
Fix - UI review/updates
nico3333fr Jan 14, 2020
26a7cc9
Accept node for title
EpokK Jan 15, 2020
c5038ec
Generate payment token for card, existing card and existing paypal me…
EpokK Jan 15, 2020
4f2eed1
Review from last @deepspaceharbor report
EpokK Jan 15, 2020
9b3797c
Update PayPal verification
EpokK Jan 16, 2020
0d9c8e7
Fix - currency design + CSS fixes
nico3333fr Jan 16, 2020
753cda2
Fix - design
nico3333fr Jan 16, 2020
1b6e2cc
Fix
nico3333fr Jan 16, 2020
1a873d7
Fix
nico3333fr Jan 16, 2020
c3b6e4a
Display 1 VPN connections for free VPN
EpokK Jan 16, 2020
72a7bfe
Few hotfix
EpokK Jan 16, 2020
cdc4c8c
Update subscription info
EpokK Jan 17, 2020
0738221
Fix - plan comparison table
nico3333fr Jan 17, 2020
8cf9cfc
Hotfix
EpokK Jan 17, 2020
9a61830
Call verification directly for PayPal
EpokK Jan 17, 2020
9860850
Review logic with @mmso
EpokK Jan 20, 2020
95371a9
Fix - VPN plan comparison styles
nico3333fr Jan 20, 2020
b467cb9
Fix - select truncated in VPN settings
nico3333fr Jan 20, 2020
2324be6
Fix - specificity war
nico3333fr Jan 20, 2020
672f540
Fix - rename
nico3333fr Jan 20, 2020
9180bc0
Fix - alignment of cancel button (when wrong giftcode)
nico3333fr Jan 21, 2020
7cfcb35
Fix - add hyphenation to features list
nico3333fr Jan 21, 2020
62b36c3
Review
EpokK Jan 22, 2020
6afd672
Review
EpokK Jan 22, 2020
6b014d9
Fix - plan table comparison (responsive)
nico3333fr Jan 22, 2020
91efc48
Fix - vpn android app correct link
nico3333fr Jan 22, 2020
87699c5
Fix - review
nico3333fr Jan 22, 2020
56c56e8
Fix - add blocked-content icon
nico3333fr Jan 22, 2020
27c1968
Hotfixes from VPN QA
EpokK Jan 22, 2020
975a3a4
Review
EpokK Jan 23, 2020
d9c947f
Review
EpokK Jan 23, 2020
2bbc2e6
Hotfix
EpokK Jan 23, 2020
67c4446
Review
EpokK Jan 23, 2020
89e347c
Fix - selects truncated
nico3333fr Jan 23, 2020
da083ab
Fix - add modal shorter labels
nico3333fr Jan 23, 2020
cefef51
Fix - alignment in VPN plans
nico3333fr Jan 23, 2020
91561aa
Fix - aligment + icons dm
nico3333fr Jan 23, 2020
30d7173
Fix - text inside button
nico3333fr Jan 23, 2020
2559a47
Review
EpokK Jan 24, 2020
78543b3
Hotfix donate modal
EpokK Jan 24, 2020
1f3bd52
Hotfix
EpokK Jan 24, 2020
a670cd9
Review with @matstaz
EpokK Jan 24, 2020
2b4ee1c
VPN addon was not dynamic
EpokK Jan 27, 2020
105a5f3
Fix - used dark-mode-friendly colors
nico3333fr Jan 29, 2020
ad63a5c
Fix - mobile display checkout on mobile
nico3333fr Jan 29, 2020
7fb4452
Fix - gift code display
nico3333fr Jan 29, 2020
a1b9b40
Pass organization to switchPlan
EpokK Jan 29, 2020
0af8e2a
Split gift code with dash every 4 characters
EpokK Jan 29, 2020
249b63b
Fix https://jira.protontech.ch/browse/COREFE-127
EpokK Jan 29, 2020
5b6383c
Use clearPlanIDs everywhere
EpokK Jan 29, 2020
7b9f491
Don't use BTC_DONATION_ADDRESS
EpokK Jan 29, 2020
eabb884
Fix https://jira.protontech.ch/browse/COREFE-134
EpokK Jan 29, 2020
1e9ad01
Fix - loader in primary colors
nico3333fr Jan 29, 2020
61b1bcf
Hide show all features button when display in the modal
EpokK Jan 29, 2020
5fe37cc
Fix https://jira.protontech.ch/browse/COREFE-137
EpokK Jan 29, 2020
2606754
Fix https://jira.protontech.ch/browse/COREFE-139
EpokK Jan 29, 2020
8842ff3
Reset planIDs model when something goes wrong
EpokK Jan 31, 2020
727d44b
Review
EpokK Jan 31, 2020
478b69d
Review
EpokK Jan 31, 2020
841b8ac
Merge branch 'master' into feat/new-subscription-flow
EpokK Feb 7, 2020
bd06d33
Review
EpokK Feb 8, 2020
5deed82
Fix - design plans comparison table
nico3333fr Feb 10, 2020
5052bf9
Fix - customization styles
nico3333fr Feb 10, 2020
44a0a71
Fix - billing section responsive
nico3333fr Feb 10, 2020
fb01fa9
Fix - plan features text update
nico3333fr Feb 10, 2020
a590b9c
fix - add card styling (checkout)
nico3333fr Feb 10, 2020
60576bd
Review
EpokK Feb 11, 2020
f32d9b3
Fix - autoresponser styles
nico3333fr Feb 12, 2020
e4d6cff
Fix - bitcoin display + a11y/display for Copy button
nico3333fr Feb 12, 2020
6007c41
Prevent subscription modal submission from gift code form
EpokK Feb 12, 2020
cd560c2
Define amount only in the payment step
EpokK Feb 12, 2020
79a6716
Hotfix - Don't use event.keyCode
EpokK Feb 12, 2020
1208fa2
Handle invalid gift
EpokK Feb 12, 2020
4b1204e
Fix - bitcoin/payment design
nico3333fr Feb 13, 2020
03cc5e7
Add icon for @nico3333fr
EpokK Feb 13, 2020
4f2cfc4
Remove Customize action for free plan
EpokK Feb 13, 2020
7cea70c
Fix - icons for plan feature/missing/options
nico3333fr Feb 13, 2020
b59fb60
Fix - stupid fix for Edge/Safari (loader alignment)
nico3333fr Feb 13, 2020
1691779
Fix - put correct size for subtotal/total/etc.
nico3333fr Feb 13, 2020
a916546
Merge branch 'feat/new-subscription-flow' of gitlab.protontech.ch:web…
nico3333fr Feb 13, 2020
c4872bf
Fix - alignment of payment boxes + cash image dark mode
nico3333fr Feb 13, 2020
7c4ad2d
Add question mark icon for proration
EpokK Feb 17, 2020
5b306f2
Review with Mat
EpokK Feb 18, 2020
e9ce134
Fix - set up responsive font for card + fix paypal account display
nico3333fr Feb 19, 2020
5f27794
Fix - border bottom color in total section
nico3333fr Feb 19, 2020
ba65967
Sub-total -> Subtotal
EpokK Feb 20, 2020
3791246
Add : after addon name
EpokK Feb 20, 2020
445c72b
Fix - bank logo in dark mode versions
nico3333fr Feb 20, 2020
c77a1de
Fix - refacto theme change
nico3333fr Feb 21, 2020
86f6823
Fix - info icon color issue in dark mode
nico3333fr Feb 21, 2020
9e3b523
Merge branch 'master' into feat/new-subscription-flow
EpokK Feb 27, 2020
af1319f
Fix MAILWEB-417: Review subscription footer
EpokK Mar 2, 2020
11e1efb
Fix - MALWEB-415 - checkout sticky
nico3333fr Mar 2, 2020
f5d7ce4
Fix svg text auto fit
mmso Mar 2, 2020
fc0ba19
Hotfix
EpokK Mar 3, 2020
c26a390
Review condition to use negative logic
EpokK Mar 4, 2020
7bfb388
Merge branch 'master' into feat/new-subscription-flow
EpokK Mar 9, 2020
ca730ea
Merge branch 'master' into feat/new-subscription-flow
EpokK Mar 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/button/Copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ const Copy = ({ value, className = '', onCopy }) => {

return (
<Button onClick={handleClick} className={classnames([className, copied && 'copied'])}>
<Tooltip title={copied ? c('Label').t`Copied` : c('Label').t`Copy`}>
<Tooltip className="flex" title={copied ? c('Label').t`Copied` : c('Label').t`Copy`}>
<Icon name="clipboard" />
<span className="sr-only">{copied ? c('Label').t`Copied` : c('Label').t`Copy`}</span>
</Tooltip>
</Button>
);
Expand Down
15 changes: 11 additions & 4 deletions components/image/QRCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@ import React, { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import QRCodeJS from 'qrcodejs2';

const QRCode = ({ url, ...rest }) => {
const QRCode = ({ url: text, width = 128, height = 128, ...rest }) => {
const divRef = useRef(null);

useEffect(() => {
const qrcode = new QRCodeJS(divRef.current, url);
const qrcode = new QRCodeJS(divRef.current, {
text,
width,
height
});

return () => {
qrcode.clear();
};
}, []);
}, [width, height]);

return <div ref={divRef} {...rest} />;
};

QRCode.propTypes = {
url: PropTypes.string.isRequired
url: PropTypes.string.isRequired,
width: PropTypes.number,
height: PropTypes.number
};

export default QRCode;
2 changes: 1 addition & 1 deletion components/link/Info.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Info = ({
title = undefined,
originalPlacement = 'top',
scrollContainerClass = 'main',
buttonClass = 'inline-flex',
buttonClass = 'inline-flex color-currentColor',
...rest
}) => {
const [uid] = useState(generateUID('tooltip'));
Expand Down
2 changes: 1 addition & 1 deletion components/modal/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { classnames } from '../../helpers/component';

const Footer = ({ children, className = 'flex flex-spacebetween', ...rest }) => {
const Footer = ({ children, className = 'flex flex-spacebetween flex-items-center flex-nowrap', ...rest }) => {
return (
<footer className={classnames(['pm-modalFooter', className])} {...rest}>
{children}
Expand Down
19 changes: 12 additions & 7 deletions components/price/Price.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import humanPrice from 'proton-shared/lib/helpers/humanPrice';

import { classnames } from '../../helpers/component';

const CURRENCIES = {
Expand All @@ -8,17 +10,18 @@ const CURRENCIES = {
CHF: 'CHF'
};

const Price = ({ children: amount = 0, currency = '', className = '', divisor = 100, suffix = '' }) => {
const fixedValue = Number(amount / divisor).toFixed(2);
const value = fixedValue.replace('.00', '').replace('-', '');
const Price = ({ children: amount = 0, currency = '', className = '', divisor = 100, suffix = '', prefix = '' }) => {
const value = humanPrice(amount, divisor);
const c = <span className="currency">{CURRENCIES[currency] || currency}</span>;
const p = amount < 0 ? <span className="prefix">-</span> : null;
const v = <span className="amount">{value}</span>;
const s = suffix ? <span className="suffix">{suffix}</span> : null;
const s = suffix ? <span className="suffix ml0-25">{suffix}</span> : null;
const pr = prefix ? <span className="prefix">{prefix}</span> : null;

if (currency === 'USD') {
return (
<span className={classnames(['price', className])} data-currency={currency}>
<span className={classnames(['price flex-item-noshrink inline-flex', className])} data-currency={currency}>
{pr}
{p}
{c}
{v}
Expand All @@ -28,7 +31,8 @@ const Price = ({ children: amount = 0, currency = '', className = '', divisor =
}

return (
<span className={classnames(['price', className])} data-currency={currency}>
<span className={classnames(['price flex-item-noshrink inline-flex', className])} data-currency={currency}>
{pr}
{p}
{v}
{currency ? <> {c}</> : null}
Expand All @@ -42,7 +46,8 @@ Price.propTypes = {
children: PropTypes.number,
className: PropTypes.string,
divisor: PropTypes.number,
suffix: PropTypes.string
suffix: PropTypes.string,
prefix: PropTypes.string
};

export default Price;
21 changes: 12 additions & 9 deletions containers/invoices/PayInvoiceModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,16 @@ import { toPrice } from 'proton-shared/lib/helpers/string';

import Payment from '../payments/Payment';
import usePayment from '../payments/usePayment';
import useCard from '../payments/useCard';
import { handlePaymentToken } from '../payments/paymentTokenHelper';

const PayInvoiceModal = ({ invoice, fetchInvoices, ...rest }) => {
const { createModal } = useModals();
const [loading, withLoading] = useLoading();
const api = useApi();
const card = useCard();
const { result = {}, loading: loadingCheck } = useApiResult(() => checkInvoice(invoice.ID), []);
const { AmountDue, Amount, Currency, Credit } = result;
const { method, setMethod, parameters, setParameters, canPay, setCardValidity } = usePayment();

const handleSubmit = async (params = parameters) => {
const handleSubmit = async (params) => {
const requestBody = await handlePaymentToken({
params: { ...params, Amount: AmountDue, Currency },
api,
Expand All @@ -41,10 +38,16 @@ const PayInvoiceModal = ({ invoice, fetchInvoices, ...rest }) => {
rest.onClose();
};

const { card, setCard, errors, method, setMethod, parameters, canPay, paypal, paypalCredit } = usePayment({
amount: AmountDue,
currency: Currency,
onPay: handleSubmit
});

return (
<FormModal
small
onSubmit={() => withLoading(handleSubmit())}
onSubmit={() => withLoading(handleSubmit(parameters))}
loading={loading}
close={c('Action').t`Close`}
submit={canPay && c('Action').t`Pay`}
Expand Down Expand Up @@ -87,12 +90,12 @@ const PayInvoiceModal = ({ invoice, fetchInvoices, ...rest }) => {
method={method}
amount={AmountDue}
currency={Currency}
parameters={parameters}
card={card}
onParameters={setParameters}
onMethod={setMethod}
onValidCard={setCardValidity}
onPay={handleSubmit}
onCard={setCard}
errors={errors}
paypal={paypal}
paypalCredit={paypalCredit}
/>
) : null}
</>
Expand Down
3 changes: 2 additions & 1 deletion containers/labels/ActionsLabelToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ function ActionsLabelToolbar({ onAdd = noop }) {
<PrimaryButton onClick={handleClickAdd('folder')} className="mr1" data-test-id="folders/labels:addFolder">
{c('Action').t`Add folder`}
</PrimaryButton>
<PrimaryButton onClick={handleClickAdd('label')} data-test-id="folders/labels:addLabel">{c('Action').t`Add label`}</PrimaryButton>
<PrimaryButton onClick={handleClickAdd('label')} data-test-id="folders/labels:addLabel">{c('Action')
.t`Add label`}</PrimaryButton>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion containers/overview/SummarySection.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Rows = ({ subscription, user }) => {

return (
<>
<div className="flex-autogrid onmobile-flex-column w100 mb1">
<div className="flex-autogrid onmobile-flex-column flex-items-center w100 mb1">
<div className="flex-autogrid-item">ProtonMail plan</div>
<div className="flex-autogrid-item bold capitalize">
{user.hasPaidMail ? mailPlan.Name : c('Plan').t`Free`}
Expand Down
94 changes: 76 additions & 18 deletions containers/paymentMethods/PaymentMethodDetails.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,97 @@
import React from 'react';
import React, { useRef } from 'react';
import PropTypes from 'prop-types';
import { Bordered } from 'react-components';
import { c } from 'ttag';
import { getLightOrDark } from 'proton-shared/lib/themes/helpers';
import { PAYMENT_METHOD_TYPES } from 'proton-shared/lib/constants';
import useSvgGraphicsBbox from '../../hooks/useSvgGraphicsBbox';

const banks = require.context('design-system/assets/img/shared/bank-icons', true, /.svg$/);

const banksMap = banks.keys().reduce((acc, key) => {
acc[key] = () => banks(key);
return acc;
}, {});

const getBankSvg = (type = '') => {
const key = `./cc-${type}.svg`;
const keyDark = `./cc-${type}-dark.svg`;
if (!banksMap[key]) {
return;
}
const ligthLogo = banksMap[key]().default;
const darkLogo = !banksMap[keyDark] ? ligthLogo : banksMap[keyDark]().default;

return getLightOrDark(ligthLogo, darkLogo);
};

const BANKS = {
'American Express': 'american-express',
'Diners Club': 'diners-club',
Discover: 'discover',
JCB: 'jcb',
Maestro: 'maestro',
MasterCard: 'mastercard',
UnionPay: 'unionpay',
Visa: 'visa'
};

const PaymentMethodDetails = ({ type, details = {} }) => {
const { Last4, Name, ExpMonth, ExpYear, Payer } = details;
const { Last4, Name, ExpMonth, ExpYear, Payer, Brand = '' } = details;

const cardNumberText = `•••• •••• •••• ${Last4}`;
const textRef = useRef();
const textBbox = useSvgGraphicsBbox(textRef, [cardNumberText]);
const textWidth = Math.floor(textBbox.width);

if (type === PAYMENT_METHOD_TYPES.CARD) {
const bankIcon = getBankSvg(BANKS[Brand]);
return (
<Bordered className="bg-global-highlight">
<h4>
<code>•••• •••• •••• {Last4}</code>
</h4>
<div className="flex-autogrid">
<div className="flex-autogrid-item">
<div>{c('Label').t`Cardholder name`}:</div>
<strong>{Name}</strong>
<Bordered className="bg-global-highlight inline-flex flex-column w100 pl2 pr2 pb2">
{bankIcon ? <img width="70" src={bankIcon} alt={Brand} className="mb1" /> : null}
<span className="color-global-grey-dm bl mb1 opacity-40">{c('Label').t`Card number`}</span>
<div className="ratio-container-5-1 aligncenter">
<svg
xmlns="http://www.w3.org/2000/svg"
className="inner-ratio-container fill-currentColor"
viewBox={`0 0 ${textWidth} 50`}
xmlSpace="preserve"
>
<text x="0px" y="40px" className="size-40 strong" ref={textRef}>
{cardNumberText}
</text>
</svg>
</div>
<div className="flex flex-nowrap flex-spacebetween">
<div>
<span className="color-global-grey-dm bl mb0-5 opacity-40">{c('Label').t`Card holder`}</span>
<span className="bigger mt0 mb0">{Name}</span>
</div>
<div className="flex-autogrid-item">
<div>{c('Label for credit card').t`Expiration`}:</div>
<strong>
<div className="alignright">
<span className="color-global-grey-dm bl mb0-5 opacity-40">{c('Label').t`Expires`}</span>
<span className="bigger mt0 mb0">
{ExpMonth}/{ExpYear}
</strong>
</span>
</div>
</div>
</Bordered>
);
}

if (type === PAYMENT_METHOD_TYPES.PAYPAL) {
const bankIcon = getBankSvg('paypal');
return (
<Bordered className="bg-global-highlight">
<h4>
<code>PayPal {Payer}</code>
</h4>
<Bordered className="bg-global-highlight p2">
<div>
<img width="70" src={bankIcon} alt="PayPal" className="mb1" />
</div>
<div className="flex flex-wrap flex-items-center">
<label className="color-global-grey-dm flex-item-noshrink mr1" htmlFor="paypal-payer">{c('Label')
.t`Payer`}</label>
<code id="paypal-payer" className="bl bigger mb0 mb1 ellipsis" title={Payer}>
{Payer}
</code>
</div>
</Bordered>
);
}
Expand Down
Loading