A teaser countdown, and a nav that collapses¶
I put a teaser countdown on 6umi.net. Along with it, I changed the top nav, which used to wrap on phones, so that whatever doesn't fit gets collapsed. I'll skip the backstory and only write down the parts worth reusing.
Countdown¶

DDd HHh MMm SSson both the landing page (Next.js) and the board (Streamlit). Once it hits 0, it counts up the elapsed time- Running JS every second in Streamlit:
st.htmldoesn't execute scripts. If you pass the whole HTML tost.iframe, it runs, and it doesn't trigger a Streamlit rerun either - The display freezes for 2 seconds, then jumps by 2:
setTimeoutfires a few ms after the second boundary. If you compute the remaining seconds withMath.floor, a late tick shows one less, so it stalls and then jumps.Math.roundfixes it. I did this on both the landing page and the board
Nav¶


- Collapse the trailing items that don't fit into
⋯(priority+). Measure each item's width withResizeObserverand show only as many as fit. It doesn't depend on the number of items, screen width, or font - Don't set collapsed items to
display:none. Their width becomes 0 and you can't measure them. Put them somewhere off-screen and give themaria-hidden - Submenus are one level deep. I grouped the board's pages under なごみ
- This is one of the common ways to handle phones. You can also put everything into a ≡ menu
- Hiding the top nav of the embedded Streamlit app: if the parent page has a nav, you end up with two.
?nav=0setsst.navigation(position="hidden"). Keep all pages registered so?page=links still work. A raw<a href>inside the iframe does a full reload and drops the flag, so re-appendnav=0to the links
Created 2026-10-13 · Updated 2026-11-07 · Machine-translated from the Japanese original.