diff --git a/static/map.js b/static/map.js index dbc39e0..5e57e83 100644 --- a/static/map.js +++ b/static/map.js @@ -667,8 +667,26 @@ retraceOut.append(note); } + // The headline's second line follows the tab: searching or retracing. + const headline = document.querySelector(".headline-line"); + function setHeadline(mode) { + if (!headline) return; + const text = headline.dataset[mode]; + if (!text || headline.textContent === text) return; + if (CALM.matches) { + headline.textContent = text; + return; + } + headline.classList.add("swapping"); + window.setTimeout(() => { + headline.textContent = text; + headline.classList.remove("swapping"); + }, 160); + } + function setMode(mode) { retracing = mode === "retrace"; + setHeadline(mode); document.querySelectorAll(".mode-tab").forEach((tab) => { const on = tab.dataset.mode === mode; tab.classList.toggle("active", on); diff --git a/static/style.css b/static/style.css index 202eba6..0156b22 100644 --- a/static/style.css +++ b/static/style.css @@ -277,3 +277,5 @@ body::after{content:"";position:fixed;z-index:-1;width:420px;height:420px;right: .search-heard{margin:-2px 0 0;min-height:0} .mic-button.working .mic-icon{background:var(--muted)} .picker-choice.needs-pick{color:var(--lost)} +.headline-line{display:inline-block;transition:opacity .16s ease,transform .16s ease}.headline-line.swapping{opacity:0;transform:translateY(6px)} +@media(prefers-reduced-motion:reduce){.headline-line{transition:none}} diff --git a/templates/index.html b/templates/index.html index 4e7fe5a..0173b2a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -11,7 +11,7 @@

BIT CAMPUS ยท LIVE

-

Lost something?
Start where you were.

+

Lost something?
Someone may have found it.

diff --git a/tests/test_app.py b/tests/test_app.py index f7a6b7e..af5bf0b 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -637,6 +637,8 @@ def test_home_page_draws_the_campus_map(self): self.assertIn(b'data-place="main-block"', page) self.assertIn(b'data-badge="mech-parking"', page) self.assertIn(b"map.js", page) + self.assertIn(b"Someone may have found it.", page) + self.assertIn(b'data-retrace="Retrace your steps."', page) def test_the_place_lookup_names_the_candidates(self): found = self.client.get("/api/place?q=near+the+canteen").get_json()