Skip to content

Commit 4eb79be

Browse files
Merge pull request #4433 from Codeinwp/bugfix/pro/3051
Add a new license while white label enabled
2 parents 89755f6 + 05bade2 commit 4eb79be

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

assets/apps/dashboard/src/Components/Content/Sidebar/LicenseCard.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ const LicenseCard = () => {
2828
const { valid, expiration } = license;
2929
const { whiteLabel, strings } = neveDash;
3030
const { licenseCardHeading, licenseCardDescription } = strings;
31+
const isValid = 'valid' === valid;
3132

3233
const toggleLicense = () => {
33-
const toDo = 'valid' === valid ? 'deactivate' : 'activate';
34+
const toDo = isValid ? 'deactivate' : 'activate';
3435
setStatus('activate' === toDo ? 'activating' : 'deactivating');
3536
send(proApi + '/toggle_license', { key, action: toDo }).then(
3637
(response) => {
@@ -48,7 +49,7 @@ const LicenseCard = () => {
4849
);
4950
};
5051

51-
if (whiteLabel && whiteLabel.hideLicense) {
52+
if (whiteLabel && whiteLabel.hideLicense && isValid) {
5253
return null;
5354
}
5455

@@ -63,9 +64,7 @@ const LicenseCard = () => {
6364
};
6465

6566
if (!status) {
66-
return isOrWasValid
67-
? __('Deactivate', 'neve')
68-
: __('Activate', 'neve');
67+
return isValid ? __('Deactivate', 'neve') : __('Activate', 'neve');
6968
}
7069

7170
return statusLabelMap[status];
@@ -94,22 +93,22 @@ const LicenseCard = () => {
9493
id="license-field"
9594
name="license-field"
9695
className="flex-grow rounded !border-gray-300 text-sm !py-1 !px-2"
97-
disabled={isOrWasValid}
96+
disabled={isValid}
9897
onChange={(e) => {
9998
const keyToSet = e.target.value.replace(/\s+/g, '');
10099
setKey(keyToSet);
101100
}}
102101
value={
103-
isOrWasValid
102+
isValid
104103
? '******************************' +
105104
key.slice(-5)
106105
: key
107106
}
108107
placeholder={__('Enter License Key', 'neve')}
109108
/>
110109
<Button
111-
isPrimary={'valid' !== valid}
112-
isSecondary={'valid' === valid}
110+
isPrimary={!isValid}
111+
isSecondary={isValid}
113112
disabled={!!status || !key}
114113
isSubmit
115114
>
@@ -126,10 +125,10 @@ const LicenseCard = () => {
126125
{isOrWasValid && (
127126
<div className="flex items-center gap-1">
128127
<Pill
129-
type={valid === 'valid' ? 'success' : 'warning'}
128+
type={isValid ? 'success' : 'warning'}
130129
className="inline-flex items-center gap-1 px-2 py-1"
131130
>
132-
{valid === 'valid' ? (
131+
{isValid ? (
133132
<>
134133
<LucideCircleCheck size={14} />
135134
<span>{__('Valid', 'neve')}</span>
@@ -145,7 +144,7 @@ const LicenseCard = () => {
145144
<>
146145
<span className="space-x-1 ml-auto">
147146
<span className="text-xs">
148-
{'valid' === valid
147+
{isValid
149148
? __('Expires', 'neve')
150149
: __('Expired', 'neve')}
151150
</span>

0 commit comments

Comments
 (0)