diff --git a/app/components/layout/index.tsx b/app/components/layout/index.tsx index 0179dec2a..8175c9417 100644 --- a/app/components/layout/index.tsx +++ b/app/components/layout/index.tsx @@ -58,6 +58,13 @@ import { TopRightButtons } from "./TopRightButtons"; const MAX_DESKTOP_FRIENDS = 4; +/** Id of the loading-bar track rendered inside the header. NProgress mounts its + * bar into it; the track sits just below the header border, spans only the area + * between the sidebars, and clips the bar so it never extends over a sidebar. + * Living inside the header makes it follow the header on scroll and in + * standalone (PWA) mode where the header grows by the safe-area inset. */ +export const NPROGRESS_ANCHOR_ID = "nprogress-anchor"; + function useRelativeDayFormat() { const { i18n } = useTranslation(); const { formatter: timeFormatter } = useDateTimeFormat({ @@ -438,6 +445,7 @@ export function Layout({ } chatUnreadCount={chatContext?.totalUnreadCount} /> +
{showLeaderboard ? ( { if (isRevalidation(args)) return true; @@ -277,7 +282,7 @@ function useLoadingIndicator() { NProgress.done(); } }, - 250, + 150, [transition.state], ); } diff --git a/app/styles/common.css b/app/styles/common.css index 154c013e1..533289f54 100644 --- a/app/styles/common.css +++ b/app/styles/common.css @@ -614,6 +614,27 @@ } } +/* Track that NProgress renders its bar into (see NPROGRESS_ANCHOR_ID). It is a + * child of the header positioned just below the header's 1.5px bottom border, so + * it follows the header on scroll and in standalone (PWA) mode. It spans only the + * header width (the area between the sidebars), and its overflow: hidden clips the + * bar — which NProgress slides in from the left — so the bar can never extend over + * a sidebar. Unlayered + id selector so it beats NProgress's own unlayered + * .nprogress-custom-parent rules (and the @layer-wrapped CSS modules). */ +#nprogress-anchor { + position: absolute; + top: calc(100% + 1.5px); + left: 0; + right: 0; + height: 2.5px; + overflow: hidden; + pointer-events: none; +} + +.nprogress-custom-parent #nprogress .bar { + height: 100%; +} + .top-leaderboard { min-height: 100px; max-height: 100px;