@@ -26,7 +26,11 @@ import {
2626 bolt ,
2727 update ,
2828 offloadImage ,
29- settings
29+ settings ,
30+ globe ,
31+ arrowDownToLine ,
32+ cloudDownload ,
33+ chartBarDecreasing
3034} from '../../../utils/icons' ;
3135
3236import ProgressBar from '../../components/ProgressBar' ;
@@ -38,35 +42,44 @@ const cardClasses = 'flex p-6 bg-light-blue border border-blue-300 rounded-md';
3842
3943const metrics = [
4044 {
45+ icon : arrowDownToLine ,
4146 label : optimoleDashboardApp . strings . metrics . metricsTitle2 ,
4247 description : optimoleDashboardApp . strings . metrics . metricsSubtitle2 ,
4348 value : 'saved_size' ,
4449 hasButton : true ,
4550 buttonText : optimoleDashboardApp . strings . metrics . adjust_compression
4651 } ,
4752 {
53+ icon : chartBarDecreasing ,
4854 label : optimoleDashboardApp . strings . metrics . metricsTitle3 ,
4955 description : optimoleDashboardApp . strings . metrics . metricsSubtitle3 ,
5056 value : 'compression_percentage' ,
5157 hasButton : true ,
5258 buttonText : optimoleDashboardApp . strings . metrics . adjust_compression
5359 } ,
5460 {
61+ icon : globe ,
5562 label : optimoleDashboardApp . strings . metrics . metricsTitle4 ,
5663 description : optimoleDashboardApp . strings . metrics . metricsSubtitle4 ,
5764 value : 'traffic' ,
5865 hasButton : true ,
5966 buttonText : optimoleDashboardApp . strings . metrics . view_analytics
60- } ,
61- {
62- label : optimoleDashboardApp . strings . metrics . metricsTitle5 ,
63- description : optimoleDashboardApp . strings . metrics . metricsSubtitle5 ,
64- value : 'offloaded_images' ,
65- hasButton : true ,
66- buttonText : optimoleDashboardApp . strings . metrics . manage_offloading
6767 }
6868] ;
6969
70+ if ( optimoleDashboardApp . user_data ?. can_use_offloading ) {
71+ metrics . push (
72+ {
73+ icon : cloudDownload ,
74+ label : optimoleDashboardApp . strings . metrics . metricsTitle5 ,
75+ description : optimoleDashboardApp . strings . metrics . metricsSubtitle5 ,
76+ value : 'offloaded_images' ,
77+ hasButton : true ,
78+ buttonText : optimoleDashboardApp . strings . metrics . manage_offloading
79+ }
80+ ) ;
81+ }
82+
7083const settingsTab = {
7184 offload_image : 1 ,
7285 advance : 2
@@ -333,8 +346,11 @@ const Dashboard = () => {
333346 ) }
334347 >
335348 < div className = "flex w-full flex-col" >
336- < div className = "text-sm text-gray-500" >
337- { metric . label }
349+ < div className = 'flex flex-row items-center gap-2 mb-2' >
350+ < Icon icon = { metric . icon } size = { 16 } className = "text-info" />
351+ < div className = "text-sm text-gray-500" >
352+ { metric . label }
353+ </ div >
338354 </ div >
339355
340356 < div className = 'flex items-end gap-1' >
0 commit comments