Make language toggle a segmented control, document localhost/Referer requirement
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
b6eba89154
commit
9ff7dcb3c2
@@ -0,0 +1,16 @@
|
|||||||
|
# baken
|
||||||
|
|
||||||
|
Static site (Cloudflare assets, `public/` is the asset directory). The hotel map lives in `public/hotelkaart/index.html`.
|
||||||
|
|
||||||
|
## Viewing and testing the map
|
||||||
|
|
||||||
|
Always serve over `http://localhost`, never open `index.html` as `file://`.
|
||||||
|
|
||||||
|
**Why:** the OpenStreetMap tile servers require a `Referer` header (the page sets `referrerPolicy:"origin"` on the tile layer). A `file://` page sends none, so every tile comes back as "403 Access blocked". Seen 2026-11-12.
|
||||||
|
|
||||||
|
**How to apply:**
|
||||||
|
- Serve: `cd ~/projects/baken/public && python3 -m http.server 8799`, then open `http://localhost:8799/hotelkaart/`
|
||||||
|
- A Claude Code Bash call needs `dangerouslyDisableSandbox: true` for this server, otherwise it answers 404 to every path
|
||||||
|
- `wrangler dev` fails with Wrangler 4.135.0: `wrangler.jsonc` has compatibility date 2026-11-01, newer than that binary supports (2026-09-25). Upgrade Wrangler first
|
||||||
|
- Screenshots via Playwright: use the `http://localhost` URL too (it blocks `file:`)
|
||||||
|
- Dark mode follows the system setting (`prefers-color-scheme`). Mobile layout (language toggle bottom right) at 480px and narrower
|
||||||
@@ -23,15 +23,14 @@ body{font:14px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif;background:var(
|
|||||||
#res b{display:block;font-weight:600}
|
#res b{display:block;font-weight:600}
|
||||||
#res span{color:var(--muted);font-size:12px}
|
#res span{color:var(--muted);font-size:12px}
|
||||||
#box{width:min(360px,calc(100% - 112px))}
|
#box{width:min(360px,calc(100% - 112px))}
|
||||||
.lang{display:inline-flex;border-radius:6px;overflow:hidden;background:var(--panel);box-shadow:0 1px 5px rgba(0,0,0,.4);font:600 11px system-ui,sans-serif}
|
.lang{--seg-on:#fff;display:inline-flex;gap:2px;padding:2px;border-radius:8px;background:var(--line);box-shadow:0 1px 5px rgba(0,0,0,.4);font:600 11px system-ui,sans-serif}
|
||||||
.lang button{border:0;margin:0;background:transparent;color:var(--muted);font:inherit;padding:5px 8px;cursor:pointer}
|
@media (prefers-color-scheme:dark){.lang{--seg-on:#56626c}}
|
||||||
|
.lang button{border:0;margin:0;background:transparent;color:var(--muted);font:inherit;padding:4px 9px;border-radius:6px;cursor:pointer}
|
||||||
.lang button:hover{color:var(--fg)}
|
.lang button:hover{color:var(--fg)}
|
||||||
.lang button[aria-pressed=true]{background:var(--fg);color:var(--panel);cursor:default}
|
.lang button[aria-pressed=true]{background:var(--seg-on);color:var(--fg);box-shadow:0 1px 2px rgba(0,0,0,.3);cursor:default}
|
||||||
#lang{position:absolute;z-index:1000;top:12px;right:12px}
|
#lang{position:absolute;z-index:1000;top:12px;right:12px}
|
||||||
.lv{display:none;flex-direction:column;border:0;margin:0 10px 10px 0}
|
.lv{display:none;flex-direction:column;border:0;margin:0 10px 10px 0}
|
||||||
.lv button{width:30px;height:30px;padding:0;background:#fff;color:#5d6872;font-size:12px;border-radius:0}
|
.lv button{width:30px;height:30px;padding:0;font-size:12px}
|
||||||
.lv button+button{border-top:1px solid #ccc}
|
|
||||||
.lv button[aria-pressed=true]{background:#1d2329;color:#fff}
|
|
||||||
@media (max-width:480px){#lang{display:none}.lv{display:flex}#box{width:min(360px,calc(100% - 70px))}}
|
@media (max-width:480px){#lang{display:none}.lv{display:flex}#box{width:min(360px,calc(100% - 70px))}}
|
||||||
.leaflet-popup-content{font:13px/1.4 system-ui,sans-serif}
|
.leaflet-popup-content{font:13px/1.4 system-ui,sans-serif}
|
||||||
.ua{width:26px;height:26px;border-radius:6px;background:#d6001c;color:#fff;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.45);font:700 12px/22px system-ui,sans-serif;text-align:center}
|
.ua{width:26px;height:26px;border-radius:6px;background:#d6001c;color:#fff;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.45);font:700 12px/22px system-ui,sans-serif;text-align:center}
|
||||||
|
|||||||
Reference in New Issue
Block a user