Skip to content

Commit 758be11

Browse files
authored
Merge branch 'development' into feat/clear-cache-on-update
2 parents cc43e64 + e04e30b commit 758be11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2572
-683
lines changed

assets/js/report_script.js

Lines changed: 0 additions & 92 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Icon } from '@wordpress/components';
2+
3+
import classnames from 'classnames';
4+
5+
export default function DashboardMetricBox({ value, label, description, icon, compact = false }) {
6+
const wrapClasses = classnames(
7+
'flex bg-light-blue border border-blue-300 rounded-md basis-1/4 flex-col items-start',
8+
{
9+
'p-4': compact,
10+
'p-6': ! compact
11+
}
12+
);
13+
14+
return (
15+
<div className={wrapClasses}>
16+
<Icon icon={ icon } />
17+
18+
<div className="flex w-full flex-col">
19+
<div className="not-italic font-bold text-xl py-2 text-gray-800">
20+
{ value }
21+
</div>
22+
23+
<div className="not-italic font-normal text-sm text-gray-800">
24+
{ label }
25+
</div>
26+
27+
<div className="font-normal text-xs text-gray-600">
28+
{ description }
29+
</div>
30+
</div>
31+
</div>
32+
);
33+
}

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { close } from '@wordpress/icons';
44
import { useViewportMatch } from '@wordpress/compose';
55
import { Button, Icon, Modal as CoreModal } from '@wordpress/components';
66

7-
export default function Modal({ icon, labels = {}, onRequestClose = () => {}, onConfirm = () => {}, variant = 'default' }) {
7+
export default function Modal({ icon, labels = {}, onRequestClose = () => {}, onConfirm = () => {}, variant = 'default', onSecondaryAction = () => {} }) {
88

99
const isMobileViewport = useViewportMatch( 'small', '<' );
1010

@@ -53,10 +53,20 @@ export default function Modal({ icon, labels = {}, onRequestClose = () => {}, on
5353
className="text-center mx-0 my-4 text-gray-700"
5454
dangerouslySetInnerHTML={ { __html: labels.description } }
5555
/>
56-
57-
<Button variant="primary" className={ actionButtonClasses } onClick={ onConfirm }>
58-
{ labels.action }
59-
</Button>
56+
<div class="flex gap-4">
57+
<Button variant="primary" className={ actionButtonClasses } onClick={ onConfirm }>
58+
{ labels.action }
59+
</Button>
60+
{ labels.secondaryAction && (
61+
<Button
62+
variant="default"
63+
className="optml__button flex justify-center rounded font-bold min-h-40"
64+
onClick={ onSecondaryAction }
65+
>
66+
{ labels.secondaryAction }
67+
</Button>
68+
) }
69+
</div>
6070
</div>
6171
</CoreModal>
6272
);

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const ProgressBar = ({
77
value,
88
max = 100,
99
className,
10+
colorOverage = false,
1011
...props
1112
}) => {
1213
const progress = Math.round( ( value / max ) * 100 );
@@ -17,6 +18,15 @@ const ProgressBar = ({
1718
className
1819
);
1920

21+
const progressClasses = classnames(
22+
'absolute left-0 h-full',
23+
{
24+
'bg-info': colorOverage ? 70 > progress : true,
25+
'bg-red-500': colorOverage && 100 < progress,
26+
'bg-amber-500': colorOverage && 70 < progress && 100 > progress
27+
}
28+
);
29+
2030
return (
2131
<div
2232
className={ wrapClasses }
@@ -26,7 +36,7 @@ const ProgressBar = ({
2636
aria-valuenow={ value }
2737
{ ...props }
2838
>
29-
<div className="absolute left-0 h-full bg-info" style={{ width: `${progress}%` }}></div>
39+
<div className={ progressClasses } style={{ width: `${progress}%` }}></div>
3040

3141
</div>
3242
);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function RadioBoxes({ options, value, onChange, label, disabled =
1616
onChange={handleClick}
1717
>
1818

19-
{label && <legend className="uppercase font-semibold text-s text-light-black mb-6">{label}</legend>}
19+
{label && <legend className="uppercase font-semibold text-s text-light-black mb-6 inline-block">{label}</legend>}
2020

2121
{options.map( ( option, index ) => {
2222
const { title, value: buttonValue, description } = option;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* WordPress dependencies.
3+
*/
4+
import { Icon } from '@wordpress/components';
5+
import { closeSmall, check } from '@wordpress/icons';
6+
7+
import { useSelect } from '@wordpress/data';
8+
9+
const OptimizationStatus = () => {
10+
const statuses = useSelect( select => {
11+
const { getSiteSettings } = select( 'optimole' );
12+
const siteSettings = getSiteSettings();
13+
const lazyloadEnabled = 'enabled' === siteSettings?.lazyload;
14+
return [
15+
{
16+
active: 'enabled' === siteSettings?.image_replacer,
17+
label: optimoleDashboardApp.strings.optimization_status.statusTitle1,
18+
description: optimoleDashboardApp.strings.optimization_status.statusSubTitle1
19+
},
20+
{
21+
active: lazyloadEnabled,
22+
label: optimoleDashboardApp.strings.optimization_status.statusTitle2,
23+
description: optimoleDashboardApp.strings.optimization_status.statusSubTitle2
24+
},
25+
{
26+
active: lazyloadEnabled && 'disabled' === siteSettings?.scale,
27+
label: optimoleDashboardApp.strings.optimization_status.statusTitle3,
28+
description: optimoleDashboardApp.strings.optimization_status.statusSubTitle3
29+
}
30+
];
31+
});
32+
33+
return (
34+
<div className="bg-white flex flex-col text-gray-700 border-0 rounded-lg shadow-md p-8">
35+
<h3 className="text-base m-0">{ optimoleDashboardApp.strings.optimization_status.title }</h3>
36+
<ul>
37+
{ statuses.map( ( status, index ) => {
38+
let statusClass = status.active ? 'success' : 'danger';
39+
return (
40+
<li
41+
key={ index }
42+
className="flex items-start gap-2"
43+
>
44+
{ status.active ? (
45+
<Icon icon={check} className="fill-success bg-success/20 rounded-full" size={20} />
46+
) : (
47+
<Icon icon={closeSmall} className="fill-danger bg-danger/20 rounded-full" size={20} />
48+
) }
49+
50+
<div>
51+
<span className='text-gray-700 font-normal font-semibold'>
52+
{ status.label }
53+
</span>
54+
<p className="m-0">{ status.description }</p>
55+
</div>
56+
</li>
57+
);
58+
}) }
59+
</ul>
60+
<p
61+
className="m-0 mt-3"
62+
dangerouslySetInnerHTML={ {
63+
__html: optimoleDashboardApp.strings.optimization_tips
64+
} }
65+
/>
66+
</div>
67+
);
68+
};
69+
70+
export default OptimizationStatus;

0 commit comments

Comments
 (0)