Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

chore: linting

anandbaburajanab94f5588958
diff --git a/web/apps/photos/src/components/TripLayout/TripMap.tsx b/web/apps/photos/src/components/TripLayout/TripMap.tsx
index e6308bf624..3c53e2e2d5 100644
--- a/web/apps/photos/src/components/TripLayout/TripMap.tsx
+++ b/web/apps/photos/src/components/TripLayout/TripMap.tsx
@@ -88,22 +88,27 @@ export const TripMap: React.FC<TripMapProps> = ({
}
// Calculate super-clusters based on screen collisions, excluding the active cluster
- const { superClusters, visibleClustersWithIndices } = detectScreenCollisions(
- photoClusters,
- currentZoom,
- targetZoom,
- mapRef,
- optimalZoom,
- currentActiveLocationIndex >= 0
- ? currentActiveLocationIndex
- : undefined,
- );
+ const { superClusters, visibleClustersWithIndices } =
+ detectScreenCollisions(
+ photoClusters,
+ currentZoom,
+ targetZoom,
+ mapRef,
+ optimalZoom,
+ currentActiveLocationIndex >= 0
+ ? currentActiveLocationIndex
+ : undefined,
+ );
return (
<MapContainerWrapper hasPhotoData={hasPhotoData}>
{hasPhotoData ? (
<StyledMapContainer
- center={getMapCenter(photoClusters, journeyData, superClusterInfo)}
+ center={getMapCenter(
+ photoClusters,
+ journeyData,
+ superClusterInfo,
+ )}
zoom={
isTouchDevice
? Math.max(1, optimalZoom - 2)
@@ -147,9 +152,10 @@ export const TripMap: React.FC<TripMapProps> = ({
Math.max(0, photoClusters.length - 1),
);
}
- const isActive = superCluster.clustersInvolved.includes(
- currentLocationIndex,
- );
+ const isActive =
+ superCluster.clustersInvolved.includes(
+ currentLocationIndex,
+ );
const icon = createSuperClusterIcon(
superCluster.image, // Use representative photo (first photo of first cluster)
diff --git a/web/apps/photos/src/components/TripLayout/index.tsx b/web/apps/photos/src/components/TripLayout/index.tsx
index 503fd47f64..f3a7a7b142 100644
--- a/web/apps/photos/src/components/TripLayout/index.tsx
+++ b/web/apps/photos/src/components/TripLayout/index.tsx
@@ -221,9 +221,12 @@ export const TripLayout: React.FC<TripLayoutProps> = ({
setPhotoClusters(sortedClusters);
// Check if first location is in a super cluster and adjust initial zoom
- const firstLocationInSuperCluster = clusterToSuperClusterMap.has(0);
+ const firstLocationInSuperCluster =
+ clusterToSuperClusterMap.has(0);
const initialZoom = firstLocationInSuperCluster
- ? (isTouchDevice ? 15 : 14) // Super cluster zoom level
+ ? isTouchDevice
+ ? 15
+ : 14 // Super cluster zoom level
: optimalZoomLevel;
setOptimalZoom(initialZoom);
diff --git a/web/apps/photos/src/components/TripLayout/mapHelpers.ts b/web/apps/photos/src/components/TripLayout/mapHelpers.ts
index 0631c765af..6d13363914 100644
--- a/web/apps/photos/src/components/TripLayout/mapHelpers.ts
+++ b/web/apps/photos/src/components/TripLayout/mapHelpers.ts
@@ -541,7 +541,8 @@ export const getMapCenter = (
firstCluster.reduce((sum, p) => sum + p.lng, 0) / firstCluster.length;
// Check if first location is in a super cluster - apply positioning for super cluster zoom level
- const firstLocationInSuperCluster = superClusterInfo?.clusterToSuperClusterMap.has(0);
+ const firstLocationInSuperCluster =
+ superClusterInfo?.clusterToSuperClusterMap.has(0);
if (firstLocationInSuperCluster) {
// For super cluster first location, apply positioning calculated for super cluster zoom level
const isMobile = isMobileDevice();
diff --git a/web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts b/web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts
index 043cfc3ae1..779720c50b 100644
--- a/web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts
+++ b/web/apps/photos/src/components/TripLayout/utils/scrollUtils.ts
@@ -206,7 +206,11 @@ export const handleTimelineScroll = ({
);
setTargetZoom(superClusterZoom);
mapRef.setView([zoomAwareLat, zoomAwareLng], superClusterZoom);
- } else if (isInSuperCluster && !wasInSuperCluster && isDistantLocation) {
+ } else if (
+ isInSuperCluster &&
+ !wasInSuperCluster &&
+ isDistantLocation
+ ) {
// Entering super cluster from distant location - full zoom out β†’ pan β†’ zoom in
const superClusterZoom = isTouchDevice ? 15 : 14; // Higher zoom on mobile to break apart clusters
const intermediateZoom = isTouchDevice ? 2 : 4; // Extreme zoom out for distant locations
@@ -444,8 +448,9 @@ export const scrollTimelineToLocation = ({
const maxScrollableDistance = scrollHeight - clientHeight;
// Check if we're on a touch device
- const isTouchDevice = typeof window !== "undefined" &&
- ('ontouchstart' in window || navigator.maxTouchPoints > 0);
+ const isTouchDevice =
+ typeof window !== "undefined" &&
+ ("ontouchstart" in window || navigator.maxTouchPoints > 0);
// Calculate target progress using the same formula as scroll progress calculation
let targetProgress;
@@ -453,7 +458,8 @@ export const scrollTimelineToLocation = ({
// Mobile: Use inverse of the slower progression formula
// If active index = Math.floor(progress * (length - 0.5))
// Then progress = (index + 0.5) / (length - 0.5) for accurate inverse
- targetProgress = (locationIndex + 0.5) / Math.max(1, photoClusters.length - 0.5);
+ targetProgress =
+ (locationIndex + 0.5) / Math.max(1, photoClusters.length - 0.5);
} else {
// Desktop: Use original formula
targetProgress = locationIndex / Math.max(1, photoClusters.length - 1);
@@ -537,7 +543,9 @@ export const handleMarkerClick = ({
let shouldJustPan = false;
if (superClusterInfo && currentActiveLocationIndex >= 0) {
const currentSuperClusterIndex =
- superClusterInfo.clusterToSuperClusterMap.get(currentActiveLocationIndex);
+ superClusterInfo.clusterToSuperClusterMap.get(
+ currentActiveLocationIndex,
+ );
const targetSuperClusterIndex =
superClusterInfo.clusterToSuperClusterMap.get(clusterIndex);