Skip to content

Commit 51f2989

Browse files
refactor: reduce nesting
1 parent 2ff7cca commit 51f2989

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

  • assets/src/dashboard/parts/connected/dashboard

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,15 @@ const Dashboard = () => {
172172

173173
// Fallback for missing data
174174
if ( undefined === value ) {
175-
value = 'saved_size' === type ?
176-
Math.floor( Math.random() * 2500000 ) + 500000 : // Mock KB
177-
'traffic' === type ?
178-
Math.floor( Math.random() * 2500 ) + 500 : // Mock MB
179-
'offloaded_images' === type ?
180-
Math.floor( Math.random() * 500 ) + 50 : // Mock images count
181-
Math.floor( Math.random() * 40 ) + 10; // Mock Percentage
175+
if ( 'saved_size' === type ) {
176+
value = Math.floor( Math.random() * 2500000 ) + 500000; // Mock KB
177+
} else if ( 'traffic' === type ) {
178+
value = Math.floor( Math.random() * 2500 ) + 500; // Mock MB
179+
} else if ( 'offloaded_images' === type ) {
180+
value = Math.floor( Math.random() * 500 ) + 50; // Mock images count
181+
} else {
182+
value = Math.floor( Math.random() * 40 ) + 10; // Mock Percentage
183+
}
182184
}
183185

184186
switch ( type ) {

0 commit comments

Comments
 (0)