π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[photos][web] Preserve sidebar state across breakpoints
AswinAsok5d05eaf44f3f
diff --git a/web/apps/photos/src/components/gallery/NavigationSlide.tsx b/web/apps/photos/src/components/gallery/NavigationSlide.tsxindex 110e8f42d5..b4650c05e3 100644--- a/web/apps/photos/src/components/gallery/NavigationSlide.tsx+++ b/web/apps/photos/src/components/gallery/NavigationSlide.tsx@@ -11,42 +11,58 @@ export const NavigationSlide: React.FC<width: number | { xs: number; sm: number };reduceMotion: boolean;rail?: boolean;+ disabled?: boolean;}>-> = ({ open, width, reduceMotion, rail, children }) => {- const positionRef = useNavigationContentMotion(open, reduceMotion);+> = ({ open, width, reduceMotion, rail, disabled = false, children }) => {+ const positionRef = useNavigationContentMotion(+ disabled ? "disabled" : open,+ reduceMotion,+ );return (<Box- ref={positionRef}- inert={!open}- sx={{- position: "relative",- flexShrink: 0,- width: open ? width : 0,- height: "100%",- pointerEvents: open ? undefined : "none",- zIndex: rail ? 2 : 1,- }}+ ref={disabled ? null : positionRef}+ inert={!disabled && !open}+ sx={+ disabled+ ? { display: "contents" }+ : {+ position: "relative",+ flexShrink: 0,+ width: open ? width : 0,+ height: "100%",+ pointerEvents: open ? undefined : "none",+ zIndex: rail ? 2 : 1,+ }+ }><Box- sx={{- position: "absolute",- inset: "0 auto 0 0",- width,- overflow: "clip",- }}+ sx={+ disabled+ ? { display: "contents" }+ : {+ position: "absolute",+ inset: "0 auto 0 0",+ width,+ overflow: "clip",+ }+ }><Box- sx={{- height: "100%",- transform:- open || reduceMotion- ? "translateX(0)"- : "translateX(-100%)",- opacity: open ? 1 : 0,- transition: reduceMotion- ? `opacity ${navigationMotion.fadeDuration}ms ${navigationMotion.easing}`- : `transform ${navigationMotion.duration}ms ${navigationMotion.easing}, opacity ${navigationMotion.fadeDuration}ms ${navigationMotion.easing}`,- }}+ sx={+ disabled+ ? { display: "contents" }+ : {+ height: "100%",+ transform:+ open || reduceMotion+ ? "translateX(0)"+ : "translateX(-100%)",+ opacity: open ? 1 : 0,+ transition: reduceMotion+ ? `opacity ${navigationMotion.fadeDuration}ms ${navigationMotion.easing}`+ : `transform ${navigationMotion.duration}ms ${navigationMotion.easing}, opacity ${navigationMotion.fadeDuration}ms ${navigationMotion.easing}`,+ }+ }>{children}</Box>diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsxindex 23a863d6f0..1b776fec04 100644--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx@@ -265,17 +265,14 @@ export const PhotosNavigationShell: React.FC<>{galleryNavigation && !props.isInSearchMode && (<>- {mobile ? (- galleryBar- ) : (- <NavigationSlide- open={panelOpen}- width={328}- reduceMotion={reduceMotion}- >- {galleryBar}- </NavigationSlide>- )}+ <NavigationSlide+ open={panelOpen}+ width={328}+ reduceMotion={reduceMotion}+ disabled={mobile}+ >+ {galleryBar}+ </NavigationSlide><CreateAlbumDialog{...albumNameInputVisibilityProps}isHidden={createInHiddenSection}diff --git a/web/apps/photos/src/components/gallery/use-navigation-content-motion.ts b/web/apps/photos/src/components/gallery/use-navigation-content-motion.tsindex a4c1b623ae..77e822d52b 100644--- a/web/apps/photos/src/components/gallery/use-navigation-content-motion.ts+++ b/web/apps/photos/src/components/gallery/use-navigation-content-motion.ts@@ -16,7 +16,12 @@ export const useNavigationContentMotion = (useLayoutEffect(() => {const element = ref.current;- if (!element) return;+ if (!element) {+ animation.current?.cancel();+ animation.current = undefined;+ previousLeft.current = undefined;+ return;+ }const previousAnimation = animation.current;const offset =!reduceMotion && previousAnimation?.playState == "running"