Skip to content

Commit 4f97204

Browse files
CalebJamesHbrianchandotcom
authored andcommitted
LPD-67547 Refactor
1 parent e75166e commit 4f97204

File tree

4 files changed

+34
-39
lines changed

4 files changed

+34
-39
lines changed

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/assets/icons/Icon-user.svg renamed to workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/assets/icons/user.svg

File renamed without changes.

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/i18n/en_US.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export default {
202202
'Design the storefront for your solution. This will set the information displayed on the solution’s page. This section is dedicated to creating the solution’s detail content.',
203203
'design-the-storefront-for-your-solution-this-will-set-the-information-displayed-on-the-solutions-page-this-section-is-dedicated-to-creating-the-solutions-header':
204204
'Design the storefront for your solution. This will set the information displayed on the solution’s page. This section is dedicated to creating the solution’s header.',
205-
'designed-for-companies-with-a-taxvat-number-this-account-type-also-lets-you-manage-multiple-users-under-one-profile-click-the-button-below-to-create-your-first-business-account-today':
205+
'designed-for-companies-with-a-tax-vat-number-this-account-type-also-lets-you-manage-multiple-users-under-one-profile-click-the-button-below-to-create-your-first-business-account-today':
206206
'Designed for companies with a Tax/VAT number, this account type also lets you manage multiple users under one profile. Click the button below to create your first Business Account today!',
207207
'details': 'Details',
208208
'developer-license-prices': 'Developer License Prices',
@@ -275,9 +275,9 @@ export default {
275275
'file-not-available-for-download': 'File not available for download.',
276276
'filter': 'Filter',
277277
'first-name': 'First Name',
278-
'for-businesses-with-a-vattax-number-this-account-type-support-multiple-users-it-also-possible-to-join-an-already-existing-business-account':
278+
'for-businesses-with-a-vat-tax-number-this-account-type-support-multiple-users-it-also-possible-to-join-an-already-existing-business-account':
279279
'For businesses with a VAT/Tax number; this account type support multiple users. It also possible to join an already existing business account',
280-
'for-individuals-without-a-vattax-number-this-account-support-single-user-only':
280+
'for-individuals-without-a-vat-tax-number-this-account-support-single-user-only':
281281
'For individuals without a VAT/Tax number; this account support single user only.',
282282
'form': 'Form',
283283
'fragment': 'Fragment',

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/pages/ProductPurchase/pages/CreateNewAccount.scss

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
.create-new-account {
2-
&-container {
3-
gap: 24px;
2+
&-button {
3+
background-color: #fff;
4+
border: 1px solid #0053f0 !important;
5+
color: #0053f0 !important;
6+
}
7+
8+
&-button:hover {
9+
background-color: #edf3fe !important;
410
}
511

612
&-card {
@@ -12,14 +18,8 @@
1218
}
1319
}
1420

15-
&-button {
16-
background-color: #fff;
17-
border: 1px solid #0053f0 !important;
18-
color: #0053f0 !important;
19-
}
20-
21-
&-button:hover {
22-
background-color: #edf3fe !important;
21+
&-container {
22+
gap: 24px;
2323
}
2424
}
2525

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/pages/ProductPurchase/pages/CreateNewAccount.tsx

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import Button from '@clayui/button';
77
import {useModal} from '@clayui/modal';
88

9-
import userSVG from '../../../assets/icons/Icon-user.svg';
10-
import businessSVG from '../../../assets/icons/business.svg';
9+
import businessIcon from '../../../assets/icons/business.svg';
10+
import userIcon from '../../../assets/icons/user.svg';
1111
import {AccountTypes} from '../../../enums/Account';
1212
import i18n from '../../../i18n';
1313
import {Liferay} from '../../../liferay/liferay';
@@ -45,12 +45,17 @@ const Divider = () => (
4545
</div>
4646
);
4747

48-
const CreateNewAccount = ({accounts}: {accounts: any[]}) => {
48+
const CreateNewAccount = ({accounts}: {accounts: Account[]}) => {
4949
const modal = useModal();
5050

51-
const content = (() => {
52-
if (!accounts.length) {
53-
return (
51+
const hasAccounts = !!accounts.length;
52+
const isBusinessAccount = accounts.some(
53+
(account) => account.type === AccountTypes.BUSINESS
54+
);
55+
56+
return (
57+
<div className="create-new-account-container d-flex flex-column mt-5">
58+
{!hasAccounts && (
5459
<>
5560
<div className="mr-1">
5661
There are no Liferay Marketplace accounts available for
@@ -64,49 +69,39 @@ const CreateNewAccount = ({accounts}: {accounts: any[]}) => {
6469

6570
<DisplayCard
6671
description={i18n.translate(
67-
'for-businesses-with-a-vattax-number-this-account-type-support-multiple-users-it-also-possible-to-join-an-already-existing-business-account'
72+
'for-businesses-with-a-vat-tax-number-this-account-type-support-multiple-users-it-also-possible-to-join-an-already-existing-business-account'
6873
)}
69-
svg={businessSVG}
74+
svg={businessIcon}
7075
title={i18n.translate('business-account')}
7176
/>
7277

7378
<DisplayCard
7479
description={i18n.translate(
75-
'for-individuals-without-a-vattax-number-this-account-support-single-user-only'
80+
'for-individuals-without-a-vat-tax-number-this-account-support-single-user-only'
7681
)}
77-
svg={userSVG}
82+
svg={userIcon}
7883
title={i18n.translate('personal-account')}
7984
/>
8085
</>
81-
);
82-
}
86+
)}
8387

84-
if (
85-
!accounts.some((account) => account.type === AccountTypes.BUSINESS)
86-
) {
87-
return (
88+
{hasAccounts && !isBusinessAccount && (
8889
<>
8990
<Divider />
9091

9192
<DisplayCard
9293
description={i18n.translate(
93-
'designed-for-companies-with-a-taxvat-number-this-account-type-also-lets-you-manage-multiple-users-under-one-profile-click-the-button-below-to-create-your-first-business-account-today'
94+
'designed-for-companies-with-a-tax-vat-number-this-account-type-also-lets-you-manage-multiple-users-under-one-profile-click-the-button-below-to-create-your-first-business-account-today'
9495
)}
95-
svg={businessSVG}
96+
svg={businessIcon}
9697
title={i18n.translate(
9798
'unlock-exclusive-benefits-with-a-business-account'
9899
)}
99100
/>
100101
</>
101-
);
102-
}
102+
)}
103103

104-
return <Divider />;
105-
})();
106-
107-
return (
108-
<div className="create-new-account-container d-flex flex-column mt-5">
109-
{content}
104+
{hasAccounts && isBusinessAccount && <Divider />}
110105

111106
<Button
112107
className="create-new-account-button"

0 commit comments

Comments
 (0)