@@ -19,30 +19,35 @@ const reasons = [
19
19
optimoleDashboardApp . strings . upgrade . reason_4
20
20
] ;
21
21
22
- const statuses = [
23
- {
24
- label : optimoleDashboardApp . strings . optimization_status . statusTitle1 ,
25
- description : optimoleDashboardApp . strings . optimization_status . statusSubTitle1
26
- } ,
27
- {
28
- label : optimoleDashboardApp . strings . optimization_status . statusTitle2 ,
29
- description : optimoleDashboardApp . strings . optimization_status . statusSubTitle2
30
- } ,
31
- {
32
- label : optimoleDashboardApp . strings . optimization_status . statusTitle3 ,
33
- description : optimoleDashboardApp . strings . optimization_status . statusSubTitle3
34
- }
35
- ] ;
36
-
37
22
const Sidebar = ( ) => {
38
23
const {
39
24
name,
40
25
domain,
41
- plan
26
+ plan,
27
+ statuses
42
28
} = useSelect ( select => {
43
- const { getUserData } = select ( 'optimole' ) ;
29
+ const { getUserData, getSiteSettings } = select ( 'optimole' ) ;
44
30
45
31
const user = getUserData ( ) ;
32
+ const siteSettings = getSiteSettings ( ) ;
33
+
34
+ const statuses = [
35
+ {
36
+ active : 'enabled' === siteSettings ?. image_replacer ,
37
+ label : optimoleDashboardApp . strings . optimization_status . statusTitle1 ,
38
+ description : optimoleDashboardApp . strings . optimization_status . statusSubTitle1
39
+ } ,
40
+ {
41
+ active : 'enabled' === siteSettings ?. lazyload ,
42
+ label : optimoleDashboardApp . strings . optimization_status . statusTitle2 ,
43
+ description : optimoleDashboardApp . strings . optimization_status . statusSubTitle2
44
+ } ,
45
+ {
46
+ active : 'enabled' === siteSettings ?. scale ,
47
+ label : optimoleDashboardApp . strings . optimization_status . statusTitle3 ,
48
+ description : optimoleDashboardApp . strings . optimization_status . statusSubTitle3
49
+ }
50
+ ] ;
46
51
47
52
let domain = user ?. cdn_key + '.i.optimole.com' ;
48
53
if ( user ?. domain !== undefined && '' !== user ?. domain ) {
@@ -52,7 +57,8 @@ const Sidebar = () => {
52
57
return {
53
58
name : user ?. display_name ,
54
59
domain,
55
- plan : user ?. plan
60
+ plan : user ?. plan ,
61
+ statuses : statuses . filter ( status => status . active )
56
62
} ;
57
63
} ) ;
58
64
@@ -138,28 +144,35 @@ const Sidebar = () => {
138
144
</ Button >
139
145
) }
140
146
141
- < div className = "bg-white flex flex-col text-gray-700 border-0 rounded-lg shadow-md p-8" >
142
- < h3 className = "text-base m-0" > { optimoleDashboardApp . strings . optimization_status . title } </ h3 >
143
- < ul >
144
- { statuses . map ( ( status , index ) => (
145
- < li
146
- key = { index }
147
- className = "flex items-start gap-2"
148
- >
149
- < Icon icon = "yes-alt" className = "text-light-black mt-1" />
150
- < div className = "text-light-black font-normal text-base" >
151
- < div className = 'font-semibold' >
152
- { status . label }
153
- </ div >
154
- < div >
155
- { status . description }
147
+ { 0 < statuses . length && (
148
+ < div className = "bg-white flex flex-col text-gray-700 border-0 rounded-lg shadow-md p-8" >
149
+ < h3 className = "text-base m-0" > { optimoleDashboardApp . strings . optimization_status . title } </ h3 >
150
+ < ul >
151
+ { statuses . map ( ( status , index ) => (
152
+ < li
153
+ key = { index }
154
+ className = "flex items-start gap-2"
155
+ >
156
+ < Icon icon = "yes-alt" className = "text-light-black mt-1" />
157
+ < div className = "text-light-black font-normal text-base" >
158
+ < div className = 'font-semibold' >
159
+ { status . label }
160
+ </ div >
161
+ < div >
162
+ { status . description }
163
+ </ div >
156
164
</ div >
157
- </ div >
158
- </ li >
159
- ) ) }
160
- </ ul >
161
- < ExternalLink className = 'font-semibold text-sm' href = 'https://docs.optimole.com/article/2238-optimization-tips' > { optimoleDashboardApp . strings . optimization_tips } </ ExternalLink >
162
- </ div >
165
+ </ li >
166
+ ) ) }
167
+ </ ul >
168
+ < p
169
+ className = "m-0 -mt-3"
170
+ dangerouslySetInnerHTML = { {
171
+ __html : optimoleDashboardApp . strings . optimization_tips
172
+ } }
173
+ />
174
+ </ div >
175
+ ) }
163
176
</ div >
164
177
) ;
165
178
} ;
0 commit comments