From 134d25c56d7989bb7ef46cb26853bb980388899d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20=C5=BDydyk?= Date: Fri, 27 Nov 2026 19:34:18 +0100 Subject: [PATCH] Show 'Lesson not found' for unknown addresses; 24px tap targets for inline links --- app.js | 13 ++++++++++++- style.css | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index fc4acee..0ef80ed 100644 --- a/app.js +++ b/app.js @@ -185,6 +185,16 @@ function renderHome() { }; } +function renderNotFound(id) { + document.title = 'Lesson not found · Rust for Pythonistas'; + main.innerHTML = ` +
+

Lesson not found

+

There is no lesson at #/${esc(id)}.

+

← Back to the start page

+
`; +} + const reportLink = (l, where) => { const n = LESSONS.indexOf(l) + 1; const body = `**Lesson:** ${n}. ${l.title} (${SITE}#/${l.id})\n\n**Where and what:** ${where}: \n\n**What it should say instead** (optional):\n`; @@ -585,7 +595,8 @@ function route() { if (id === 'phrasebook') renderPhrasebook(); else if (page === 'errors') renderErrors(sub); else if (id === 'review') renderReview(); - else if (i < 0) renderHome(); + else if (!id) renderHome(); + else if (i < 0) renderNotFound(id); else renderLesson(i); renderNav(); document.body.classList.remove('nav-open'); diff --git a/style.css b/style.css index 8f734d8..ce4c736 100644 --- a/style.css +++ b/style.css @@ -275,6 +275,8 @@ h3.part { margin: 28px 0 0; color: var(--accent); font-size: 0.85rem; text-trans .site-foot { margin-left: 270px; padding: 20px 40px 40px; max-width: 1180px; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--border); } .site-foot a { color: var(--muted); } .site-foot a:hover { color: var(--accent); } +/* Vertical padding on inline links enlarges the tap target to 24px without moving the text. */ +.why a, .how a, .tools-line a, .site-foot a, .nav-foot .links a { padding-block: 4px; } .hero .button + .button { margin-left: 8px; } @media (max-width: 860px) { .site-foot { margin-left: 0; padding: 20px 16px 32px; } } .topbar #menu { white-space: nowrap; }