π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
chore: use mobile layout for tablets too
anandbaburajan5750840e7359
diff --git a/web/apps/photos/src/components/TripTemplate/TripMap.tsx b/web/apps/photos/src/components/TripTemplate/TripMap.tsxindex 25ce1ac6d7..18ad220eae 100644--- a/web/apps/photos/src/components/TripTemplate/TripMap.tsx+++ b/web/apps/photos/src/components/TripTemplate/TripMap.tsx@@ -1,5 +1,5 @@import { Box, styled } from "@mui/material";-import { useIsSmallWidth } from "ente-base/components/utils/hooks";+import { useIsTouchscreen } from "ente-base/components/utils/hooks";import L from "leaflet";import dynamic from "next/dynamic";import { MapEvents } from "./MapEvents";@@ -58,7 +58,7 @@ export const TripMap: React.FC<TripMapProps> = ({setTargetZoom,onMarkerClick,}) => {- const isMobile = useIsSmallWidth();+ const isTouchDevice = useIsTouchscreen();// Calculate super-clusters based on screen collisionsconst { superClusters, visibleClusters } = detectScreenCollisions(@@ -74,10 +74,10 @@ export const TripMap: React.FC<TripMapProps> = ({{hasPhotoData ? (<StyledMapContainercenter={getMapCenter(photoClusters, journeyData)}- zoom={isMobile ? Math.max(1, optimalZoom - 2) : optimalZoom}+ zoom={isTouchDevice ? Math.max(1, optimalZoom - 2) : optimalZoom}scrollWheelZoom={true}zoomControl={false}- attributionControl={!isMobile}+ attributionControl={!isTouchDevice}><MapEventssetMapRef={setMapRef}@@ -86,7 +86,7 @@ export const TripMap: React.FC<TripMapProps> = ({/>{/* Stadia Alidade Satellite - includes both imagery and labels */}<TileLayer- attribution={isMobile ? '' : '© <a href="https://stadiamaps.com/">Stadia Maps</a>, © <a href="https://openmaptiles.org/">OpenMapTiles</a> © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'}+ attribution={isTouchDevice ? '' : '© <a href="https://stadiamaps.com/">Stadia Maps</a>, © <a href="https://openmaptiles.org/">OpenMapTiles</a> © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'}url="https://tiles.stadiamaps.com/tiles/alidade_satellite/{z}/{x}/{y}{r}.jpg"maxZoom={20}/>@@ -95,7 +95,7 @@ export const TripMap: React.FC<TripMapProps> = ({{superClusters.map((superCluster, index) => {// Show green for all covered locations (up to current position)let currentLocationIndex;- if (isMobile) {+ if (isTouchDevice) {// Mobile: Slower progression - stay on each location longercurrentLocationIndex = Math.floor(scrollProgress * (photoClusters.length - 0.5),@@ -113,7 +113,7 @@ export const TripMap: React.FC<TripMapProps> = ({icon={createSuperClusterIcon(superCluster.image, // Use representative photo (first photo of first cluster)superCluster.clusterCount,- isMobile ? 40 : 55,+ isTouchDevice ? 40 : 55,isCovered,)}eventHandlers={{@@ -152,7 +152,7 @@ export const TripMap: React.FC<TripMapProps> = ({);// Show green for all covered locations (up to current position)let currentLocationIndex;- if (isMobile) {+ if (isTouchDevice) {// Mobile: Slower progression - stay on each location longercurrentLocationIndex = Math.floor(scrollProgress * (photoClusters.length - 0.5),@@ -169,7 +169,7 @@ export const TripMap: React.FC<TripMapProps> = ({position={[avgLat, avgLng]}icon={createIcon(firstPhoto.image,- isMobile ? 40 : 55,+ isTouchDevice ? 40 : 55,"#ffffff",cluster.length,isCovered,diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts b/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.tsindex 15fa13faeb..1411bcc8c1 100644--- a/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts+++ b/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts@@ -1,5 +1,5 @@import { useCallback, useEffect, useMemo } from "react";-import { useIsSmallWidth } from "ente-base/components/utils/hooks";+import { useIsTouchscreen } from "ente-base/components/utils/hooks";import type { JourneyPoint } from "../types";import { throttle } from "../utils/geocoding";@@ -38,7 +38,7 @@ export const useScrollHandling = ({setHasUserScrolled,setScrollProgress,}: UseScrollHandlingParams) => {- const isMobile = useIsSmallWidth();+ const isTouchDevice = useIsTouchscreen();// Update location positions callbackconst updatePositions = useCallback(() => {updateLocationPositions({@@ -58,7 +58,7 @@ export const useScrollHandling = ({setHasUserScrolled,setScrollProgress,previousActiveLocationRef,- isMobile,+ isTouchDevice,});}, [timelineRef,@@ -69,7 +69,7 @@ export const useScrollHandling = ({setHasUserScrolled,setScrollProgress,previousActiveLocationRef,- isMobile,+ isTouchDevice,]);// Throttled scroll handler@@ -105,7 +105,7 @@ export const useScrollHandling = ({setScrollProgress,setHasUserScrolled,scrollTimelineToLocation: scrollToLocation,- isMobile,+ isTouchDevice,});},[@@ -116,7 +116,7 @@ export const useScrollHandling = ({setScrollProgress,setHasUserScrolled,scrollToLocation,- isMobile,+ isTouchDevice,],);diff --git a/web/apps/photos/src/components/TripTemplate/index.tsx b/web/apps/photos/src/components/TripTemplate/index.tsxindex ee422365e3..e500869f8d 100644--- a/web/apps/photos/src/components/TripTemplate/index.tsx+++ b/web/apps/photos/src/components/TripTemplate/index.tsx@@ -1,6 +1,6 @@import { Box, styled } from "@mui/material";import { DownloadStatusNotifications } from "components/DownloadStatusNotifications";-import { useIsSmallWidth } from "ente-base/components/utils/hooks";+import { useIsTouchscreen } from "ente-base/components/utils/hooks";import { useSaveGroups } from "ente-gallery/components/utils/save-groups";import { FileViewer } from "ente-gallery/components/viewer/FileViewer";import { downloadAndSaveCollectionFiles } from "ente-gallery/services/save";@@ -59,7 +59,7 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({const collectionTitle = collection?.name || albumTitle || "Trip";// Check if mobile screen- const isMobile = useIsSmallWidth();+ const isTouchDevice = useIsTouchscreen();// Save groups hook for download progress trackingconst { saveGroups, onAddSaveGroup, onRemoveSaveGroup } = useSaveGroups();@@ -187,7 +187,7 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({setLocationPositions,setHasUserScrolled: (scrolled: boolean) => {setHasUserScrolled(scrolled);- if (isMobile && tripStartedRef.current && timelineRef.current) {+ if (isTouchDevice && tripStartedRef.current && timelineRef.current) {const timelineContainer = timelineRef.current;const tripStartedElement = tripStartedRef.current;const tripStartedRect =@@ -218,7 +218,7 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({return (<TripTemplateContainer>{!openFileViewer &&- (isMobile ? (+ (isTouchDevice ? (<MobileNavBaronAddPhotos={onAddPhotos}downloadAllFiles={downloadAllFiles}@@ -232,7 +232,7 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({/>))}{/* Mobile Layout */}- {isMobile ? (+ {isTouchDevice ? (<MobileContainer>{/* Map takes 60% of height */}<MobileMapContainer>diff --git a/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts b/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.tsindex 772d67da3e..c90d14254e 100644--- a/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts+++ b/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts@@ -42,7 +42,7 @@ export interface HandleTimelineScrollParams {setHasUserScrolled: (scrolled: boolean) => void;setScrollProgress: (progress: number) => void;previousActiveLocationRef: React.RefObject<number>;- isMobile: boolean;+ isTouchDevice: boolean;}export const handleTimelineScroll = ({@@ -54,7 +54,7 @@ export const handleTimelineScroll = ({setHasUserScrolled,setScrollProgress,previousActiveLocationRef,- isMobile,+ isTouchDevice,}: HandleTimelineScrollParams) => {if (!timelineRef.current ||@@ -95,7 +95,7 @@ export const handleTimelineScroll = ({// Calculate current active location index based on scroll progresslet currentActiveLocationIndex = -1; // Start with no location selectedif (photoClusters.length > 0) {- if (isMobile) {+ if (isTouchDevice) {// Mobile: Slower progression - stay on each location longercurrentActiveLocationIndex = Math.floor(clampedProgress * (photoClusters.length - 0.5),@@ -155,12 +155,12 @@ export const handleTimelineScroll = ({}}- const targetZoom = isMobile ? 8 : 10; // Mobile-aware zoom level+ const targetZoom = isTouchDevice ? 8 : 10; // Touch device-aware zoom leveltry {if (isDistantLocation) {// For distant locations: zoom out β pan β zoom in- const intermediateZoom = isMobile ? 2 : 4;+ const intermediateZoom = isTouchDevice ? 2 : 4;mapRef.flyTo([positionedLat, positionedLng], intermediateZoom, {animate: true,duration: 1.5,@@ -246,7 +246,7 @@ export interface HandleMarkerClickParams {setScrollProgress: (progress: number) => void;setHasUserScrolled: (scrolled: boolean) => void;scrollTimelineToLocation: (locationIndex: number) => void;- isMobile: boolean;+ isTouchDevice: boolean;}export const handleMarkerClick = ({@@ -260,7 +260,7 @@ export const handleMarkerClick = ({setScrollProgress,setHasUserScrolled,scrollTimelineToLocation,- isMobile,+ isTouchDevice,}: HandleMarkerClickParams) => {const targetProgress = clusterIndex / Math.max(1, photoClusters.length - 1);@@ -280,7 +280,7 @@ export const handleMarkerClick = ({if (mapRef && mapRef.getContainer()) {try {- const targetZoom = isMobile ? 8 : 10; // Mobile-aware zoom level+ const targetZoom = isTouchDevice ? 8 : 10; // Touch device-aware zoom levelmapRef.flyTo([positionedLat, positionedLng], targetZoom, {animate: true,duration: 1.0,