Skip to content

Commit 131e7b3

Browse files
committed
enh: dashboard main page layout and styles
1 parent f1fb950 commit 131e7b3

File tree

2 files changed

+49
-46
lines changed

2 files changed

+49
-46
lines changed

assets/src/dashboard/parts/connected/dashboard/LastImages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ const LastImages = () => {
135135
};
136136

137137
return (
138-
<div className="hidden lg:block pt-5">
139-
<h3 className="text-base m-0">{ optimoleDashboardApp.strings.latest_images.last } { optimoleDashboardApp.strings.latest_images.optimized_images }</h3>
138+
<div>
139+
<h3 className="text-gray-800 text-xl font-semibold mb-5 m-0">{ optimoleDashboardApp.strings.latest_images.last } { optimoleDashboardApp.strings.latest_images.optimized_images }</h3>
140140

141141
{ ( isInitialLoading && ! isLoaded ) && (
142142
<div className="flex items-center flex-col py-2">

assets/src/dashboard/parts/connected/dashboard/index.js

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -71,26 +71,26 @@ const navigate = ( tabId ) => {
7171

7272
const quickactions = [
7373
{
74-
icon: <Icon icon={bolt} className="text-info"/>,
74+
icon: bolt,
7575
title: optimoleDashboardApp.strings.quick_actions.speed_test_title,
7676
description: optimoleDashboardApp.strings.quick_actions.speed_test_desc,
7777
link: optimoleDashboardApp.strings.quick_actions.speed_test_link,
7878
value: 'speedTest'
7979
},
8080
{
81-
icon: <Icon icon={update} className="text-info"/>,
81+
icon: update,
8282
title: optimoleDashboardApp.strings.quick_actions.clear_cache_images,
8383
description: optimoleDashboardApp.strings.quick_actions.clear_cache,
8484
value: clearCache
8585
},
8686
{
87-
icon: <Icon icon={offloadImage} className="text-info" />,
87+
icon: offloadImage,
8888
title: optimoleDashboardApp.strings.quick_actions.offload_images,
8989
description: optimoleDashboardApp.strings.quick_actions.offload_images_desc,
9090
value: () => navigate( settingsTab.offload_image )
9191
},
9292
{
93-
icon: <Icon icon={settings} className="text-info"/>,
93+
icon: settings,
9494
title: optimoleDashboardApp.strings.quick_actions.advance_settings,
9595
description: optimoleDashboardApp.strings.quick_actions.configure_settings,
9696
value: () => navigate( settingsTab.advance )
@@ -162,25 +162,25 @@ const Dashboard = () => {
162162
};
163163

164164
return (
165-
<>
165+
<div className="grid gap-5">
166166
<div className="bg-white p-8 border-0 rounded-lg shadow-md">
167167
{ ( 0 < optimoleDashboardApp.strings.notice_just_activated.length && 'active' === userStatus ) && <ActivatedNotice/> }
168168

169169
{ 'inactive' === userStatus && <InactiveWarning/> }
170170

171-
<div className='py-6 gap-6 flex-col sm:flex-row items-start sm:items-center'>
172-
<div className='flex w-full justify-between sm:items-center'>
173-
<div className="text-gray-800 text-2xl font-bold">
171+
<div className='pb-6 gap-6 flex-col sm:flex-row items-start'>
172+
<div className='flex flex-col md:flex-row gap-3 w-full justify-between'>
173+
<div className="text-gray-800 text-xl font-semibold">
174174
{ optimoleDashboardApp.strings.dashboard_title }
175175
</div>
176176
<div className="flex items-center gap-2">
177-
<div className="text-gray-600 text-base font-normal ml-2">
177+
<div className="text-gray-600 text-base">
178178
{ optimoleDashboardApp.strings.quota }
179179
<span className="pl-2 text-gray-800 font-bold">
180180
{ userData.visitors_pretty } / { userData.visitors_limit_pretty }
181181
</span>
182182
</div>
183-
<div className='w-20'>
183+
<div className='md:w-20 grow md:grow-0'>
184184
<ProgressBar
185185
value={ userData.visitors }
186186
max={ userData.visitors_limit }
@@ -197,35 +197,35 @@ const Dashboard = () => {
197197
'gap-8 flex-col sm:flex-row items-start sm:items-center'
198198
) }
199199
>
200-
<div>
201-
<div className="text-gray-800 text-xl font-bold">
200+
<div className="grid gap-2">
201+
<div className="text-gray-700 text-lg font-semibold">
202202
{ optimoleDashboardApp.strings.banner_title }
203203
</div>
204-
<div className="text-gray-600 text-base">
204+
<div className="text-gray-600 text-sm">
205205
{ optimoleDashboardApp.strings.banner_description }
206206
</div>
207207
</div>
208208
</div>
209209

210-
<div className="flex py-5 gap-5 flex-col md:flex-row">
210+
<div className="flex pt-5 gap-5 flex-col md:flex-row">
211211
{ metrics.map( metric => {
212212
return (
213213
<div
214214
key={ metric.value }
215215
className={ classNames(
216-
'p-3 basis-1/3 flex-col items-start border rounded-md border-solid bg-white border-light-gray border-slate-400'
216+
'p-3 basis-1/3 flex-col items-start border rounded-md border-solid bg-white border-gray-300'
217217
) }
218218
>
219219
<div className="flex w-full flex-col">
220-
<div className="not-italic font-normal text-sm text-gray-500">
220+
<div className="text-sm text-gray-500">
221221
{ metric.label }
222222
</div>
223223

224224
<div>
225225
{ formatMetricValue( metric.value ) }
226226
</div>
227227

228-
<div className="font-normal text-sm text-gray-600">
228+
<div className="font-normal text-gray-600">
229229
{ metric.description }
230230
</div>
231231
</div>
@@ -234,39 +234,42 @@ const Dashboard = () => {
234234
}) }
235235
</div>
236236
</div>
237-
<div className="my-3 bg-white p-8 border-0 rounded-lg shadow-md">
238-
<div className="text-gray-800 font-bold text-2xl">{ optimoleDashboardApp.strings.quick_action_title }</div>
239-
<div className="grid grid-cols-1 md:grid-cols-2 gap-5 py-5">
240-
{quickactions.map( ( action, index ) => (
241-
<div
242-
key={index}
243-
className="flex items-start items-center gap-3 p-4 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors"
244-
>
245-
{action.icon}
246-
<div className="flex flex-col">
247-
<span className="font-medium text-base text-gray-800">{action.title}</span>
248-
{ 'speedTest' === action.value ? (
249-
<a href={action.link} target="_blank" className="text-info text-sm font-medium hover:text-info">{action.description}</a>
250-
) : (
251-
<Button
252-
variant="default"
253-
className="text-info text-sm font-medium p-0 h-5 focus:!shadow-none focus:!outline-none"
254-
onClick={ () => action.value() }
255-
>
256-
{ action.description }
257-
</Button>
258-
) }
259-
</div>
260-
</div>
261-
) )}
237+
<div className="bg-white p-8 border-0 rounded-lg shadow-md">
238+
<div className="text-gray-800 text-xl font-semibold mb-5">{ optimoleDashboardApp.strings.quick_action_title }</div>
239+
<div className="grid md:grid-cols-2 gap-5">
240+
{quickactions.map( ( action, index ) => {
241+
242+
const TAG = 'speedTest' === action.value ? 'a' : 'button';
243+
const additionalProps = 'speedTest' === action.value ? {
244+
href: action.link,
245+
target: '_blank'
246+
} : {
247+
onClick: () => {
248+
action.value();
249+
}
250+
};
251+
return (
252+
<TAG
253+
key={index}
254+
className="flex items-center gap-3 p-4 bg-gray-50 rounded-lg hover:bg-light-blue hover:bg-info hover:border-info transition-background duration-300 group shadow-none border-gray-200 border border-solid cursor-pointer"
255+
{...additionalProps}
256+
>
257+
<Icon icon={action.icon} className="text-info"/>
258+
<div className="flex flex-col items-start gap-1">
259+
<span className="font-medium text-base text-gray-800">{action.title}</span>
260+
<span className="text-info text-sm font-medium hover:text-info">{action.description}</span>
261+
</div>
262+
</TAG>
263+
);
264+
})}
262265
</div>
263266
</div>
264-
<div className="bg-white p-8 border-0 rounded-lg shadow-md">
267+
<div className="bg-white p-8 border-0 rounded-lg shadow-md hidden lg:block">
265268
{ 'yes' !== optimoleDashboardApp.remove_latest_images && (
266269
<LastImages />
267270
) }
268271
</div>
269-
</>
272+
</div>
270273
);
271274
};
272275

0 commit comments

Comments
 (0)