@@ -22,7 +22,7 @@ import {
22
22
} from '../utils/urls.js' ;
23
23
import { FeatureSortOrderType } from '../api/client.js' ;
24
24
25
- const MISSING_VALUE = html `--- ` ;
25
+ const MISSING_VALUE = html `` ;
26
26
27
27
type CellRenderer = {
28
28
(
@@ -40,6 +40,7 @@ type ColumnDefinition = {
40
40
group ?: string ;
41
41
headerHtml : TemplateResult ;
42
42
cellRenderer : CellRenderer ;
43
+ cellClass ?: string ;
43
44
unsortable ?: boolean ;
44
45
options : {
45
46
browser ?: components [ 'parameters' ] [ 'browserPathParam' ] ;
@@ -56,6 +57,10 @@ const NEWLY_TO_WIDELY_MONTH_OFFSET = 30;
56
57
export enum ColumnKey {
57
58
Name = 'name' ,
58
59
BaselineStatus = 'baseline_status' ,
60
+ DesktopAvailabilityChrome = 'desktop_availability_chrome' ,
61
+ DesktopAvailabilityEdge = 'desktop_availability_edge' ,
62
+ DesktopAvailabilityFirefox = 'desktop_availability_firefox' ,
63
+ DesktopAvailabilitySafari = 'desktop_availability_safari' ,
59
64
StableChrome = 'stable_chrome' ,
60
65
StableEdge = 'stable_edge' ,
61
66
StableFirefox = 'stable_firefox' ,
@@ -97,6 +102,10 @@ const columnOptionKeyMapping = Object.entries(ColumnOptionKey).reduce(
97
102
export const DEFAULT_COLUMNS = [
98
103
ColumnKey . Name ,
99
104
ColumnKey . BaselineStatus ,
105
+ ColumnKey . DesktopAvailabilityChrome ,
106
+ ColumnKey . DesktopAvailabilityEdge ,
107
+ ColumnKey . DesktopAvailabilityFirefox ,
108
+ ColumnKey . DesktopAvailabilitySafari ,
100
109
ColumnKey . StableChrome ,
101
110
ColumnKey . StableEdge ,
102
111
ColumnKey . StableFirefox ,
@@ -260,12 +269,24 @@ export const renderBaselineStatus: CellRenderer = (
260
269
` ;
261
270
} ;
262
271
263
- const BROWSER_IMPL_ICONS : Record <
264
- NonNullable < components [ 'schemas' ] [ 'BrowserImplementation' ] [ 'status' ] > ,
265
- string
266
- > = {
267
- unavailable : 'minus-circle' ,
268
- available : 'check-circle' ,
272
+ export const renderDesktopAvailablity : CellRenderer = (
273
+ feature ,
274
+ _routerLocation ,
275
+ { browser} ,
276
+ ) => {
277
+ const browserImpl = feature . browser_implementations ?. [ browser ! ] ;
278
+ const browserImplStatus = browserImpl ?. status || 'unavailable' ;
279
+ const browserImplVersion = browserImpl ?. version ;
280
+ return html `
281
+ < div class ="browser-impl- ${ browserImplStatus } ">
282
+ < sl-tooltip
283
+ ?disabled =${ browserImplVersion === undefined }
284
+ content ="Since version ${ browserImplVersion } "
285
+ >
286
+ < img src ="/public/img/${ browser } _24x24.png " />
287
+ </ sl-tooltip >
288
+ </ div >
289
+ ` ;
269
290
} ;
270
291
271
292
function renderMissingPercentage ( ) : TemplateResult {
@@ -292,7 +313,6 @@ export const renderBrowserQuality: CellRenderer = (
292
313
let percentage = renderPercentage ( score ) ;
293
314
const browserImpl = feature . browser_implementations ?. [ browser ! ] ;
294
315
const browserImplStatus = browserImpl ?. status || 'unavailable' ;
295
- const browserImplVersion = browserImpl ?. version ;
296
316
if ( browserImplStatus === 'unavailable' ) {
297
317
percentage = renderMissingPercentage ( ) ;
298
318
}
@@ -305,15 +325,7 @@ export const renderBrowserQuality: CellRenderer = (
305
325
if ( didFeatureCrash ( feature . wpt ?. stable ?. [ browser ! ] ?. metadata ) ) {
306
326
percentage = renderFeatureCrash ( ) ;
307
327
}
308
- const iconName = BROWSER_IMPL_ICONS [ browserImplStatus ] ;
309
328
return html `
310
- < div class ="browser-impl- ${ browserImplStatus } ">
311
- < sl-tooltip
312
- ?disabled =${ browserImplVersion === undefined }
313
- content ="Since version ${ browserImplVersion } "
314
- >
315
- < sl-icon name ="${ iconName } " library ="custom "> </ sl-icon >
316
- </ sl-tooltip >
317
329
${ percentage }
318
330
</ div>
319
331
` ;
@@ -370,59 +382,103 @@ export const CELL_DEFS: Record<ColumnKey, ColumnDefinition> = {
370
382
] ,
371
383
} ,
372
384
} ,
385
+ [ ColumnKey . DesktopAvailabilityChrome ] : {
386
+ nameInDialog : 'Availibility in desktop Chrome' ,
387
+ group : 'Availability' ,
388
+ headerHtml : html `` ,
389
+ unsortable : true ,
390
+ cellClass : 'centered' ,
391
+ cellRenderer : renderDesktopAvailablity ,
392
+ options : { browser : 'chrome' } ,
393
+ } ,
394
+ [ ColumnKey . DesktopAvailabilityEdge ] : {
395
+ nameInDialog : 'Availibility in desktop Edge' ,
396
+ group : 'Availability' ,
397
+ headerHtml : html `` ,
398
+ unsortable : true ,
399
+ cellClass : 'centered' ,
400
+ cellRenderer : renderDesktopAvailablity ,
401
+ options : { browser : 'edge' } ,
402
+ } ,
403
+ [ ColumnKey . DesktopAvailabilityFirefox ] : {
404
+ nameInDialog : 'Availibility in desktop Firefox' ,
405
+ group : 'Availability' ,
406
+ headerHtml : html `` ,
407
+ unsortable : true ,
408
+ cellClass : 'centered' ,
409
+ cellRenderer : renderDesktopAvailablity ,
410
+ options : { browser : 'firefox' } ,
411
+ } ,
412
+ [ ColumnKey . DesktopAvailabilitySafari ] : {
413
+ nameInDialog : 'Availibility in desktop Safari' ,
414
+ group : 'Availability' ,
415
+ headerHtml : html `` ,
416
+ cellClass : 'centered' ,
417
+ unsortable : true ,
418
+ cellRenderer : renderDesktopAvailablity ,
419
+ options : { browser : 'safari' } ,
420
+ } ,
373
421
[ ColumnKey . StableChrome ] : {
374
422
nameInDialog : 'Browser Implementation in Chrome' ,
375
423
group : 'WPT' ,
376
424
headerHtml : html `< img src ="/public/img/chrome_24x24.png " /> ` ,
425
+ cellClass : 'centered' ,
377
426
cellRenderer : renderBrowserQuality ,
378
427
options : { browser : 'chrome' , channel : 'stable' } ,
379
428
} ,
380
429
[ ColumnKey . StableEdge ] : {
381
430
nameInDialog : 'Browser Implementation in Edge' ,
382
431
group : 'WPT' ,
383
432
headerHtml : html `< img src ="/public/img/edge_24x24.png " /> ` ,
433
+ cellClass : 'centered' ,
384
434
cellRenderer : renderBrowserQuality ,
385
435
options : { browser : 'edge' , channel : 'stable' } ,
386
436
} ,
387
437
[ ColumnKey . StableFirefox ] : {
388
438
nameInDialog : 'Browser Implementation in Firefox' ,
389
439
group : 'WPT' ,
390
440
headerHtml : html `< img src ="/public/img/firefox_24x24.png " /> ` ,
441
+ cellClass : 'centered' ,
391
442
cellRenderer : renderBrowserQuality ,
392
443
options : { browser : 'firefox' , channel : 'stable' } ,
393
444
} ,
394
445
[ ColumnKey . StableSafari ] : {
395
446
nameInDialog : 'Browser Implementation in Safari' ,
396
447
group : 'WPT' ,
397
448
headerHtml : html `< img src ="/public/img/safari_24x24.png " /> ` ,
449
+ cellClass : 'centered' ,
398
450
cellRenderer : renderBrowserQuality ,
399
451
options : { browser : 'safari' , channel : 'stable' } ,
400
452
} ,
401
453
[ ColumnKey . ExpChrome ] : {
402
454
nameInDialog : 'Browser Implementation in Chrome Experimental' ,
403
455
group : 'WPT Experimental' ,
404
456
headerHtml : html `< img src ="/public/img/chrome-canary_24x24.png " /> ` ,
457
+ cellClass : 'centered' ,
405
458
cellRenderer : renderBrowserQualityExp ,
406
459
options : { browser : 'chrome' , channel : 'experimental' } ,
407
460
} ,
408
461
[ ColumnKey . ExpEdge ] : {
409
462
nameInDialog : 'Browser Implementation in Edge Experimental' ,
410
463
group : 'WPT Experimental' ,
411
464
headerHtml : html `< img src ="/public/img/edge-dev_24x24.png " /> ` ,
465
+ cellClass : 'centered' ,
412
466
cellRenderer : renderBrowserQualityExp ,
413
467
options : { browser : 'edge' , channel : 'experimental' } ,
414
468
} ,
415
469
[ ColumnKey . ExpFirefox ] : {
416
470
nameInDialog : 'Browser Implementation in Firefox Experimental' ,
417
471
group : 'WPT Experimental' ,
418
472
headerHtml : html `< img src ="/public/img/firefox-nightly_24x24.png " /> ` ,
473
+ cellClass : 'centered' ,
419
474
cellRenderer : renderBrowserQualityExp ,
420
475
options : { browser : 'firefox' , channel : 'experimental' } ,
421
476
} ,
422
477
[ ColumnKey . ExpSafari ] : {
423
478
nameInDialog : 'Browser Implementation in Safari Experimental' ,
424
479
group : 'WPT Experimental' ,
425
480
headerHtml : html `< img src ="/public/img/safari-preview_24x24.png " /> ` ,
481
+ cellClass : 'centered' ,
426
482
cellRenderer : renderBrowserQualityExp ,
427
483
options : { browser : 'safari' , channel : 'experimental' } ,
428
484
} ,
@@ -495,10 +551,10 @@ export function renderHeaderCell(
495
551
496
552
const colDef = CELL_DEFS [ column ] ;
497
553
if ( colDef . unsortable ) {
498
- return html `< th > ${ colDef ?. headerHtml } </ th > ` ;
554
+ return html `< th class = ${ colDef . cellClass || '' } > ${ colDef ?. headerHtml } </ th > ` ;
499
555
} else {
500
556
return html `
501
- < th title ="Click to sort " class ="sortable ">
557
+ < th title ="Click to sort " class ="${ colDef . cellClass || '' } sortable ">
502
558
< a href =${ urlWithSort } > ${ sortIndicator } ${ colDef ?. headerHtml } </ a >
503
559
</ th >
504
560
` ;
0 commit comments