@@ -11,6 +11,8 @@ import { StatisticsMonitor } from "../../stats/StatisticsMonitor";
1111import { SetupCatalog } from "../../saveGames" ;
1212import { formatNumber } from "../../i18n" ;
1313import { clip } from "../../geom/math" ;
14+ import { AtlasIcon } from "../grid/ShapesIcon" ;
15+ import { Shape } from "../../grid/Shape" ;
1416
1517export type StatisticsSection = {
1618 heading ?: {
@@ -21,6 +23,7 @@ export type StatisticsSection = {
2123 columns : ( MessageDescriptor | null ) [ ] ;
2224 rows : {
2325 title : MessageDescriptor ;
26+ icon ?: readonly Shape [ ] ;
2427 keys : string [ ] ;
2528 } [ ] ;
2629 footer ?: {
@@ -155,7 +158,11 @@ export class StatisticsDisplay extends ScreenDisplay {
155158 const row = column [ i ] ;
156159 if ( row ) {
157160 const th = createElement ( "th" , "label" , tr ) ;
158- th . innerHTML = t ( row . title ) ;
161+ if ( row . icon ) {
162+ th . appendChild ( new AtlasIcon ( row . icon ) . svg ) ;
163+ th . classList . add ( "with-icon" ) ;
164+ }
165+ th . appendChild ( document . createTextNode ( t ( row . title ) ) ) ;
159166 for ( const key of row . keys ) {
160167 const td = createElement ( "td" , null , tr ) ;
161168 const n = stats . counters . get ( key ) || 0 ;
@@ -223,6 +230,7 @@ const StatisticsSections: StatisticsSection[] = [
223230 rows : [ ...SetupCatalog . atlas . values ( ) ] . map ( ( atlasDef ) => {
224231 return {
225232 title : atlasDef . atlas . tilingName as MessageDescriptor ,
233+ icon : atlasDef . atlas . shapes ,
226234 keys : [
227235 `HighScore.{"atlas":"${ atlasDef . atlas . id } ","colors":"wong4","segments":0,"uniqueTileColors":false,"rules":"same","scorer":"shape"}` ,
228236 `ShapeCompleted.{"atlas":"${ atlasDef . atlas . id } ","colors":"wong4","segments":0,"uniqueTileColors":false,"rules":"same","scorer":"shape"}` ,
@@ -254,41 +262,47 @@ const StatisticsSections: StatisticsSection[] = [
254262 id : "ui.statistics.counter.TilePlaced.square" ,
255263 message : "Squares" ,
256264 } ) ,
265+ icon : SetupCatalog . atlas . get ( "square" ) ! . atlas . shapes ,
257266 keys : [ `TilePlaced.square` ] ,
258267 } ,
259268 {
260269 title : msg ( {
261270 id : "ui.statistics.counter.TilePlaced.triangle" ,
262271 message : "Triangles" ,
263272 } ) ,
273+ icon : SetupCatalog . atlas . get ( "triangle" ) ! . atlas . shapes ,
264274 keys : [ `TilePlaced.triangle` ] ,
265275 } ,
266276 {
267277 title : msg ( {
268278 id : "ui.statistics.counter.TilePlaced.rhombus" ,
269279 message : "Rhombi" ,
270280 } ) ,
281+ icon : [ SetupCatalog . atlas . get ( "penrose" ) ! . atlas . shapes [ 0 ] ] ,
271282 keys : [ `TilePlaced.rhombus` ] ,
272283 } ,
273284 {
274285 title : msg ( {
275286 id : "ui.statistics.counter.TilePlaced.pentagon" ,
276287 message : "Pentagons" ,
277288 } ) ,
289+ icon : [ SetupCatalog . atlas . get ( "pentagon" ) ! . atlas . shapes [ 0 ] ] ,
278290 keys : [ `TilePlaced.pentagon` ] ,
279291 } ,
280292 {
281293 title : msg ( {
282294 id : "ui.statistics.counter.TilePlaced.hexagon" ,
283295 message : "Hexagons" ,
284296 } ) ,
297+ icon : [ SetupCatalog . atlas . get ( "hexagon" ) ! . atlas . shapes [ 0 ] ] ,
285298 keys : [ `TilePlaced.hexagon` ] ,
286299 } ,
287300 {
288301 title : msg ( {
289302 id : "ui.statistics.counter.TilePlaced.kite" ,
290303 message : "Kites" ,
291304 } ) ,
305+ icon : [ SetupCatalog . atlas . get ( "deltotrihex" ) ! . atlas . shapes [ 0 ] ] ,
292306 keys : [ `TilePlaced.kite` ] ,
293307 } ,
294308 ] ,
0 commit comments