Spaces:
Sleeping
Sleeping
Viewer HTML: keep the brand colours readable for the IcAt PPTX skill (#18)
Browse filesThe PPTX skill takes the brand colours chosen on the upload page from a
top-level `var brandStats = [...]` line in the viewer HTML, so colours are
set only once. #17 moved the data into per-country datasets and the line
disappeared: the skill silently fell back to logo colours (or stopped to
ask). Re-add it, covering the brands of all countries.
- build_viewer.py +12 -0
build_viewer.py
CHANGED
|
@@ -569,6 +569,16 @@ def _build_html(*, safe_title, product, datasets, codes, asset_list):
|
|
| 569 |
datasets_json = _safe_json(datasets)
|
| 570 |
codes_json = _safe_json(codes)
|
| 571 |
asset_list_json = _safe_json(asset_list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 572 |
|
| 573 |
# Build zone legend items with icons
|
| 574 |
zone_legend = ''
|
|
@@ -963,6 +973,8 @@ body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans
|
|
| 963 |
</div>
|
| 964 |
|
| 965 |
<script>
|
|
|
|
|
|
|
| 966 |
// One dataset per country ('' = single study). The country switch reloads the
|
| 967 |
// page on '#<code>'; '#compare' is the cross-country comparison of ASSET_LIST rows.
|
| 968 |
var DATASETS = {datasets_json};
|
|
|
|
| 569 |
datasets_json = _safe_json(datasets)
|
| 570 |
codes_json = _safe_json(codes)
|
| 571 |
asset_list_json = _safe_json(asset_list)
|
| 572 |
+
# The IcAt PPTX skill reads the brand colours chosen here from a top-level
|
| 573 |
+
# `var brandStats = [...];` line, so they are not set twice. Keep that line
|
| 574 |
+
# (one entry per brand across all countries; first country wins).
|
| 575 |
+
pptx_colors, seen = [], set()
|
| 576 |
+
for code in codes:
|
| 577 |
+
for b in datasets[code]['brandStats']:
|
| 578 |
+
if b['name'] not in seen:
|
| 579 |
+
seen.add(b['name'])
|
| 580 |
+
pptx_colors.append(b)
|
| 581 |
+
pptx_colors_json = _safe_json(pptx_colors)
|
| 582 |
|
| 583 |
# Build zone legend items with icons
|
| 584 |
zone_legend = ''
|
|
|
|
| 973 |
</div>
|
| 974 |
|
| 975 |
<script>
|
| 976 |
+
// Read by the IcAt PPTX skill (brand colours); the viewer itself uses DATASETS.
|
| 977 |
+
var brandStats = {pptx_colors_json};
|
| 978 |
// One dataset per country ('' = single study). The country switch reloads the
|
| 979 |
// page on '#<code>'; '#compare' is the cross-country comparison of ASSET_LIST rows.
|
| 980 |
var DATASETS = {datasets_json};
|