Files
s-ink/scripts/make-icons.py
GandClaude Opus 5 ec6725cd0a feat: five more pieces, reveal safety net, deterministic shots (#6)
* feat: five more pieces, reveal safety net, deterministic shots

Portfolio goes 16 -> 21. Five distinct pieces were still sitting unused in
the source set; the other four unused frames are alternate angles of work
already shown, so they stay out. The hero counter reads 21 because it is
derived from the manifest, not typed.

- Dayê (chest lettering) was photographed by the client looking down at
  their own chest, so it came out upside down. EXIF cannot know that — it
  records how the phone was held, not which way up the subject was — so
  the manifest now carries an explicit `rotate`. Recropped wide, which
  suits horizontal lettering and takes the nipple out of frame.
- Running order is now an explicit sequence rather than insertion order:
  the two spiders are no longer side by side, and the wide tiles are
  spread across the grid instead of clustered at the end.
- All seven dictionaries gain the Hand and Chest placements plus the five
  new titles. A missing translation is a test failure, never a blank.

Fixes a real bug found while reviewing: IntersectionObserver reports once
per frame, so a fast flick, a hash jump or browser scroll restoration can
carry an element past the viewport without it ever being reported. The
reveal is one-shot, so a missed frame is not a late animation — it is
content that stays invisible forever, the same way the clip-path bug
blanked the page. Measured 21 of 35 targets stuck at opacity 0 after a
fast scroll; a scroll sweep backs the observer and takes that to 0.

scripts/shots.mjs was lying in three different ways — jumping past lazy
images, shooting mid-smooth-scroll, and catching the wordmark mid-
scramble. It now walks the page, disables smooth scrolling, and waits on
the page's own state instead of a guessed delay.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: real icon, chat-renderable link preview, branded 404, i18n viewer

Five defects found by auditing the live site rather than the source.

- No favicon anywhere. favicon.ico sat in app/[locale]/, but Next only
  honours it at the top level of app/ — the live head carried no icon link
  at all and /favicon.ico returned 404. It was also still the default
  Next.js logo. Replaced with a generated S. mark; scripts/make-icons.py
  holds the geometry once and emits both the SVG and the iOS PNG.

- og:image was a WebP. Link previews are rendered by whatever app the link
  was pasted into, and WhatsApp and iMessage show nothing for a WebP — so
  the preview that silently failed was the one on the link Sami sends
  clients himself. The pipeline now exports a 1200x630 JPEG.

- The lightbox said Close / Previous piece / Next piece in English in all
  seven languages. Only reachable by opening a piece, so it went unnoticed;
  the i18n test cannot see a string that never entered the dictionary.

- /book and /work 404'd. Those are the URLs people type from memory, and on
  a one-page site there is always a section to send them to.

- Unmatched URLs got Next's own unstyled error page: the root layout lives
  in app/[locale], so there was no layout to build a 404 from. Fixed with
  global-not-found plus dynamicParams=false — without the latter [locale]
  matches anything, so /nonsense was a *matched* route throwing notFound()
  and never reached the global handler.

Also: migrated middleware.ts to the proxy convention (deprecation warning
in this Next version), and dropped the footer year, which froze at build
time on a prerendered page.

Four new regression tests. 74 passing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 09:38:17 +02:00

78 lines
2.7 KiB
Python

#!/usr/bin/env python3
"""Emit the browser icons from one definition of the mark.
A favicon has to exist as at least two files — an SVG for tabs and a PNG for the
iOS home screen — and drawing the same shape twice by hand is how the two
quietly drift apart. So the mark is data here, and both files are generated
from it.
The mark is the wordmark's first line, "S.", cut from a square grid: a stencil S
in bone with the period as an accent block. Deliberately geometric rather than
typographic — at 16px a real typeface is mush, and hard rectangles match the
machined look of the site. Colours are copied from app/globals.css; a favicon
cannot read CSS variables, and the test in tests/regressions.test.ts fails if
they drift apart.
Usage: python3 scripts/make-icons.py
"""
from pathlib import Path
from PIL import Image, ImageDraw
ROOT = Path(__file__).resolve().parent.parent
APP = ROOT / "app"
# --primitive-void / --primitive-bone / --primitive-strobe in app/globals.css.
VOID = "#050507"
BONE = "#e9eaee"
STROBE = "#ff4a17"
GRID = 32
# The S as a union of rectangles on the 32-grid: (x, y, w, h). Unioned shapes
# stay unambiguous at any size, where a single traced outline is easy to get
# subtly wrong and impossible to read back.
MARK = [
(6, 6, 14, 4), # top bar
(6, 6, 4, 12), # upper-left stem
(6, 14, 14, 4), # middle bar
(16, 14, 4, 12), # lower-right stem
(6, 22, 14, 4), # bottom bar
]
DOT = (22, 22, 4, 4) # the period, in accent
def svg() -> str:
rects = "".join(
f'<rect x="{x}" y="{y}" width="{w}" height="{h}"/>' for x, y, w, h in MARK
)
dx, dy, dw, dh = DOT
return (
f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {GRID} {GRID}">'
f'<rect width="{GRID}" height="{GRID}" fill="{VOID}"/>'
f'<g fill="{BONE}">{rects}</g>'
f'<rect x="{dx}" y="{dy}" width="{dw}" height="{dh}" fill="{STROBE}"/>'
"</svg>"
)
def png(size: int) -> Image.Image:
# Draw oversampled and downsample: the grid does not divide 180 evenly, so
# drawing at the target size lands edges on fractional pixels and frays them.
scale = size * 8 / GRID
im = Image.new("RGB", (size * 8, size * 8), VOID)
d = ImageDraw.Draw(im)
for x, y, w, h in MARK:
d.rectangle([x * scale, y * scale, (x + w) * scale, (y + h) * scale], fill=BONE)
dx, dy, dw, dh = DOT
d.rectangle([dx * scale, dy * scale, (dx + dw) * scale, (dy + dh) * scale], fill=STROBE)
return im.resize((size, size), Image.LANCZOS)
(APP / "icon.svg").write_text(svg())
print(f"ok icon.svg {GRID}x{GRID}")
# 180px is the size iOS asks for; everything smaller is downscaled from it.
png(180).save(APP / "apple-icon.png", "PNG", optimize=True)
print("ok apple-icon.png 180x180")