π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
chore: fix linting, formatting, type, etc. issues
anandbaburajan6c68816049e9
diff --git a/web/apps/photos/src/components/TripTemplate/MapEvents.tsx b/web/apps/photos/src/components/TripTemplate/MapEvents.tsxindex e113392b6c..17665b0293 100644--- a/web/apps/photos/src/components/TripTemplate/MapEvents.tsx+++ b/web/apps/photos/src/components/TripTemplate/MapEvents.tsx@@ -1,6 +1,6 @@+import L from "leaflet";import { memo, useEffect } from "react";import { useMap } from "react-leaflet";-import L from "leaflet";interface MapEventsProps {setMapRef: (map: L.Map) => void;@@ -8,27 +8,25 @@ interface MapEventsProps {setTargetZoom: (zoom: number | null) => void;}-export const MapEvents = memo<MapEventsProps>(({- setMapRef,- setCurrentZoom,- setTargetZoom,-}) => {- const map = useMap();+export const MapEvents = memo<MapEventsProps>(+ ({ setMapRef, setCurrentZoom, setTargetZoom }) => {+ const map = useMap();- useEffect(() => {- setMapRef(map);+ useEffect(() => {+ setMapRef(map);- const handleZoomEnd = () => {- setCurrentZoom(map.getZoom());- setTargetZoom(null);- };+ const handleZoomEnd = () => {+ setCurrentZoom(map.getZoom());+ setTargetZoom(null);+ };- map.on("zoomend", handleZoomEnd);+ map.on("zoomend", handleZoomEnd);- return () => {- map.off("zoomend", handleZoomEnd);- };- }, [map, setMapRef, setCurrentZoom, setTargetZoom]);+ return () => {+ map.off("zoomend", handleZoomEnd);+ };+ }, [map, setMapRef, setCurrentZoom, setTargetZoom]);- return null;-});\ No newline at end of file+ return null;+ },+);diff --git a/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx b/web/apps/photos/src/components/TripTemplate/PhotoFan.tsxindex f08b8806a4..8f5a2fa0c0 100644--- a/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx+++ b/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx@@ -1,6 +1,6 @@import { Box, styled } from "@mui/material";-import { memo } from "react";import Image from "next/image";+import { memo } from "react";import type { JourneyPoint } from "./types";interface PhotoFanProps {@@ -8,10 +8,7 @@ interface PhotoFanProps {onPhotoClick?: (cluster: JourneyPoint[], fileId: number) => void;}-export const PhotoFan = memo<PhotoFanProps>(({- cluster,- onPhotoClick,-}) => {+export const PhotoFan = memo<PhotoFanProps>(({ cluster, onPhotoClick }) => {if (cluster.length === 0) {return null;}@@ -21,18 +18,17 @@ export const PhotoFan = memo<PhotoFanProps>(({{cluster.length === 2 && cluster[1] && (<PhotoFrameTwoonClick={() =>- cluster[1] &&- onPhotoClick?.(cluster, cluster[1].fileId)+ cluster[1] && onPhotoClick?.(cluster, cluster[1].fileId)}><BackgroundLoadingBox />- <ImageWrapper sx={{ transform: 'skewY(-8deg) scale(1.1)' }}>+ <ImageWrapper sx={{ transform: "skewY(-8deg) scale(1.1)" }}>{cluster[1].image && cluster[1].image.trim() !== "" && (<Imagesrc={cluster[1].image}alt={cluster[1].name}fill-style={{ objectFit: "cover", zIndex: 1 }}+ style={{ objectFit: "cover", zIndex: 1 }}sizes="200px"/>)}@@ -49,16 +45,22 @@ style={{ objectFit: "cover", zIndex: 1 }}}><BackgroundLoadingBox />- <ImageWrapper sx={{ transform: 'skewY(8deg) scale(1.1)' }}>- {cluster[1].image && cluster[1].image.trim() !== "" && (- <Image- src={cluster[1].image}- alt={cluster[1].name}- fill- style={{ objectFit: "cover", zIndex: 1 }}- sizes="200px"- />- )}+ <ImageWrapper+ sx={{ transform: "skewY(8deg) scale(1.1)" }}+ >+ {cluster[1].image &&+ cluster[1].image.trim() !== "" && (+ <Image+ src={cluster[1].image}+ alt={cluster[1].name}+ fill+ style={{+ objectFit: "cover",+ zIndex: 1,+ }}+ sizes="200px"+ />+ )}</ImageWrapper></PhotoFrameLeft>)}@@ -70,16 +72,22 @@ style={{ objectFit: "cover", zIndex: 1 }}}><BackgroundLoadingBox />- <ImageWrapper sx={{ transform: 'skewY(-8deg) scale(1.1)' }}>- {cluster[2].image && cluster[2].image.trim() !== "" && (- <Image- src={cluster[2].image}- alt={cluster[2].name}- fill- style={{ objectFit: "cover", zIndex: 1 }}- sizes="200px"- />- )}+ <ImageWrapper+ sx={{ transform: "skewY(-8deg) scale(1.1)" }}+ >+ {cluster[2].image &&+ cluster[2].image.trim() !== "" && (+ <Image+ src={cluster[2].image}+ alt={cluster[2].name}+ fill+ style={{+ objectFit: "cover",+ zIndex: 1,+ }}+ sizes="200px"+ />+ )}</ImageWrapper></PhotoFrameRight>)}@@ -89,8 +97,7 @@ style={{ objectFit: "cover", zIndex: 1 }}{cluster[0] && (<MainPhotoFrameonClick={() =>- cluster[0] &&- onPhotoClick?.(cluster, cluster[0].fileId)+ cluster[0] && onPhotoClick?.(cluster, cluster[0].fileId)}>{cluster[0].image && cluster[0].image.trim() !== "" ? (@@ -106,9 +113,7 @@ style={{ objectFit: "cover", zIndex: 1 }})}{cluster.length > 3 && (- <CountBadge>- +{cluster.length - 3}- </CountBadge>+ <CountBadge>+{cluster.length - 3}</CountBadge>)}</MainPhotoFrame>)}@@ -123,12 +128,10 @@ const PhotoFanContainer = styled(Box)({height: "240px",transition: "transform 0.3s ease-in-out",cursor: "pointer",- "&:hover": {- transform: "scale(1.05)",- },+ "&:hover": { transform: "scale(1.05)" },});-const PhotoFrame = styled(Box)(({ theme }) => ({+const PhotoFrame = styled(Box)(() => ({position: "absolute",border: "2px solid white",zIndex: 10,@@ -158,7 +161,7 @@ const PhotoFrameRight = styled(PhotoFrame)({left: "0",});-const MainPhotoFrame = styled(Box)(({ theme }) => ({+const MainPhotoFrame = styled(Box)(() => ({position: "relative",width: "100%",height: "100%",@@ -200,7 +203,7 @@ const LoadingBox = styled(Box)({"@keyframes skeleton-pulse": {"0%": { backgroundColor: "#ffffff" },"50%": { backgroundColor: "#f0f0f0" },- "100%": { backgroundColor: "#ffffff" }+ "100%": { backgroundColor: "#ffffff" },},});@@ -216,6 +219,6 @@ const BackgroundLoadingBox = styled(Box)({"@keyframes skeleton-pulse": {"0%": { backgroundColor: "#ffffff" },"50%": { backgroundColor: "#f0f0f0" },- "100%": { backgroundColor: "#ffffff" }+ "100%": { backgroundColor: "#ffffff" },},-});\ No newline at end of file+});diff --git a/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx b/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsxindex 5e014cd448..076e226186 100644--- a/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx+++ b/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx@@ -5,46 +5,46 @@ interface TimelineBaseLineProps {locationPositions: { top: number; center: number }[];}-export const TimelineBaseLine = memo<TimelineBaseLineProps>(({- locationPositions,-}) => {- const timelineContainer = document.querySelector("#timeline-container");- if (!timelineContainer || locationPositions.length === 0) {- return null;- }+export const TimelineBaseLine = memo<TimelineBaseLineProps>(+ ({ locationPositions }) => {+ const timelineContainer = document.querySelector("#timeline-container");+ if (!timelineContainer || locationPositions.length === 0) {+ return null;+ }- const locationElements =- timelineContainer.querySelectorAll(".timeline-location");- if (locationElements.length === 0) {- return null;- }+ const locationElements =+ timelineContainer.querySelectorAll(".timeline-location");+ if (locationElements.length === 0) {+ return null;+ }- const lastLocation = locationElements[- locationElements.length - 1- ] as HTMLElement;- const lastLocationRect = lastLocation.getBoundingClientRect();- const heightToLastDot =- lastLocation.offsetTop + lastLocationRect.height / 2;+ const lastLocation = locationElements[+ locationElements.length - 1+ ] as HTMLElement;+ const lastLocationRect = lastLocation.getBoundingClientRect();+ const heightToLastDot =+ lastLocation.offsetTop + lastLocationRect.height / 2;- const firstLocationCenter = locationPositions[0]?.center || 0;+ const firstLocationCenter = locationPositions[0]?.center || 0;- return (- <>- <DashedLine- sx={{- top: "-60px",- height: `${firstLocationCenter + 60}px`,- }}- />- <SolidLine- sx={{- top: `${firstLocationCenter}px`,- height: `${heightToLastDot - firstLocationCenter}px`,- }}- />- </>- );-});+ return (+ <>+ <DashedLine+ sx={{+ top: "-60px",+ height: `${firstLocationCenter + 60}px`,+ }}+ />+ <SolidLine+ sx={{+ top: `${firstLocationCenter}px`,+ height: `${heightToLastDot - firstLocationCenter}px`,+ }}+ />+ </>+ );+ },+);// Styled componentsconst BaseLine = styled(Box)(() => ({@@ -63,4 +63,4 @@ const DashedLine = styled(BaseLine)(({ theme }) => ({const SolidLine = styled(BaseLine)(({ theme }) => ({backgroundColor: theme.palette.grey[300],-}));\ No newline at end of file+}));diff --git a/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx b/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsxindex ac8ed23f68..6627081e1c 100644--- a/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx+++ b/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx@@ -1,7 +1,7 @@import { Box, Typography, styled } from "@mui/material";import { memo } from "react";-import type { JourneyPoint } from "./types";import { PhotoFan } from "./PhotoFan";+import type { JourneyPoint } from "./types";interface TimelineLocationProps {cluster: JourneyPoint[];@@ -14,123 +14,125 @@ interface TimelineLocationProps {}// Component for timeline location item-export const TimelineLocation = memo<TimelineLocationProps>(({- cluster,- index,- photoClusters,- scrollProgress,- journeyData,- onRef,- onPhotoClick,-}) => {- const isLeft = index % 2 === 0;- const firstPhoto = cluster[0];- if (!firstPhoto) return null;- const sortedData = [...journeyData].sort(- (a, b) =>- new Date(a.timestamp).getTime() -- new Date(b.timestamp).getTime(),- );- const firstData = sortedData[0];- if (!firstData) return null;- const firstDate = new Date(firstData.timestamp);- const photoDate = new Date(firstPhoto.timestamp);-- const firstDateOnly = new Date(- firstDate.getFullYear(),- firstDate.getMonth(),- firstDate.getDate(),- );- const photoDateOnly = new Date(- photoDate.getFullYear(),- photoDate.getMonth(),- photoDate.getDate(),- );- const diffTime = photoDateOnly.getTime() - firstDateOnly.getTime();- const dayNumber = Math.floor(diffTime / (1000 * 60 * 60 * 24)) + 1;-- const isReached =- scrollProgress >= index / Math.max(1, photoClusters.length - 1);-- return (- <LocationContainer- ref={onRef}- id={`location-${index}`}- className="timeline-location"- sx={{- marginBottom:- index === photoClusters.length - 1 ? "24px" : "192px",- }}- >- <DotBackground />- <TimelineDot isReached={isReached} />-- {isLeft ? (- <>- <LeftContent>- <DayBadge>- DAY {dayNumber} β’{" "}- {new Date(firstPhoto.timestamp)- .toLocaleDateString("en-US", {- month: "long",- day: "numeric",- })- .toUpperCase()}- </DayBadge>- <LocationTitle sx={{ textAlign: "right" }}>- {firstPhoto.name}- </LocationTitle>- <LocationCountry sx={{ textAlign: "right" }}>- {firstPhoto.country}- </LocationCountry>- </LeftContent>- <RightPhotoContainer- sx={{- paddingLeft:- cluster.length >= 3 ? "72px" : "40px",- }}- >- <PhotoFan- cluster={cluster}- onPhotoClick={onPhotoClick}- />- </RightPhotoContainer>- </>- ) : (- <>- <LeftPhotoContainer- sx={{- paddingRight:- cluster.length >= 3 ? "72px" : "40px",- }}- >- <PhotoFan- cluster={cluster}- onPhotoClick={onPhotoClick}- />- </LeftPhotoContainer>- <RightContent>- <DayBadge>- DAY {dayNumber} β’{" "}- {new Date(firstPhoto.timestamp)- .toLocaleDateString("en-US", {- month: "long",- day: "numeric",- })- .toUpperCase()}- </DayBadge>- <LocationTitle sx={{ textAlign: "left" }}>- {firstPhoto.name}- </LocationTitle>- <LocationCountry sx={{ textAlign: "left" }}>- {firstPhoto.country}- </LocationCountry>- </RightContent>- </>- )}- </LocationContainer>- );-});+export const TimelineLocation = memo<TimelineLocationProps>(+ ({+ cluster,+ index,+ photoClusters,+ scrollProgress,+ journeyData,+ onRef,+ onPhotoClick,+ }) => {+ const isLeft = index % 2 === 0;+ const firstPhoto = cluster[0];+ if (!firstPhoto) return null;+ const sortedData = [...journeyData].sort(+ (a, b) =>+ new Date(a.timestamp).getTime() -+ new Date(b.timestamp).getTime(),+ );+ const firstData = sortedData[0];+ if (!firstData) return null;+ const firstDate = new Date(firstData.timestamp);+ const photoDate = new Date(firstPhoto.timestamp);++ const firstDateOnly = new Date(+ firstDate.getFullYear(),+ firstDate.getMonth(),+ firstDate.getDate(),+ );+ const photoDateOnly = new Date(+ photoDate.getFullYear(),+ photoDate.getMonth(),+ photoDate.getDate(),+ );+ const diffTime = photoDateOnly.getTime() - firstDateOnly.getTime();+ const dayNumber = Math.floor(diffTime / (1000 * 60 * 60 * 24)) + 1;++ const isReached =+ scrollProgress >= index / Math.max(1, photoClusters.length - 1);++ return (+ <LocationContainer+ ref={onRef}+ id={`location-${index}`}+ className="timeline-location"+ sx={{+ marginBottom:+ index === photoClusters.length - 1 ? "24px" : "192px",+ }}+ >+ <DotBackground />+ <TimelineDot isReached={isReached} />++ {isLeft ? (+ <>+ <LeftContent>+ <DayBadge>+ DAY {dayNumber} β’{" "}+ {new Date(firstPhoto.timestamp)+ .toLocaleDateString("en-US", {+ month: "long",+ day: "numeric",+ })+ .toUpperCase()}+ </DayBadge>+ <LocationTitle sx={{ textAlign: "right" }}>+ {firstPhoto.name}+ </LocationTitle>+ <LocationCountry sx={{ textAlign: "right" }}>+ {firstPhoto.country}+ </LocationCountry>+ </LeftContent>+ <RightPhotoContainer+ sx={{+ paddingLeft:+ cluster.length >= 3 ? "72px" : "40px",+ }}+ >+ <PhotoFan+ cluster={cluster}+ onPhotoClick={onPhotoClick}+ />+ </RightPhotoContainer>+ </>+ ) : (+ <>+ <LeftPhotoContainer+ sx={{+ paddingRight:+ cluster.length >= 3 ? "72px" : "40px",+ }}+ >+ <PhotoFan+ cluster={cluster}+ onPhotoClick={onPhotoClick}+ />+ </LeftPhotoContainer>+ <RightContent>+ <DayBadge>+ DAY {dayNumber} β’{" "}+ {new Date(firstPhoto.timestamp)+ .toLocaleDateString("en-US", {+ month: "long",+ day: "numeric",+ })+ .toUpperCase()}+ </DayBadge>+ <LocationTitle sx={{ textAlign: "left" }}>+ {firstPhoto.name}+ </LocationTitle>+ <LocationCountry sx={{ textAlign: "left" }}>+ {firstPhoto.country}+ </LocationCountry>+ </RightContent>+ </>+ )}+ </LocationContainer>+ );+ },+);// Styled componentsconst LocationContainer = styled(Box)({@@ -151,27 +153,28 @@ const DotBackground = styled(Box)(({ theme }) => ({backgroundColor: theme.palette.background.paper,}));-const TimelineDot = styled(Box)<{ isReached: boolean }>(({ theme, isReached }) => ({- position: "absolute",- left: "50%",- top: "50%",- transform: "translate(-50%, -50%)",- borderRadius: "50%",- border: `2px solid ${theme.palette.background.paper}`,- zIndex: 20,- width: "12px",- height: "12px",- transition: "all 0.3s",- backgroundColor: isReached ? theme.palette.success.main : theme.palette.text.primary,- boxShadow: isReached- ? `0 0 0 3px ${theme.palette.success.main}30, 0 0 0 6px ${theme.palette.success.main}15`- : "none",-}));--const ContentContainer = styled(Box)({- width: "50%",- paddingTop: "58px",-});+const TimelineDot = styled(Box)<{ isReached: boolean }>(+ ({ theme, isReached }) => ({+ position: "absolute",+ left: "50%",+ top: "50%",+ transform: "translate(-50%, -50%)",+ borderRadius: "50%",+ border: `2px solid ${theme.palette.background.paper}`,+ zIndex: 20,+ width: "12px",+ height: "12px",+ transition: "all 0.3s",+ backgroundColor: isReached+ ? theme.palette.success.main+ : theme.palette.text.primary,+ boxShadow: isReached+ ? `0 0 0 3px ${theme.palette.success.main}30, 0 0 0 6px ${theme.palette.success.main}15`+ : "none",+ }),+);++const ContentContainer = styled(Box)({ width: "50%", paddingTop: "58px" });const LeftContent = styled(ContentContainer)({paddingRight: "32px",@@ -183,9 +186,7 @@ const RightContent = styled(ContentContainer)({textAlign: "left",});-const PhotoContainer = styled(Box)({- width: "50%",-});+const PhotoContainer = styled(Box)({ width: "50%" });const LeftPhotoContainer = styled(PhotoContainer)({display: "flex",@@ -222,4 +223,4 @@ const LocationCountry = styled(Typography)(({ theme }) => ({color: theme.palette.text.secondary,margin: "4px 0 0 0",component: "p",-}));\ No newline at end of file+}));diff --git a/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx b/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsxindex 4bc205d245..b56fa1f257 100644--- a/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx+++ b/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx@@ -9,40 +9,37 @@ interface TimelineProgressLineProps {photoClusters: JourneyPoint[][];}-export const TimelineProgressLine = memo<TimelineProgressLineProps>(({- locationPositions,- scrollProgress,- hasUserScrolled,- photoClusters,-}) => {- if (photoClusters.length === 0 || locationPositions.length === 0) {- return null;- }+export const TimelineProgressLine = memo<TimelineProgressLineProps>(+ ({ locationPositions, scrollProgress, hasUserScrolled, photoClusters }) => {+ if (photoClusters.length === 0 || locationPositions.length === 0) {+ return null;+ }- const firstPosition = locationPositions[0];- const lastPosition = locationPositions[locationPositions.length - 1];- if (!firstPosition || !lastPosition) {- return null;- }- const firstLocationCenter = firstPosition.center;- const lastLocationCenter = lastPosition.center;+ const firstPosition = locationPositions[0];+ const lastPosition = locationPositions[locationPositions.length - 1];+ if (!firstPosition || !lastPosition) {+ return null;+ }+ const firstLocationCenter = firstPosition.center;+ const lastLocationCenter = lastPosition.center;- if (scrollProgress <= 0 || !hasUserScrolled) {- return null;- }+ if (scrollProgress <= 0 || !hasUserScrolled) {+ return null;+ }- return (- <ProgressLine- sx={{- top: `${firstLocationCenter}px`,- height: `${- (lastLocationCenter - firstLocationCenter) *- scrollProgress- }px`,- }}- />- );-});+ return (+ <ProgressLine+ sx={{+ top: `${firstLocationCenter}px`,+ height: `${+ (lastLocationCenter - firstLocationCenter) *+ scrollProgress+ }px`,+ }}+ />+ );+ },+);// Styled componentsconst ProgressLine = styled(Box)(({ theme }) => ({@@ -51,4 +48,4 @@ const ProgressLine = styled(Box)(({ theme }) => ({transform: "translateX(-1.5px)",width: "3px",backgroundColor: theme.palette.success.main,-}));\ No newline at end of file+}));diff --git a/web/apps/photos/src/components/TripTemplate/TripMap.tsx b/web/apps/photos/src/components/TripTemplate/TripMap.tsxindex f763742724..d40fb07534 100644--- a/web/apps/photos/src/components/TripTemplate/TripMap.tsx+++ b/web/apps/photos/src/components/TripTemplate/TripMap.tsx@@ -1,7 +1,6 @@import { Box, styled } from "@mui/material";import L from "leaflet";import dynamic from "next/dynamic";-import type { JourneyPoint } from "./types";import { MapEvents } from "./MapEvents";import {createIcon,@@ -9,6 +8,7 @@ import {detectScreenCollisions,getMapCenter,} from "./mapHelpers";+import type { JourneyPoint } from "./types";// Dynamically import react-leaflet components to prevent SSR issuesconst MapContainer = dynamic(@@ -33,7 +33,6 @@ interface TripMapProps {targetZoom: number | null;mapRef: L.Map | null;scrollProgress: number;- screenDimensions: { width: number; height: number };setMapRef: (map: L.Map | null) => void;setCurrentZoom: (zoom: number) => void;setTargetZoom: (zoom: number | null) => void;@@ -53,7 +52,6 @@ export const TripMap: React.FC<TripMapProps> = ({targetZoom,mapRef,scrollProgress,- screenDimensions,setMapRef,setCurrentZoom,setTargetZoom,@@ -72,11 +70,7 @@ export const TripMap: React.FC<TripMapProps> = ({<MapContainerWrapper hasPhotoData={hasPhotoData}>{hasPhotoData ? (<StyledMapContainer- center={getMapCenter(- photoClusters,- journeyData,- screenDimensions,- )}+ center={getMapCenter(photoClusters, journeyData)}zoom={optimalZoom}scrollWheelZoom={true}zoomControl={false}@@ -96,7 +90,8 @@ export const TripMap: React.FC<TripMapProps> = ({{/* Draw super-clusters (clickable for zoom and gallery) */}{superClusters.map((superCluster, index) => {// Check if this super-cluster has been reached- const firstClusterIndex = superCluster.clustersInvolved[0];+ const firstClusterIndex =+ superCluster.clustersInvolved[0];const isReached =firstClusterIndex !== undefined &&scrollProgress >=@@ -194,13 +189,15 @@ export const TripMap: React.FC<TripMapProps> = ({};// Styled components-const MapContainerWrapper = styled(Box)<{ hasPhotoData: boolean }>(({ hasPhotoData }) => ({- width: "100%",- height: "100%",- backgroundColor: hasPhotoData ? "transparent" : "#000000",-}));+const MapContainerWrapper = styled(Box)<{ hasPhotoData: boolean }>(+ ({ hasPhotoData }) => ({+ width: "100%",+ height: "100%",+ backgroundColor: hasPhotoData ? "transparent" : "#000000",+ }),+);const StyledMapContainer = styled(MapContainer)({width: "100%",height: "100%",-});\ No newline at end of file+});diff --git a/web/apps/photos/src/components/TripTemplate/TripStartedSection.tsx b/web/apps/photos/src/components/TripTemplate/TripStartedSection.tsxindex 229665f7f9..c617f02138 100644--- a/web/apps/photos/src/components/TripTemplate/TripStartedSection.tsx+++ b/web/apps/photos/src/components/TripTemplate/TripStartedSection.tsx@@ -6,35 +6,35 @@ interface TripStartedSectionProps {journeyData: JourneyPoint[];}-export const TripStartedSection = memo<TripStartedSectionProps>(({ journeyData }) => {- const sortedData = [...journeyData].sort(- (a, b) =>- new Date(a.timestamp).getTime() -- new Date(b.timestamp).getTime(),- );- const firstData = sortedData[0];- if (!firstData) {- return null;- }- const firstDate = new Date(firstData.timestamp);+export const TripStartedSection = memo<TripStartedSectionProps>(+ ({ journeyData }) => {+ const sortedData = [...journeyData].sort(+ (a, b) =>+ new Date(a.timestamp).getTime() -+ new Date(b.timestamp).getTime(),+ );+ const firstData = sortedData[0];+ if (!firstData) {+ return null;+ }+ const firstDate = new Date(firstData.timestamp);- return (- <SectionContainer>- <TripStartedLabel>- Trip started- </TripStartedLabel>- <br />- <DateLabel>- {firstDate.toLocaleDateString("en-US", {- month: "long",- day: "2-digit",- })}- </DateLabel>+ return (+ <SectionContainer>+ <TripStartedLabel>Trip started</TripStartedLabel>+ <br />+ <DateLabel>+ {firstDate.toLocaleDateString("en-US", {+ month: "long",+ day: "2-digit",+ })}+ </DateLabel>- <StartingDot />- </SectionContainer>- );-});+ <StartingDot />+ </SectionContainer>+ );+ },+);// Styled componentsconst SectionContainer = styled(Box)({@@ -78,4 +78,4 @@ const StartingDot = styled(Box)(({ theme }) => ({width: "12px",height: "12px",backgroundColor: theme.palette.grey[300],-}));\ No newline at end of file+}));diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useDataProcessing.ts b/web/apps/photos/src/components/TripTemplate/hooks/useDataProcessing.tsindex e21b030132..40625e1f0f 100644--- a/web/apps/photos/src/components/TripTemplate/hooks/useDataProcessing.ts+++ b/web/apps/photos/src/components/TripTemplate/hooks/useDataProcessing.ts@@ -1,21 +1,22 @@-import { useEffect } from "react";-import { type EnteFile } from "ente-media/file";import { type Collection } from "ente-media/collection";+import { type EnteFile } from "ente-media/file";+import { useEffect } from "react";import type { JourneyPoint } from "../types";-import {- processPhotosData,- loadCoverImage,-} from "../utils/dataProcessing";+import { loadCoverImage, processPhotosData } from "../utils/dataProcessing";export interface UseDataProcessingParams {files: EnteFile[];collection?: Collection;journeyData: JourneyPoint[];- thumbnailsGeneratedRef: React.MutableRefObject<boolean>;- filesCountRef: React.MutableRefObject<number>;- locationDataRef: React.MutableRefObject<Map<number, { name: string; country: string }>>;- setJourneyData: (data: JourneyPoint[] | ((prev: JourneyPoint[]) => JourneyPoint[])) => void;+ thumbnailsGeneratedRef: React.RefObject<boolean>;+ filesCountRef: React.RefObject<number>;+ locationDataRef: React.RefObject<+ Map<number, { name: string; country: string }>+ >;+ setJourneyData: (+ data: JourneyPoint[] | ((prev: JourneyPoint[]) => JourneyPoint[]),+ ) => void;setIsInitialLoad: (loading: boolean) => void;setIsLoadingLocations: (loading: boolean) => void;setCoverImageUrl: (url: string | null) => void;@@ -55,7 +56,16 @@ export const useDataProcessing = ({if (hasLocationData) {setIsLoadingLocations(true);}- }, [files, journeyData.length, filesCountRef, locationDataRef, thumbnailsGeneratedRef, setJourneyData, setIsInitialLoad, setIsLoadingLocations]);+ }, [+ files,+ journeyData.length,+ filesCountRef,+ locationDataRef,+ thumbnailsGeneratedRef,+ setJourneyData,+ setIsInitialLoad,+ setIsLoadingLocations,+ ]);// Load cover image after data loadsuseEffect(() => {@@ -72,4 +82,4 @@ export const useDataProcessing = ({void loadCover();}, [journeyData, files, collection, setCoverImageUrl]);-};\ No newline at end of file+};diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts b/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.tsindex 92455d5b48..ceb3d8ce8f 100644--- a/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts+++ b/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts@@ -1,6 +1,6 @@import { type EnteFile } from "ente-media/file";import { useCallback, useState } from "react";-import type { JourneyPoint } from "./types";+import type { JourneyPoint } from "../types";interface UseFileViewerProps {files: EnteFile[];@@ -62,4 +62,4 @@ export const useFileViewer = ({handleCloseFileViewer,handleTriggerRemotePull,};-};\ No newline at end of file+};diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts b/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.tsindex 3e2b5b087e..ac5ccd4d67 100644--- a/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts+++ b/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts@@ -6,8 +6,12 @@ import { fetchLocationNames } from "../utils/dataProcessing";export interface UseLocationFetchingParams {photoClusters: JourneyPoint[][];journeyData: JourneyPoint[];- locationDataRef: React.MutableRefObject<Map<number, { name: string; country: string }>>;- setJourneyData: (data: JourneyPoint[] | ((prev: JourneyPoint[]) => JourneyPoint[])) => void;+ locationDataRef: React.RefObject<+ Map<number, { name: string; country: string }>+ >;+ setJourneyData: (+ data: JourneyPoint[] | ((prev: JourneyPoint[]) => JourneyPoint[]),+ ) => void;setIsLoadingLocations: (loading: boolean) => void;}@@ -48,5 +52,10 @@ export const useLocationFetching = ({};void fetchNames();- }, [photoClusters.length, locationDataRef, setJourneyData, setIsLoadingLocations]);-};\ No newline at end of file+ }, [+ photoClusters.length,+ locationDataRef,+ setJourneyData,+ setIsLoadingLocations,+ ]);+};diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts b/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.tsindex 905d61a53d..f0d026c144 100644--- a/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts+++ b/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts@@ -3,10 +3,10 @@ import { useCallback, useEffect, useMemo } from "react";import type { JourneyPoint } from "../types";import { throttle } from "../utils/geocoding";import {- updateLocationPositions,+ handleMarkerClick,handleTimelineScroll,scrollTimelineToLocation,- handleMarkerClick,+ updateLocationPositions,type PositionInfo,} from "../utils/scrollUtils";@@ -15,11 +15,10 @@ export interface UseScrollHandlingParams {photoClusters: JourneyPoint[][];locationPositions: PositionInfo[];mapRef: L.Map | null;- screenDimensions: { width: number; height: number };optimalZoom: number;- locationRefs: React.MutableRefObject<(HTMLDivElement | null)[]>;- isClusterClickScrollingRef: React.MutableRefObject<boolean>;- clusterClickTimeoutRef: React.MutableRefObject<NodeJS.Timeout | null>;+ locationRefs: React.RefObject<(HTMLDivElement | null)[]>;+ isClusterClickScrollingRef: React.RefObject<boolean>;+ clusterClickTimeoutRef: React.RefObject<NodeJS.Timeout | null>;setLocationPositions: (positions: PositionInfo[]) => void;setHasUserScrolled: (scrolled: boolean) => void;setScrollProgress: (progress: number) => void;@@ -30,7 +29,6 @@ export const useScrollHandling = ({photoClusters,locationPositions,mapRef,- screenDimensions,optimalZoom,locationRefs,isClusterClickScrollingRef,@@ -54,7 +52,6 @@ export const useScrollHandling = ({photoClusters,locationPositions,mapRef,- screenDimensions,optimalZoom,isClusterClickScrollingRef,setHasUserScrolled,@@ -65,7 +62,6 @@ export const useScrollHandling = ({photoClusters,locationPositions,mapRef,- screenDimensions,optimalZoom,isClusterClickScrollingRef,setHasUserScrolled,@@ -99,7 +95,6 @@ export const useScrollHandling = ({clusterLat,clusterLng,photoClusters,- screenDimensions,mapRef,optimalZoom,isClusterClickScrollingRef,@@ -111,7 +106,6 @@ export const useScrollHandling = ({},[photoClusters,- screenDimensions,mapRef,optimalZoom,isClusterClickScrollingRef,@@ -142,7 +136,10 @@ export const useScrollHandling = ({timelineContainer.addEventListener("scroll", throttledTimelineScroll);return () => {- timelineContainer.removeEventListener("scroll", throttledTimelineScroll);+ timelineContainer.removeEventListener(+ "scroll",+ throttledTimelineScroll,+ );};}, [throttledTimelineScroll, timelineRef]);@@ -156,9 +153,5 @@ export const useScrollHandling = ({};}, [clusterClickTimeoutRef]);- return {- updatePositions,- scrollToLocation,- markerClickHandler,- };-};\ No newline at end of file+ return { updatePositions, scrollToLocation, markerClickHandler };+};diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts b/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.tsindex e56423c2cf..dbd997edc5 100644--- a/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts+++ b/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts@@ -1,5 +1,5 @@-import { useEffect } from "react";import { type EnteFile } from "ente-media/file";+import { useEffect } from "react";import type { JourneyPoint } from "../types";import { generateNeededThumbnails } from "../utils/dataProcessing";@@ -8,8 +8,10 @@ export interface UseThumbnailGenerationParams {photoClusters: JourneyPoint[][];journeyData: JourneyPoint[];files: EnteFile[];- thumbnailsGeneratedRef: React.MutableRefObject<boolean>;- setJourneyData: (data: JourneyPoint[] | ((prev: JourneyPoint[]) => JourneyPoint[])) => void;+ thumbnailsGeneratedRef: React.RefObject<boolean>;+ setJourneyData: (+ data: JourneyPoint[] | ((prev: JourneyPoint[]) => JourneyPoint[]),+ ) => void;}export const useThumbnailGeneration = ({@@ -21,7 +23,8 @@ export const useThumbnailGeneration = ({// Generate thumbnails for needed photos with progressive loadinguseEffect(() => {const generateThumbs = async () => {- if (photoClusters.length === 0 || thumbnailsGeneratedRef.current) return;+ if (photoClusters.length === 0 || thumbnailsGeneratedRef.current)+ return;const { thumbnailUpdates } = await generateNeededThumbnails({photoClusters,@@ -44,4 +47,4 @@ export const useThumbnailGeneration = ({void generateThumbs();}, [photoClusters.length, files, thumbnailsGeneratedRef, setJourneyData]);-};\ No newline at end of file+};diff --git a/web/apps/photos/src/components/TripTemplate/index.tsx b/web/apps/photos/src/components/TripTemplate/index.tsxindex a558c3dda9..ec8a94c888 100644--- a/web/apps/photos/src/components/TripTemplate/index.tsx+++ b/web/apps/photos/src/components/TripTemplate/index.tsx@@ -129,10 +129,7 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({}, []);const photoClusters = useMemo(() => {- const clusters = clusterPhotosByProximity(- journeyData,- screenDimensions,- );+ const clusters = clusterPhotosByProximity(journeyData);// Sort clusters by their earliest timestamp to maintain chronological orderreturn clusters.sort((a, b) => {@@ -144,7 +141,7 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({);return earliestA - earliestB;});- }, [journeyData, screenDimensions]);+ }, [journeyData]);// Calculate optimal zoom level based on cluster spreadconst optimalZoom = useMemo(() => {@@ -199,7 +196,6 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({photoClusters,locationPositions,mapRef,- screenDimensions,optimalZoom,locationRefs,isClusterClickScrollingRef,@@ -334,7 +330,6 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({targetZoom={targetZoom}mapRef={mapRef}scrollProgress={scrollProgress}- screenDimensions={screenDimensions}setMapRef={setMapRef}setCurrentZoom={setCurrentZoom}setTargetZoom={setTargetZoom}diff --git a/web/apps/photos/src/components/TripTemplate/mapHelpers.ts b/web/apps/photos/src/components/TripTemplate/mapHelpers.tsindex f6c862556c..24b73e4c13 100644--- a/web/apps/photos/src/components/TripTemplate/mapHelpers.ts+++ b/web/apps/photos/src/components/TripTemplate/mapHelpers.ts@@ -3,10 +3,7 @@ import type { JourneyPoint } from "./types";import { iconCache } from "./utils/geocoding";// Geographic clustering with responsive distance thresholds and day separation-export const clusterPhotosByProximity = (- photos: JourneyPoint[],- screenDimensions: { width: number; height: number },-) => {+export const clusterPhotosByProximity = (photos: JourneyPoint[]) => {if (photos.length === 0) return [];// 10km clustering distance (roughly 0.1 degrees)@@ -143,10 +140,7 @@ export const calculateOptimalZoom = ();// Prioritize fitting bounds with some buffer for cluster separation- const calculatedZoom = Math.min(- zoomToFitBounds,- optimalZoomFromSeparation,- );+ const calculatedZoom = Math.min(zoomToFitBounds, optimalZoomFromSeparation);const clampedZoom = Math.max(6, Math.min(14, calculatedZoom));return Math.round(clampedZoom);@@ -203,7 +197,9 @@ export const createIcon = (onmouseover="this.style.background='#22c55e'; this.style.borderColor='#22c55e'; this.nextElementSibling.style.borderTopColor='#22c55e';"onmouseout="this.style.background='${isReached ? "#22c55e" : "white"}'; this.style.borderColor='${isReached ? "#22c55e" : "#ffffff"}'; this.nextElementSibling.style.borderTopColor='${isReached ? "#22c55e" : "white"}';">- ${hasImage ? `+ ${+ hasImage+ ? `<!-- Image inside the rounded rectangle --><imgsrc="${imageSrc}"@@ -215,7 +211,8 @@ export const createIcon = ("alt="Location"/>- ` : `+ `+ : `<!-- Loading skeleton when no image --><div style="width: 100%;@@ -230,7 +227,8 @@ export const createIcon = (100% { background-color: #ffffff; }}</style>- `}+ `+ }</div><!-- Triangle at the bottom -->@@ -319,7 +317,9 @@ export const createSuperClusterIcon = (onmouseover="this.style.background='#22c55e'; this.style.borderColor='#22c55e'; this.nextElementSibling.style.borderTopColor='#22c55e';"onmouseout="this.style.background='${isReached ? "#22c55e" : "white"}'; this.style.borderColor='${isReached ? "#22c55e" : "#ffffff"}'; this.nextElementSibling.style.borderTopColor='${isReached ? "#22c55e" : "white"}';">- ${hasImage ? `+ ${+ hasImage+ ? `<!-- Image inside the rounded rectangle --><imgsrc="${imageSrc}"@@ -331,7 +331,8 @@ export const createSuperClusterIcon = ("alt="Location"/>- ` : `+ `+ : `<!-- Loading skeleton when no image --><div style="width: 100%;@@ -346,7 +347,8 @@ export const createSuperClusterIcon = (100% { background-color: #ffffff; }}</style>- `}+ `+ }</div><!-- Triangle at the bottom -->@@ -503,7 +505,6 @@ export const detectScreenCollisions = (export const getMapCenter = (photoClusters: JourneyPoint[][],journeyData: JourneyPoint[],- screenDimensions: { width: number; height: number },): [number, number] => {// If no clusters yet, check journey dataif (photoClusters.length === 0) {@@ -546,4 +547,4 @@ export const getMapCenter = (const adjustedLng = firstLng - shiftAmount;return [firstLat, adjustedLng];-};\ No newline at end of file+};diff --git a/web/apps/photos/src/components/TripTemplate/types.ts b/web/apps/photos/src/components/TripTemplate/types.tsindex 704218be76..b1a482a1c8 100644--- a/web/apps/photos/src/components/TripTemplate/types.ts+++ b/web/apps/photos/src/components/TripTemplate/types.ts@@ -6,4 +6,4 @@ export interface JourneyPoint {timestamp: string;image: string;fileId: number;-}\ No newline at end of file+}diff --git a/web/apps/photos/src/components/TripTemplate/utils/dataProcessing.ts b/web/apps/photos/src/components/TripTemplate/utils/dataProcessing.tsindex 271591926a..105c9c9592 100644--- a/web/apps/photos/src/components/TripTemplate/utils/dataProcessing.ts+++ b/web/apps/photos/src/components/TripTemplate/utils/dataProcessing.ts@@ -1,14 +1,16 @@-import React from "react";import { downloadManager } from "ente-gallery/services/download";import { type EnteFile } from "ente-media/file";import { fileFileName } from "ente-media/file-metadata";+import React from "react";-import { getLocationName } from "./geocoding";import type { JourneyPoint } from "../types";+import { getLocationName } from "./geocoding";export interface ProcessPhotosDataParams {files: EnteFile[];- locationDataRef: React.MutableRefObject<Map<number, { name: string; country: string }>>;+ locationDataRef: React.RefObject<+ Map<number, { name: string; country: string }>+ >;}export interface ProcessPhotosDataResult {@@ -41,7 +43,9 @@ export const processPhotosData = ({lng: lng,name: finalName,country: finalCountry,- timestamp: new Date(file.metadata.creationTime / 1000).toISOString(),+ timestamp: new Date(+ file.metadata.creationTime / 1000,+ ).toISOString(),image: "",fileId: file.id,});@@ -62,7 +66,9 @@ export const processPhotosData = ({export interface FetchLocationNamesParams {photoClusters: JourneyPoint[][];journeyData: JourneyPoint[];- locationDataRef: React.MutableRefObject<Map<number, { name: string; country: string }>>;+ locationDataRef: React.RefObject<+ Map<number, { name: string; country: string }>+ >;}export interface FetchLocationNamesResult {@@ -83,8 +89,10 @@ export const fetchLocationNames = async ({const cluster = photoClusters[i];if (!cluster || cluster.length === 0) continue;- const avgLat = cluster.reduce((sum, p) => sum + p.lat, 0) / cluster.length;- const avgLng = cluster.reduce((sum, p) => sum + p.lng, 0) / cluster.length;+ const avgLat =+ cluster.reduce((sum, p) => sum + p.lat, 0) / cluster.length;+ const avgLng =+ cluster.reduce((sum, p) => sum + p.lng, 0) / cluster.length;try {const locationInfo = await getLocationName(avgLat, avgLng, i + 1);@@ -130,7 +138,7 @@ export const generateNeededThumbnails = async ({const priorityGroups: EnteFile[][] = [];// Priority 1: Cover image (handled separately in loadCoverImage, skip here)-+// Priority 2: First 3 locations photosfans (first 3 photos from each)const firstLocationsFiles: EnteFile[] = [];photoClusters.slice(0, 3).forEach((cluster) => {@@ -149,8 +157,13 @@ export const generateNeededThumbnails = async ({const mapMarkerFiles: EnteFile[] = [];photoClusters.forEach((cluster) => {if (cluster.length > 0 && cluster[0]) {- const file = files.find((f) => f.id === cluster[0].fileId);- if (file && !firstLocationsFiles.includes(file) && !mapMarkerFiles.includes(file)) {+ const firstPhoto = cluster[0];+ const file = files.find((f) => f.id === firstPhoto.fileId);+ if (+ file &&+ !firstLocationsFiles.includes(file) &&+ !mapMarkerFiles.includes(file)+ ) {mapMarkerFiles.push(file);}}@@ -164,10 +177,12 @@ export const generateNeededThumbnails = async ({photoClusters.slice(3).forEach((cluster) => {cluster.slice(0, 3).forEach((photo) => {const file = files.find((f) => f.id === photo.fileId);- if (file &&- !firstLocationsFiles.includes(file) &&- !mapMarkerFiles.includes(file) &&- !remainingLocationFiles.includes(file)) {+ if (+ file &&+ !firstLocationsFiles.includes(file) &&+ !mapMarkerFiles.includes(file) &&+ !remainingLocationFiles.includes(file)+ ) {remainingLocationFiles.push(file);}});@@ -180,11 +195,12 @@ export const generateNeededThumbnails = async ({for (let groupIndex = 0; groupIndex < priorityGroups.length; groupIndex++) {const group = priorityGroups[groupIndex];if (!group) continue;-+// Process files in parallel within each priority groupconst groupPromises = group.map(async (file) => {try {- const thumbnailUrl = await downloadManager.renderableThumbnailURL(file);+ const thumbnailUrl =+ await downloadManager.renderableThumbnailURL(file);if (thumbnailUrl) {thumbnailUpdates.set(file.id, thumbnailUrl);}@@ -194,10 +210,10 @@ export const generateNeededThumbnails = async ({});await Promise.all(groupPromises);-+// Add small delay between priority groups to allow UI updatesif (groupIndex < priorityGroups.length - 1) {- await new Promise(resolve => setTimeout(resolve, 50));+ await new Promise((resolve) => setTimeout(resolve, 50));}}@@ -236,7 +252,8 @@ export const loadCoverImage = async ({try {// Load cover image at highest quality first (highest priority)- const sourceURLs = await downloadManager.renderableSourceURLs(coverFile);+ const sourceURLs =+ await downloadManager.renderableSourceURLs(coverFile);if (sourceURLs.type === "image") {return sourceURLs.imageURL;}@@ -245,4 +262,4 @@ export const loadCoverImage = async ({}return null;-};\ No newline at end of file+};diff --git a/web/apps/photos/src/components/TripTemplate/utils/geocoding.ts b/web/apps/photos/src/components/TripTemplate/utils/geocoding.tsindex 02a4d365c9..dc3444a1cf 100644--- a/web/apps/photos/src/components/TripTemplate/utils/geocoding.ts+++ b/web/apps/photos/src/components/TripTemplate/utils/geocoding.ts@@ -14,7 +14,10 @@ interface GeocodingResponse {}// Geocoding cache to avoid repeated API calls-export const geocodingCache = new Map<string, { place: string; country: string }>();+export const geocodingCache = new Map<+ string,+ { place: string; country: string }+>();// Icon cache to avoid recreating identical iconsexport const iconCache = new Map<string, L.DivIcon>();@@ -22,23 +25,26 @@ export const iconCache = new Map<string, L.DivIcon>();// Throttle function for performance optimizationexport const throttle = <T extends (...args: unknown[]) => void>(func: T,- delay: number+ delay: number,): ((...args: Parameters<T>) => void) => {let timeoutId: NodeJS.Timeout | null = null;let lastExecTime = 0;-+return (...args: Parameters<T>) => {const currentTime = Date.now();-+if (currentTime - lastExecTime > delay) {func(...args);lastExecTime = currentTime;} else {if (timeoutId) clearTimeout(timeoutId);- timeoutId = setTimeout(() => {- func(...args);- lastExecTime = Date.now();- }, delay - (currentTime - lastExecTime));+ timeoutId = setTimeout(+ () => {+ func(...args);+ lastExecTime = Date.now();+ },+ delay - (currentTime - lastExecTime),+ );}};};@@ -113,4 +119,4 @@ export const getLocationName = async (geocodingCache.set(cacheKey, fallbackResult);return fallbackResult;}-};\ No newline at end of file+};diff --git a/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts b/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.tsindex 2c8e794a8e..b00a883262 100644--- a/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts+++ b/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts@@ -37,9 +37,8 @@ export interface HandleTimelineScrollParams {photoClusters: JourneyPoint[][];locationPositions: PositionInfo[];mapRef: L.Map | null;- screenDimensions: { width: number; height: number };optimalZoom: number;- isClusterClickScrollingRef: React.MutableRefObject<boolean>;+ isClusterClickScrollingRef: React.RefObject<boolean>;setHasUserScrolled: (scrolled: boolean) => void;setScrollProgress: (progress: number) => void;}@@ -49,7 +48,6 @@ export const handleTimelineScroll = ({photoClusters,locationPositions,mapRef,- screenDimensions,optimalZoom,isClusterClickScrollingRef,setHasUserScrolled,@@ -90,10 +88,12 @@ export const handleTimelineScroll = ({setScrollProgress(clampedProgress);});- if (mapRef && !isClusterClickScrollingRef.current) {+ if (mapRef) {const clusterCenters = photoClusters.map((cluster) => {- const avgLat = cluster.reduce((sum, p) => sum + p.lat, 0) / cluster.length;- const avgLng = cluster.reduce((sum, p) => sum + p.lng, 0) / cluster.length;+ const avgLat =+ cluster.reduce((sum, p) => sum + p.lat, 0) / cluster.length;+ const avgLng =+ cluster.reduce((sum, p) => sum + p.lng, 0) / cluster.length;return { lat: avgLat, lng: avgLng };});@@ -111,7 +111,8 @@ export const handleTimelineScroll = ({targetLat = lastCenter.lat;targetLng = lastCenter.lng;} else {- const clusterProgress = clampedProgress * (clusterCenters.length - 1);+ const clusterProgress =+ clampedProgress * (clusterCenters.length - 1);const currentClusterIndex = Math.floor(clusterProgress);const nextClusterIndex = Math.min(currentClusterIndex + 1,@@ -194,7 +195,8 @@ export const scrollTimelineToLocation = ({const clientHeight = timelineContainer.clientHeight;const maxScrollableDistance = scrollHeight - clientHeight;- const targetProgress = locationIndex / Math.max(1, photoClusters.length - 1);+ const targetProgress =+ locationIndex / Math.max(1, photoClusters.length - 1);const targetScrollTop = targetProgress * maxScrollableDistance;timelineContainer.scrollTo({@@ -208,11 +210,10 @@ export interface HandleMarkerClickParams {clusterLat: number;clusterLng: number;photoClusters: JourneyPoint[][];- screenDimensions: { width: number; height: number };mapRef: L.Map | null;optimalZoom: number;- isClusterClickScrollingRef: React.MutableRefObject<boolean>;- clusterClickTimeoutRef: React.MutableRefObject<NodeJS.Timeout | null>;+ isClusterClickScrollingRef: React.RefObject<boolean>;+ clusterClickTimeoutRef: React.RefObject<NodeJS.Timeout | null>;setScrollProgress: (progress: number) => void;setHasUserScrolled: (scrolled: boolean) => void;scrollTimelineToLocation: (locationIndex: number) => void;@@ -223,7 +224,6 @@ export const handleMarkerClick = ({clusterLat,clusterLng,photoClusters,- screenDimensions: _screenDimensions,mapRef,optimalZoom,isClusterClickScrollingRef,@@ -243,7 +243,8 @@ export const handleMarkerClick = ({setHasUserScrolled(true);const allClusterLngs = photoClusters.map(- (cluster) => cluster.reduce((sum, p) => sum + p.lng, 0) / cluster.length,+ (cluster) =>+ cluster.reduce((sum, p) => sum + p.lng, 0) / cluster.length,);const minLng = Math.min(...allClusterLngs);const maxLng = Math.max(...allClusterLngs);@@ -280,4 +281,4 @@ export const handleMarkerClick = ({isClusterClickScrollingRef.current = false;clusterClickTimeoutRef.current = null;}, 1500);-};\ No newline at end of file+};