From 72909fd3b25cf48919983ac0666a6ff5a4094c1b Mon Sep 17 00:00:00 2001 From: 1xDed Date: Tue, 1 Dec 2026 16:38:56 +0300 Subject: [PATCH] feat(ui): animate page transitions and scroll long menus - richer view-transition crossfade with lift and blur, reduced-motion safe - navigation drawer scrolls with a sticky close action and compact rows on short windows - settings sidebar scrolls independently when the window is short --- src/components/appBar/appBar.scss | 87 ++++++++ src/components/appBar/navigationDrawer.tsx | 218 +++++++++++---------- src/routes/_api/settings.scss | 20 ++ src/styles/global.scss | 35 +++- 4 files changed, 245 insertions(+), 115 deletions(-) diff --git a/src/components/appBar/appBar.scss b/src/components/appBar/appBar.scss index bd784c0..7193557 100644 --- a/src/components/appBar/appBar.scss +++ b/src/components/appBar/appBar.scss @@ -106,6 +106,47 @@ 0 24px 48px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2); overflow: hidden; // Contain scrollbars + display: flex; + flex-direction: column; + } + + // The drawer itself scrolls, so settings/about/libraries stay reachable + // when the window is shorter than the full menu. + &-scroll { + flex: 1 1 auto; + min-height: 0; + overflow-x: hidden; + overflow-y: auto; + overscroll-behavior: contain; + padding-bottom: 12px; + scrollbar-width: thin; + scrollbar-color: rgba(255, 255, 255, 0.22) transparent; + + &::-webkit-scrollbar { + width: 4px; + } + + &::-webkit-scrollbar-track { + background: transparent; + } + + &::-webkit-scrollbar-thumb { + background: rgba(255, 255, 255, 0.18); + border-radius: 999px; + + &:hover { + background: rgba(255, 255, 255, 0.3); + } + } + } + + // Keep the close action visible while the rest of the menu scrolls. + &-top { + position: sticky !important; + top: 0 !important; + z-index: 3; + background: rgba(18, 18, 24, 0.92); + backdrop-filter: blur(18px) saturate(160%); } .MuiList-root { @@ -227,6 +268,52 @@ } } +/* Short windows: keep every menu item reachable by scrolling and make the + rows denser so less scrolling is needed in the first place. */ +@media (max-height: 720px) { + .library-drawer { + &.MuiDrawer-paper { + margin: 8px; + height: calc(100% - 16px) !important; + } + + .MuiListItemButton-root { + min-height: 36px !important; + padding: 6px 10px !important; + } + + .MuiListItemText-primary { + font-size: 0.85rem; + } + + .MuiTypography-overline { + padding-top: 0.7em !important; + padding-bottom: 0.1em; + } + + .MuiDivider-root { + margin: 2px 12px; + } + } +} + +@media (max-height: 560px) { + .library-drawer { + .MuiListItemButton-root { + min-height: 32px !important; + padding: 4px 8px !important; + } + + .MuiListItemText-primary { + font-size: 0.8rem; + } + + .material-symbols-rounded { + font-size: 20px; + } + } +} + .back-only-bar { html.is-macos & { diff --git a/src/components/appBar/navigationDrawer.tsx b/src/components/appBar/navigationDrawer.tsx index f64c7e0..10243b2 100644 --- a/src/components/appBar/navigationDrawer.tsx +++ b/src/components/appBar/navigationDrawer.tsx @@ -61,114 +61,116 @@ export const NavigationDrawer = ({ open, onClose }: NavigationDrawerProps) => { className="library-drawer" onClose={onClose} > - - - - menu_open -
Закрыть
-
-
-
- - - Обзор - - - - - - - - - { - onClose(); - openSyncPlayDialog(); - }} - > - groups - - - - {libraries.isSuccess && - libraries.data?.Items?.map((library) => ( - - ))} - - - - Настройки - - - - - - +
+ + + + menu_open +
Закрыть
+
+
+
+ + + Обзор + + + + + + + + + { + onClose(); + openSyncPlayDialog(); + }} + > + groups + + + + {libraries.isSuccess && + libraries.data?.Items?.map((library) => ( + + ))} + + + + Настройки + + + + + + +
); }; diff --git a/src/routes/_api/settings.scss b/src/routes/_api/settings.scss index a938c03..6fea6da 100644 --- a/src/routes/_api/settings.scss +++ b/src/routes/_api/settings.scss @@ -69,6 +69,25 @@ border-right: 1px solid rgba(255, 255, 255, 0.05); padding: 1.5em 1em; // Reduced padding gap: 1em; // Reduced gap + min-height: 0; + overflow-x: hidden; + overflow-y: auto; + overscroll-behavior: contain; + scrollbar-width: thin; + scrollbar-color: rgba(255, 255, 255, 0.2) transparent; + + &::-webkit-scrollbar { + width: 4px; + } + + &::-webkit-scrollbar-track { + background: transparent; + } + + &::-webkit-scrollbar-thumb { + background: rgba(255, 255, 255, 0.18); + border-radius: 999px; + } html.is-macos & { // Overlay titlebar: leave room for the traffic lights. @@ -196,6 +215,7 @@ border-right: 0; border-bottom: 1px solid rgb(255 255 255 / 0.06); overflow-x: auto; + overflow-y: hidden; box-sizing: border-box; html.is-macos & { diff --git a/src/styles/global.scss b/src/styles/global.scss index 70d3195..203cc7e 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -135,46 +135,67 @@ body { opacity: 0.35; } -/* Fast, compositor-driven page transitions. */ +/* Page transitions: a short, soft crossfade with a gentle lift. The whole + root is snapshotted, so the app bar and player stay in place visually while + the content changes underneath them. */ @supports (view-transition-name: none) { + ::view-transition-group(root) { + animation-duration: 300ms; + animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); + } + ::view-transition-old(root), ::view-transition-new(root) { - animation-duration: 160ms; - animation-timing-function: cubic-bezier(0.2, 0, 0, 1); animation-fill-mode: both; + animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); + mix-blend-mode: normal; + transform-origin: 50% 42%; + will-change: opacity, transform, filter; } ::view-transition-old(root) { - animation-name: routeFadeOut; + animation-name: routeExit; + animation-duration: 180ms; + animation-timing-function: cubic-bezier(0.4, 0, 1, 1); } ::view-transition-new(root) { - animation-name: routeFadeIn; + animation-name: routeEnter; + animation-duration: 300ms; } } @media (prefers-reduced-motion: reduce) { + ::view-transition-group(root), ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; } } -@keyframes routeFadeOut { +@keyframes routeExit { from { opacity: 1; + transform: translateY(0) scale(1); + filter: blur(0); } to { opacity: 0; + transform: translateY(-5px) scale(0.995); + filter: blur(2px); } } -@keyframes routeFadeIn { +@keyframes routeEnter { from { opacity: 0; + transform: translateY(14px) scale(1.003); + filter: blur(6px); } to { opacity: 1; + transform: translateY(0) scale(1); + filter: blur(0); } }