@@ -38,10 +38,9 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
38
38
}
39
39
40
40
.previous-year-banner {
41
- height : 40px ;
42
41
background-color : # DEF ;
43
42
text-align : center;
44
- padding-top : 16px ;
43
+ padding : 16px 0 ;
45
44
}
46
45
47
46
.previous-year-banner p {
@@ -224,10 +223,6 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
224
223
text-align : right;
225
224
}
226
225
227
- .score-table tbody > tr : nth-child (odd) {
228
- background : hsl (0 0% 0% / 5% );
229
- }
230
-
231
226
.subtotal-row {
232
227
border-top : 1px solid GrayText;
233
228
background : hsl (0 0% 0% / 5% );
@@ -286,10 +281,104 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
286
281
}
287
282
}
288
283
284
+ .interop-score-mobile ,
285
+ .table-title-mobile {
286
+ display : none;
287
+ }
288
+
289
289
@media only screen and (max-width : 800px ) {
290
290
.grid-container {
291
291
margin : 0 1em ;
292
292
}
293
+
294
+ /* --- RESPONSIVE TABLE STYLES --- */
295
+ .table-title-mobile {
296
+ display : block;
297
+ }
298
+ .card-header-mobile {
299
+ display : flex;
300
+ justify-content : space-between;
301
+ align-items : center;
302
+ gap : 1em ;
303
+ }
304
+ .interop-score-mobile {
305
+ display : flex;
306
+ font-size : 0.9em ;
307
+ font-weight : 500 ;
308
+ color : # 333 ;
309
+ background : # e0e0e0 ;
310
+ padding : 0.1em 0.5em ;
311
+ border-radius : 4px ;
312
+ white-space : nowrap;
313
+ }
314
+ .score-table thead {
315
+ border : none;
316
+ clip : rect (0 0 0 0 );
317
+ height : 1px ;
318
+ margin : -1px ;
319
+ overflow : hidden;
320
+ padding : 0 ;
321
+ position : absolute;
322
+ width : 1px ;
323
+ }
324
+ .score-table tr {
325
+ display : block;
326
+ border : 1px solid # ddd ;
327
+ border-radius : 5px ;
328
+ margin-bottom : 1em ;
329
+ box-shadow : 0 2px 4px rgba (0 , 0 , 0 , 0.05 );
330
+ overflow : hidden; /* To contain the floated pseudo-elements */
331
+ }
332
+ .score-table .subtotal-row ,
333
+ .score-table tfoot tr {
334
+ border-top : 2px solid # aaa ;
335
+ font-weight : bold;
336
+ }
337
+ .score-table td {
338
+ display : block;
339
+ text-align : right;
340
+ border-bottom : 1px solid # eee ;
341
+ padding : 0.75em ;
342
+ line-height : 1.5 ;
343
+ }
344
+ .score-table td [data-label = "Interop" ] {
345
+ /* Hide the separate Interop row in our new layout */
346
+ display : none;
347
+ }
348
+ .score-table td : last-child {
349
+ border-bottom : 0 ;
350
+ }
351
+ .score-table td : first-child {
352
+ text-align : left;
353
+ font-weight : bold;
354
+ background-color : hsl (0 0% 0% / 5% );
355
+ border-bottom : 1px solid # ddd ;
356
+ padding : 0 ; /* Padding is now on the inner element */
357
+ }
358
+ .score-table td : first-child .card-header-mobile {
359
+ padding : 0.75em ;
360
+ }
361
+ .score-table td : not (: first-child )::before {
362
+ content : attr (data-label);
363
+ float : left;
364
+ font-weight : 500 ;
365
+ color : # 555 ;
366
+ }
367
+ .score-table td [colspan = "4" ] {
368
+ background-color : hsl (0 0% 0% / 5% );
369
+ font-weight : bold;
370
+ text-align : left;
371
+ padding : 0.75em ;
372
+
373
+ }
374
+ .score-table td [colspan = "4" ] + td ::before {
375
+ content : "Progress" ;
376
+ }
377
+ }
378
+ @media only screen and (min-width : 801px ) {
379
+ .score-table tbody > tr : nth-child (odd) {
380
+ background : hsl (0 0% 0% / 5% );
381
+ }
293
382
}
294
383
</ style >
295
384
< div class ="previous-year-banner " hidden$ =[[isCurrentYear]] >
@@ -302,9 +391,9 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
302
391
< div class ="grid-item grid-item-header ">
303
392
< h1 > [[dashboardTitle]]</ h1 >
304
393
< div class ="channel-area ">
305
- < paper-button id ="toggleStable " class \ $="[[stableButtonClass(stable, isMobileScoresView)]] " on-click ="clickStable "> Stable</ paper-button >
306
- < paper-button id ="toggleExperimental " class \ $="[[experimentalButtonClass(stable, isMobileScoresView)]] " on-click ="clickExperimental "> Experimental</ paper-button >
307
- < paper-button id ="toggleMobile " class \ $="[[mobileButtonClass(isMobileScoresView)]] " on-click ="clickMobile " hidden$ ="[[!shouldShowMobileScoresView()]] "> Mobile</ paper-button >
394
+ < paper-button id ="toggleStable " class$ ="[[stableButtonClass(stable, isMobileScoresView)]] " on-click ="clickStable "> Stable</ paper-button >
395
+ < paper-button id ="toggleExperimental " class$ ="[[experimentalButtonClass(stable, isMobileScoresView)]] " on-click ="clickExperimental "> Experimental</ paper-button >
396
+ < paper-button id ="toggleMobile " class$ ="[[mobileButtonClass(isMobileScoresView)]] " on-click ="clickMobile " hidden$ ="[[!shouldShowMobileScoresView()]] "> Mobile</ paper-button >
308
397
</ div >
309
398
< div class ="text-center " id ="mobileWarning " hidden$ ="[[!isMobileScoresView]] ">
310
399
< p > < i > Mobile browser results and how they are obtained are a work in progress. Scores may not reflect the real level of support for a given feature.</ i > </ p >
@@ -354,19 +443,19 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
354
443
< div class ="grid-item grid-item-scores ">
355
444
< div class ="table-card ">
356
445
< template is ="dom-repeat " items ="{{getYearProp('tableSections')}} " as ="section ">
446
+ < h1 class ="table-title-mobile "> {{section.name}}</ h1 >
357
447
< table class ="score-table ">
358
448
< thead >
359
-
360
449
<!-- First score table header with sort functionality -->
361
450
< template is ="dom-if " if ="[[isFirstTable(itemsIndex)]] ">
362
451
< tr class ="section-header ">
363
- < th class ="sortable-header ">
452
+ < th class ="sortable-header " data-label$ =" [[section.name]] " >
364
453
{{section.name}}
365
454
< img class ="sort-icon-focus-areas " src ="[[getFocusAreaSortIcon(sortColumn, isSortedAsc)]] " />
366
455
</ th >
367
456
< template is ="dom-repeat " items ="{{getYearProp('browserInfo')}} " as ="browserInfo ">
368
457
< template is ="dom-if " if ="{{isChromeEdgeCombo(browserInfo)}} ">
369
- < th class ="sortable-header ">
458
+ < th class ="sortable-header " data-label =" Chrome/Edge " >
370
459
< template is ="dom-if " if ="[[stable]] ">
371
460
< div class ="browser-icons ">
372
461
< img src ="/static/chrome_64x64.png " width ="32 " alt ="Chrome " title ="Chrome " />
@@ -383,7 +472,7 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
383
472
</ th >
384
473
</ template >
385
474
< template is ="dom-if " if ="{{!isChromeEdgeCombo(browserInfo)}} ">
386
- < th class ="sortable-header ">
475
+ < th class ="sortable-header " data-label$ =" [[browserInfo.tableName]] " >
387
476
< div class ="browser-icons single-browser-icon ">
388
477
< img src ="[[getBrowserIcon(browserInfo, stable)]] " width ="32 " alt ="[[getBrowserIconName(browserInfo, stable)]] " title ="[[getBrowserIconName(browserInfo, stable)]] " />
389
478
</ div >
@@ -392,14 +481,14 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
392
481
</ template >
393
482
</ template >
394
483
< template is ="dom-if " if ="{{isMobileScoresView}} ">
395
- < th class ="sortable-header ">
484
+ < th class ="sortable-header " data-label =" Safari iOS " >
396
485
< div class ="browser-icons single-browser-icon ">
397
486
< img src ="/static/wktr_64x64.png " width ="32 " alt ="Safari iOS " title ="Safari iOS " />
398
487
</ div >
399
488
< img class ="sort-icon " src ="[[getSortIcon(2, sortColumn, isSortedAsc)]] " />
400
489
</ th >
401
490
</ template >
402
- < th class ="sortable-header ">
491
+ < th class ="sortable-header " data-label =" Interop " >
403
492
< div class ="interop-header "> INTEROP</ div >
404
493
< img class ="sort-icon " src ="[[getInteropSortIcon(sortColumn, isSortedAsc)]] " />
405
494
</ th >
@@ -454,47 +543,54 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
454
543
< template is ="dom-repeat " items ="{{sortRows(section.rows, index, sortColumn, isSortedAsc)}} " as ="rowName ">
455
544
< tr data-feature$ ="[[rowName]] ">
456
545
< td >
457
- < a href$ ="[[getTestsURL(rowName, stable)]] "> [[getRowInfo(rowName, 'description')]]</ a >
546
+ < div class ="card-header-mobile ">
547
+ < a href$ ="[[getTestsURL(rowName, stable)]] "> [[getRowInfo(rowName, 'description')]]</ a >
548
+ < span class ="interop-score-mobile "> [[getInteropScoreForFeature(rowName, stable)]]</ span >
549
+ </ div >
458
550
</ td >
459
551
< template is ="dom-repeat " items ="{{getYearProp('browserInfo')}} " as ="browserInfo ">
460
- < td > [[getBrowserScoreForFeature(itemsIndex, rowName, stable)]]</ td >
552
+ < td data-label$ =" [[browserInfo.tableName]] " > [[getBrowserScoreForFeature(itemsIndex, rowName, stable)]]</ td >
461
553
</ template >
462
554
< template is ="dom-if " if ="[[isMobileScoresView]] ">
463
- < td > --%</ td >
555
+ < td data-label =" Safari iOS " > --%</ td >
464
556
</ template >
465
- < td > [[getInteropScoreForFeature(rowName, stable)]]</ td >
557
+ < td data-label =" Interop " > [[getInteropScoreForFeature(rowName, stable)]]</ td >
466
558
</ tr >
467
559
</ template >
468
560
</ tbody >
469
561
< tfoot >
470
562
< tr class ="subtotal-row ">
471
- < td > < strong > TOTAL</ strong > </ td >
563
+ < td >
564
+ < div class ="card-header-mobile ">
565
+ < strong > TOTAL</ strong >
566
+ < span class ="interop-score-mobile "> [[getInteropSubtotalScore(section, stable)]]</ span >
567
+ </ div >
568
+ </ td >
472
569
< template is ="dom-repeat " items ="{{getYearProp('browserInfo')}} " as ="browserInfo ">
473
- < td > [[getSubtotalScore(itemsIndex, section, stable)]]</ td >
570
+ < td data-label$ =" [[browserInfo.tableName]] " > [[getSubtotalScore(itemsIndex, section, stable)]]</ td >
474
571
</ template >
475
572
< template is ="dom-if " if ="[[isMobileScoresView]] ">
476
- < td > --%</ td >
573
+ < td data-label =" Safari iOS " > --%</ td >
477
574
</ template >
478
- < td > [[getInteropSubtotalScore(section, stable)]]</ td >
575
+ < td data-label =" Interop " > [[getInteropSubtotalScore(section, stable)]]</ td >
479
576
</ tr >
480
577
</ tfoot >
481
578
</ template >
482
579
< template is ="dom-if " if ="[[section.score_as_group]] ">
483
580
< tbody >
484
581
< template is ="dom-repeat " items ="{{section.rows}} " as ="rowName ">
485
582
< tr >
486
- < td colspan =4 >
583
+ < td colspan =" 4 " >
487
584
< a href$ ="[[getInvestigationUrl(rowName, section.previous_investigation)]] "> [[rowName]]</ a >
488
585
</ td >
489
- < td > [[getInvestigationScore(rowName, section.previous_investigation)]]</ td >
586
+ < td data-label =" Progress " > [[getInvestigationScore(rowName, section.previous_investigation)]]</ td >
490
587
</ tr >
491
588
</ template >
492
589
</ tbody >
493
590
< tfoot >
494
591
< tr class ="subtotal-row ">
495
- < td > < strong > TOTAL</ strong > </ td >
496
- < td colspan =3 > </ td >
497
- < td > [[getInvestigationScoreSubtotal(section.previous_investigation)]]</ td >
592
+ < td colspan ="4 " class ="card-header-mobile "> < strong > TOTAL</ strong > </ td >
593
+ < td data-label ="Total Progress "> [[getInvestigationScoreSubtotal(section.previous_investigation)]]</ td >
498
594
</ tr >
499
595
</ tfoot >
500
596
</ template >
@@ -534,9 +630,9 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
534
630
</ div >
535
631
536
632
< interop-feature-chart year ="[[year]] "
537
- data-manager ="[[dataManager]] "
538
- stable ="[[stable]] "
539
- feature ="{{feature}} ">
633
+ data-manager ="[[dataManager]] "
634
+ stable ="[[stable]] "
635
+ feature ="{{feature}} ">
540
636
</ interop-feature-chart >
541
637
</ section >
542
638
</ div >
@@ -553,7 +649,7 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
553
649
</ template >
554
650
</ div >
555
651
</ footer >
556
- ` ;
652
+ `;
557
653
}
558
654
static get is ( ) {
559
655
return 'interop-dashboard' ;
@@ -563,7 +659,10 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
563
659
return {
564
660
year : String ,
565
661
embedded : Boolean ,
566
- stable : Boolean ,
662
+ stable : {
663
+ type : Boolean ,
664
+ observer : '_stableChanged' ,
665
+ } ,
567
666
feature : String ,
568
667
features : {
569
668
type : Array ,
@@ -659,7 +758,7 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
659
758
if ( this . year === '2021' || this . year === '2022' || this . isMobileScoresView ) {
660
759
const gridContainerDiv = this . shadowRoot . querySelector ( '.grid-container' ) ;
661
760
gridContainerDiv . style . display = 'block' ;
662
- gridContainerDiv . style . width = '700px' ;
761
+ gridContainerDiv . style . maxWidth = '700px' ;
663
762
gridContainerDiv . style . margin = 'auto' ;
664
763
// Dashboards after 2022 also display a special description,
665
764
// which is not displayed in previous years.
@@ -669,6 +768,35 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
669
768
afterNextRender ( this , this . addSortEvents ) ;
670
769
}
671
770
771
+ _stableChanged ( ) {
772
+ this . updateSummaryScores ( ) ;
773
+ }
774
+
775
+ async updateSummaryScores ( ) {
776
+ const scoreElements = this . shadowRoot . querySelectorAll ( '.interop-score-mobile' ) ;
777
+ const scores = this . stable ? this . scores . stable : this . scores . experimental ;
778
+ const summaryFeatureName = this . dataManager . getYearProp ( 'summaryFeatureName' ) ;
779
+ console . log ( this . scores ) ;
780
+ // If the elements have not rendered yet, don't update the scores.
781
+ if ( ( ! this . isMobileScoresView && scoreElements . length !== scores . length ) ||
782
+ ( this . isMobileScoresView && scoreElements . length !== scores . length + 1 ) ) {
783
+ return ;
784
+ }
785
+ // // Update interop summary number first.
786
+ // this.updateSummaryScore(scoreElements[0], scores[scores.length - 1][summaryFeatureName]);
787
+ // // Update the rest of the browser scores.
788
+ // for (let i = 1; i < scores.length; i++) {
789
+ // this.updateSummaryScore(scoreElements[i], scores[i - 1][summaryFeatureName]);
790
+ // }
791
+
792
+ // // Update investigation summary separately.
793
+ // if (this.shouldDisplayInvestigationNumber()) {
794
+ // const investigationNumber = this.shadowRoot.querySelector('#investigationNumber');
795
+ // this.updateSummaryScore(
796
+ // investigationNumber, this.dataManager.getYearProp('investigationTotalScore'));
797
+ // }
798
+ }
799
+
672
800
// Add the on-click handlers for sorting by a specific table header.
673
801
addSortEvents ( ) {
674
802
const sortableHeaders = this . shadowRoot . querySelectorAll ( '.sortable-header' ) ;
@@ -1067,7 +1195,7 @@ class InteropDashboard extends WPTFlags(PolymerElement) {
1067
1195
// Reverse the sort order if the same column is clicked again.
1068
1196
if ( this . sortColumn === i ) {
1069
1197
this . isSortedAsc = ! this . isSortedAsc ;
1070
- } else {
1198
+ } else {
1071
1199
// Otherwise, sort in descending order.
1072
1200
this . isSortedAsc = false ;
1073
1201
}
0 commit comments