Skip to content

Commit a0f20dd

Browse files
sanityclaude
andauthored
fix(hugo): restore animation icons, fix giant GitHub logo, dark-mode label readability (#61)
* fix(hugo): restore animation icons and fix giant GitHub logo on delta-sync These two "further reading" pages (delta-sync, small-world-networks) and their animations were built ~18 months ago and had several regressions after Font Awesome was removed site-wide ("icons replaced with inline SVGs"). Problems fixed: - Giant GitHub logo on the delta-sync page: the propagation shortcode had an unscoped `svg { width: 100% }` rule that leaked to every SVG on the page, blowing the footer GitHub logo up to ~968px. Scoped the rule (and the `d3.select("svg")` teardown) to `.visualization-wrapper svg`. - Missing icons / empty buttons on both pages (reported as "missing button labels in dark mode"): these 5 shortcodes still used `<i class="fas fa-…">` Font Awesome icons, which render as empty boxes now that FA is gone. The per-page `head:` front-matter that tried to re-add FA from cdnjs was silently ignored by the theme. Completed the inline-SVG migration: added a small `.fnicon` CSS mask-icon utility (paths from the vendored FA solid set) that inherits `currentColor`, so icons render correctly in light and dark mode. This covers the play/pause/reset/next buttons and the 8 animal "data icons" in the delta-sync peer visualization. - Console `SyntaxError: 'AnimationCoordinator' has already been declared`: the coordinator is included by two shortcodes, so a page with several animations loaded it twice. Made it idempotent via a `window.AnimationCoordinator ||` guard. - Removed the dead cdnjs Font Awesome `head:` front-matter from both pages (ignored by the theme; icons are inline SVG now). - Added aria-labels to the icon-only small-world buttons for screen readers. Verified with Playwright in light and dark mode: footer logo 20px, all button and data icons render, play/pause toggles work, zero console errors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EeZRA6N55JECxH2zfivBR * fix(hugo): dark-mode readability for scale chart labels and peer titles Follow-up from review of the animation pages, addressing dark-mode problems the user asked to catch: - small-world scale chart: D3 axis tick text and the "Network Size" / "Average Path Length" labels default to a black `fill`, which is invisible on the dark canvas in dark mode. Scoped `#scalingChart text { fill: currentColor }` so labels inherit the theme text color and stay readable in both modes. - delta-sync peer boxes: `.peer-title` had no explicit color, so in dark mode it inherited the light body text color and nearly disappeared against the hardcoded-light peer card. Set an explicit dark title color. - small-world-routing shortcode now loads its own animation-coordinator.js so it is self-contained rather than relying on a sibling shortcode; the coordinator's redeclaration guard makes the duplicate load safe. Verified in dark mode via Playwright: scale labels render light-grey and readable, peer titles dark and readable, zero console errors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EeZRA6N55JECxH2zfivBR --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 75c8b77 commit a0f20dd

12 files changed

Lines changed: 76 additions & 48 deletions

File tree

hugo-site/content/build/manual/further-reading/delta-sync.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ title: "Understanding Freenet's Delta-Sync"
66
date: 2024-11-30
77
draft: false
88
tags: ["further-reading"]
9-
head:
10-
- - link
11-
- rel: stylesheet
12-
href: https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css
139
---
1410

1511
### The Challenge of Consistency in Distributed Systems

hugo-site/content/build/manual/further-reading/small-world-networks.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ title: "Understanding Small World Networks"
66
date: 2024-11-25
77
draft: false
88
tags: ["further-reading"]
9-
head:
10-
- - link
11-
- rel: stylesheet
12-
href: https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css
139
---
1410

1511
<div style="float: right; margin-left: 20px; margin-bottom: 10px; max-width: 300px; width: 100%;">

hugo-site/layouts/shortcodes/small-world-comparison.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<div class="visualization-container" style="margin-bottom: 2rem;">
22
<div class="buttons has-addons is-centered" style="margin: 1rem;">
3-
<button id="comparisonPlayPauseBtn" class="button is-medium is-primary">
3+
<button id="comparisonPlayPauseBtn" class="button is-medium is-primary" aria-label="Play or pause the animation">
44
<span class="icon">
5-
<i class="fas fa-play"></i>
5+
<i class="fnicon fnicon-play"></i>
66
</span>
77
</button>
8-
<button id="resetComparisonBtn" class="button is-medium">
8+
<button id="resetComparisonBtn" class="button is-medium" aria-label="Reset the animation">
99
<span class="icon">
10-
<i class="fas fa-undo"></i>
10+
<i class="fnicon fnicon-reset"></i>
1111
</span>
1212
</button>
1313
</div>
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
<div class="visualization-container">
22
<div class="buttons has-addons is-centered" style="margin: 0.25rem;">
3-
<button id="routingPlayPauseBtn" class="button is-medium is-primary">
3+
<button id="routingPlayPauseBtn" class="button is-medium is-primary" aria-label="Play or pause the animation">
44
<span class="icon">
5-
<i class="fas fa-play"></i>
5+
<i class="fnicon fnicon-play"></i>
66
</span>
77
</button>
8-
<button id="resetRoutingBtn" class="button is-medium">
8+
<button id="resetRoutingBtn" class="button is-medium" aria-label="Reset the animation">
99
<span class="icon">
10-
<i class="fas fa-undo"></i>
10+
<i class="fnicon fnicon-reset"></i>
1111
</span>
1212
</button>
1313
</div>
1414
<div style="display: flex; flex-direction: row; justify-content: center;">
1515
<canvas id="networkCanvas2" width="400" height="400" style="max-width: 70%; height: auto;"></canvas>
1616
</div>
1717
</div>
18+
<!-- routing.js calls AnimationCoordinator; load it here so this shortcode is
19+
self-contained. The coordinator guards against duplicate declaration, so
20+
it is safe even when sibling animation shortcodes also load it. -->
21+
<script src="/js/animation-coordinator.js"></script>
1822
<script src="/js/small-world-routing.js"></script>

hugo-site/layouts/shortcodes/small-world-scale.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
<div class="visualization-container">
2+
<style>
3+
/* D3 axis tick text and axis labels default to a black `fill`, which is
4+
invisible on the dark canvas in dark mode. `currentColor` inherits the
5+
page text color so the chart labels stay readable in both themes. */
6+
#scalingChart text { fill: currentColor; }
7+
</style>
28
<div class="buttons has-addons is-centered" style="margin: 1rem;">
3-
<button id="scalePlayPauseBtn" class="button is-medium is-primary">
9+
<button id="scalePlayPauseBtn" class="button is-medium is-primary" aria-label="Play or pause the animation">
410
<span class="icon">
5-
<i class="fas fa-play"></i>
11+
<i class="fnicon fnicon-play"></i>
612
</span>
713
</button>
8-
<button id="resetScaleBtn" class="button is-medium">
14+
<button id="resetScaleBtn" class="button is-medium" aria-label="Reset the animation">
915
<span class="icon">
10-
<i class="fas fa-undo"></i>
16+
<i class="fnicon fnicon-reset"></i>
1117
</span>
1218
</button>
1319
</div>

hugo-site/layouts/shortcodes/summary-delta-sync/propagation.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
.message {
1515
r: 5;
1616
}
17-
svg {
17+
.visualization-wrapper svg {
1818
display: block;
1919
margin: 0 auto;
2020
width: 100%;
@@ -41,7 +41,7 @@
4141
min-height: 450px;
4242
margin: 1rem auto;
4343
}
44-
svg {
44+
.visualization-wrapper svg {
4545
transform: scale(0.85);
4646
transform-origin: center top;
4747
}
@@ -52,7 +52,7 @@
5252
<div class="buttons is-centered" style="margin: 0.25rem;">
5353
<button id="resetConvergenceBtn" class="button is-medium">
5454
<span class="icon">
55-
<i class="fas fa-undo"></i>
55+
<i class="fnicon fnicon-reset"></i>
5656
</span>
5757
<span>Reset</span>
5858
</button>
@@ -210,7 +210,7 @@
210210
// Initialize visualization
211211
function initializeVisualization() {
212212
// Remove existing SVG if it exists
213-
d3.select("svg").remove();
213+
d3.select(".visualization-wrapper svg").remove();
214214

215215
// Generate new tree data with current parameters
216216
const { width, height } = getContainerDimensions();

hugo-site/layouts/shortcodes/summary-delta-sync/sync.html

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
text-align: center;
3636
font-weight: bold;
3737
margin-bottom: 1rem;
38+
/* The peer box is a hardcoded light card in both themes; set an explicit
39+
dark title color so it stays readable in dark mode (otherwise it
40+
inherits the light body text color and nearly disappears). */
41+
color: #363636;
3842
}
3943
.peer-icons {
4044
display: flex;
@@ -139,13 +143,13 @@
139143
<div class="buttons has-addons is-centered" style="margin-bottom: 0.5rem;">
140144
<button id="syncNextBtn" class="button is-medium is-primary">
141145
<span class="icon">
142-
<i class="fas fa-step-forward"></i>
146+
<i class="fnicon fnicon-next"></i>
143147
</span>
144148
<span>Next</span>
145149
</button>
146150
<button id="resetSyncBtn" class="button is-medium">
147151
<span class="icon">
148-
<i class="fas fa-undo"></i>
152+
<i class="fnicon fnicon-reset"></i>
149153
</span>
150154
<span>Reset</span>
151155
</button>
@@ -186,14 +190,14 @@
186190
<script>
187191
// Available FontAwesome icons for the visualization
188192
const availableIcons = [
189-
{ name: 'dog', class: 'fas fa-dog' },
190-
{ name: 'cat', class: 'fas fa-cat' },
191-
{ name: 'fish', class: 'fas fa-fish' },
192-
{ name: 'dove', class: 'fas fa-dove' },
193-
{ name: 'dragon', class: 'fas fa-dragon' },
194-
{ name: 'spider', class: 'fas fa-spider' },
195-
{ name: 'horse', class: 'fas fa-horse' },
196-
{ name: 'hippo', class: 'fas fa-hippo' }
193+
{ name: 'dog', class: 'fnicon fnicon-dog' },
194+
{ name: 'cat', class: 'fnicon fnicon-cat' },
195+
{ name: 'fish', class: 'fnicon fnicon-fish' },
196+
{ name: 'dove', class: 'fnicon fnicon-dove' },
197+
{ name: 'dragon', class: 'fnicon fnicon-dragon' },
198+
{ name: 'spider', class: 'fnicon fnicon-spider' },
199+
{ name: 'horse', class: 'fnicon fnicon-horse' },
200+
{ name: 'hippo', class: 'fnicon fnicon-hippo' }
197201
];
198202

199203
// State for each peer

hugo-site/static/js/animation-coordinator.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
* Global animation coordinator for managing multiple animations on a page.
33
* Ensures only one animation is active at a time and handles state transitions.
44
*/
5-
const AnimationCoordinator = {
5+
// Guard against redeclaration: this file is included by more than one shortcode,
6+
// so a page using several animations loads it multiple times. Defining it once on
7+
// `window` keeps repeat includes from throwing "already declared" and preserves state.
8+
window.AnimationCoordinator = window.AnimationCoordinator || {
69
/** @type {string|null} Current active animation name */
710
activeAnimation: null,
811

hugo-site/static/js/small-world-comparison.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ waitForD3().then(() => {
406406
isPlaying = false;
407407
const btn = document.getElementById('comparisonPlayPauseBtn');
408408
const icon = btn.querySelector('i');
409-
icon.className = 'fas fa-play';
409+
icon.className = 'fnicon fnicon-play';
410410
return;
411411
}
412412

@@ -425,7 +425,7 @@ waitForD3().then(() => {
425425
const btn = document.getElementById('comparisonPlayPauseBtn');
426426
if (btn) {
427427
const icon = btn.querySelector('i');
428-
if (icon) icon.className = 'fas fa-play';
428+
if (icon) icon.className = 'fnicon fnicon-play';
429429
}
430430
if (animationFrame) cancelAnimationFrame(animationFrame);
431431
}
@@ -435,7 +435,7 @@ waitForD3().then(() => {
435435
isPlaying = !isPlaying;
436436
const btn = document.getElementById('comparisonPlayPauseBtn');
437437
const icon = btn.querySelector('i');
438-
icon.className = isPlaying ? 'fas fa-pause' : 'fas fa-play';
438+
icon.className = isPlaying ? 'fnicon fnicon-pause' : 'fnicon fnicon-play';
439439

440440
if (isPlaying) {
441441
AnimationCoordinator.setActive('comparison');
@@ -451,7 +451,7 @@ waitForD3().then(() => {
451451
isPlaying = false;
452452
const btn = document.getElementById('comparisonPlayPauseBtn');
453453
const icon = btn.querySelector('i');
454-
icon.className = 'fas fa-play';
454+
icon.className = 'fnicon fnicon-play';
455455

456456
if (animationFrame) {
457457
cancelAnimationFrame(animationFrame);

hugo-site/static/js/small-world-routing.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ async function initVisualization() {
361361
if (playPauseBtn) {
362362
const icon = playPauseBtn.querySelector('i');
363363
if (icon) {
364-
icon.className = 'fas fa-play';
364+
icon.className = 'fnicon fnicon-play';
365365
}
366366
}
367367

@@ -394,7 +394,7 @@ async function initVisualization() {
394394
const btn = document.getElementById('routingPlayPauseBtn');
395395
if (btn) {
396396
const icon = btn.querySelector('i');
397-
if (icon) icon.className = 'fas fa-play';
397+
if (icon) icon.className = 'fnicon fnicon-play';
398398
}
399399
if (routeTimeout) clearTimeout(routeTimeout);
400400
}
@@ -419,10 +419,10 @@ async function initVisualization() {
419419
}
420420

421421
if (isPlaying) {
422-
icon.className = 'fas fa-pause';
422+
icon.className = 'fnicon fnicon-pause';
423423
startNewRoute();
424424
} else {
425-
icon.className = 'fas fa-play';
425+
icon.className = 'fnicon fnicon-play';
426426
clearTimeout(routeTimeout);
427427
}
428428
}

0 commit comments

Comments
 (0)