Skip to content

Commit a6ebbed

Browse files
authored
Merge pull request #961 from Codeinwp/refactor/lazy-scaling-ui
feat: improve the lazy loading tab
2 parents d912ac3 + 8c9de99 commit a6ebbed

File tree

16 files changed

+1834
-458
lines changed

16 files changed

+1834
-458
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"ecmaVersion": 2021,
1212
"sourceType": "module"
1313
},
14-
"ignorePatterns": [ "node_modules", "assets/js" ],
14+
"ignorePatterns": [ "node_modules", "assets/js", "**/*.d.ts" ],
1515
"rules": {
1616
"camelcase" : "off",
1717
"indent": [
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import classNames from 'classnames';
2+
3+
export const GroupSettingsContainer = ({ children, className = '' }) => {
4+
return (
5+
<div className={classNames( 'my-4 p-4 rounded border-solid border-gray-200 bg-slate-100', className )}>
6+
{ children }
7+
</div>
8+
);
9+
};
10+
11+
export const GroupSettingsTitle = ({ children, className = '' }) => {
12+
return (
13+
<h3 className={classNames( 'text-sm text-slate-500 m-0 font-semibold mb-4 uppercase', className )}>
14+
{ children }
15+
</h3>
16+
);
17+
};
18+
19+
export const GroupSettingsOption = ({ children, className = '' }) => {
20+
return (
21+
<div className={classNames( 'text-sm text-gray-600 px-4 py-2 bg-white flex items-center rounded', className )}>
22+
{ children }
23+
</div>
24+
);
25+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import classNames from 'classnames';
2+
3+
export const TextWithWarningBadge = ({ text, badgeLabel }) => {
4+
return (
5+
<>
6+
{text}
7+
<span className="ml-4 text-xs font-bold p-1 rounded bg-yellow-400 text-yellow-800 uppercase">
8+
{badgeLabel}
9+
</span>
10+
</>
11+
);
12+
};
13+
14+
const DescriptionTag = ({ text, showAsDisabled }) => (
15+
<span
16+
className={classNames(
17+
'inline-block text-xs px-2 py-1 rounded mr-2 mt-2 font-medium',
18+
{
19+
'bg-gray-200 text-gray-800 line-through': showAsDisabled,
20+
'bg-blue-200 text-blue-800': ! showAsDisabled
21+
}
22+
)}
23+
>
24+
{text}
25+
</span>
26+
);
27+
28+
export const DescriptionWithTags = ({ text, tags }) => (
29+
<>
30+
{text}
31+
<div className="mt-2">
32+
{tags.map( ({ text, disabled }) => (
33+
<DescriptionTag key={text} text={text} showAsDisabled={disabled} />
34+
) )}
35+
</div>
36+
</>
37+
);

assets/src/dashboard/parts/components/RadioBoxes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export default function RadioBoxes({ options, value, onChange, label, disabled =
4343
type="radio"
4444
name="label"
4545
value={buttonValue}
46+
checked={isActive}
47+
onChange={() => {}} // Add empty onChange to satisfy React's controlled input requirements
4648
id={buttonValue}
4749
className="!opacity-0 !w-0 !h-0 !overflow-hidden !absolute !pointer-events-none"
4850
disabled={disabled}

assets/src/dashboard/parts/connected/settings/General.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,6 @@ const General = ({
7777

7878
<hr className="my-8 border-grayish-blue"/>
7979

80-
<ToggleControl
81-
label={ optimoleDashboardApp.strings.options_strings.toggle_lazyload }
82-
help={ () => <p dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.options_strings.lazyload_desc } } /> }
83-
checked={ isLazyloadEnabled }
84-
disabled={ ! isReplacerEnabled || isLoading }
85-
className={ classnames(
86-
{
87-
'is-disabled': ! isReplacerEnabled || isLoading
88-
}
89-
) }
90-
onChange={ value => updateOption( 'lazyload', value ) }
91-
/>
92-
93-
<hr className="my-8 border-grayish-blue"/>
94-
9580
{ isUserActive && <>
9681
<ToggleControl
9782
label={ optimoleDashboardApp.strings.options_strings.enable_badge_title }

0 commit comments

Comments
 (0)