Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix: lint

anandbaburajanfe821b168ccf
diff --git a/web/apps/photos/src/components/TripTemplate/MobileNavBar.tsx b/web/apps/photos/src/components/TripTemplate/MobileNavBar.tsx
index af59eb3513..2c0e9f6d8a 100644
--- a/web/apps/photos/src/components/TripTemplate/MobileNavBar.tsx
+++ b/web/apps/photos/src/components/TripTemplate/MobileNavBar.tsx
@@ -104,7 +104,8 @@ const MobileNavContainer = styled(Box)({
left: 0,
right: 0,
height: "90px",
- background: "linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%)",
+ background:
+ "linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%)",
zIndex: -1,
pointerEvents: "none",
},
diff --git a/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx b/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx
index ed097da0a7..d155fee87f 100644
--- a/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx
+++ b/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx
@@ -6,23 +6,13 @@ import type { JourneyPoint } from "./types";
interface MobileTimelineLocationProps {
cluster: JourneyPoint[];
index: number;
- photoClusters: JourneyPoint[][];
- scrollProgress: number;
journeyData: JourneyPoint[];
onRef: (el: HTMLDivElement | null) => void;
onPhotoClick?: (cluster: JourneyPoint[], fileId: number) => void;
}
export const MobileTimelineLocation = memo<MobileTimelineLocationProps>(
- ({
- cluster,
- index,
- photoClusters,
- scrollProgress,
- journeyData,
- onRef,
- onPhotoClick,
- }) => {
+ ({ cluster, index, journeyData, onRef, onPhotoClick }) => {
const firstPhoto = cluster[0];
if (!firstPhoto) return null;
@@ -49,10 +39,6 @@ export const MobileTimelineLocation = memo<MobileTimelineLocationProps>(
const diffTime = photoDateOnly.getTime() - firstDateOnly.getTime();
const dayNumber = Math.floor(diffTime / (1000 * 60 * 60 * 24)) + 1;
- // Show green for all covered locations (up to current position)
- const currentLocationIndex = Math.round(scrollProgress * Math.max(0, photoClusters.length - 1));
- const isCovered = index <= currentLocationIndex;
-
return (
<MobileLocationContainer
ref={onRef}
@@ -129,13 +115,13 @@ const PhotoOverlay = styled(Box)({
right: "2px",
zIndex: 30,
pointerEvents: "none",
- background: "linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%)",
+ background:
+ "linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%)",
borderRadius: "0 0 12px 12px",
padding: "16px",
minHeight: "fit-content",
});
-
const DayBadge = styled(Box)({
display: "inline-flex",
alignItems: "center",
@@ -168,4 +154,4 @@ const LocationCountry = styled(Typography)(() => ({
margin: "0",
textShadow: "0 1px 4px rgba(0, 0, 0, 0.5)",
component: "p",
-}));
\ No newline at end of file
+}));
diff --git a/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx b/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx
index f00145d1b5..feee58e5da 100644
--- a/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx
+++ b/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx
@@ -129,9 +129,7 @@ const PhotoFanContainer = styled(Box)(({ theme }) => ({
[theme.breakpoints.up("md")]: {
transition: "transform 0.3s ease-in-out",
cursor: "pointer",
- "&:hover": {
- transform: "scale(1.05)",
- },
+ "&:hover": { transform: "scale(1.05)" },
},
}));
diff --git a/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx b/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx
index d18b5d1d22..9aed539515 100644
--- a/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx
@@ -47,12 +47,6 @@ const BaseLine = styled(Box)(() => ({
zIndex: 0,
}));
-const DashedLine = styled(BaseLine)(({ theme }) => ({
- backgroundImage: `linear-gradient(to bottom, ${theme.palette.grey[300]} 58%, transparent 58%)`,
- backgroundSize: "100% 22px",
- backgroundRepeat: "repeat-y",
-}));
-
const SolidLine = styled(BaseLine)(({ theme }) => ({
backgroundColor: theme.palette.grey[300],
}));
diff --git a/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx b/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx
index 8b25830b48..0ae47291a0 100644
--- a/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx
@@ -51,7 +51,9 @@ export const TimelineLocation = memo<TimelineLocationProps>(
const dayNumber = Math.floor(diffTime / (1000 * 60 * 60 * 24)) + 1;
// Show green for all covered locations (up to current position)
- const currentLocationIndex = Math.round(scrollProgress * Math.max(0, photoClusters.length - 1));
+ const currentLocationIndex = Math.round(
+ scrollProgress * Math.max(0, photoClusters.length - 1),
+ );
const isCovered = index <= currentLocationIndex;
return (
@@ -155,27 +157,25 @@ const DotBackground = styled(Box)(({ theme }) => ({
}));
const TimelineDot = styled(Box, {
- shouldForwardProp: (prop) => prop !== 'isReached',
-})<{ 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",
- }),
-);
+ shouldForwardProp: (prop) => prop !== "isReached",
+})<{ 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" });
diff --git a/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx b/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx
index 08bc2213df..9e5c40a2c2 100644
--- a/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx
@@ -8,9 +8,7 @@ interface TimelineProgressLineProps {
photoClusters: JourneyPoint[][];
}
-export const TimelineProgressLine = memo<TimelineProgressLineProps>(
- () => {
- // No longer showing progressive green line - green indicators only for current location
- return null;
- },
-);
+export const TimelineProgressLine = memo<TimelineProgressLineProps>(() => {
+ // No longer showing progressive green line - green indicators only for current location
+ return null;
+});
diff --git a/web/apps/photos/src/components/TripTemplate/TripMap.tsx b/web/apps/photos/src/components/TripTemplate/TripMap.tsx
index 18ad220eae..0895fe0f85 100644
--- a/web/apps/photos/src/components/TripTemplate/TripMap.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TripMap.tsx
@@ -74,7 +74,11 @@ export const TripMap: React.FC<TripMapProps> = ({
{hasPhotoData ? (
<StyledMapContainer
center={getMapCenter(photoClusters, journeyData)}
- zoom={isTouchDevice ? Math.max(1, optimalZoom - 2) : optimalZoom}
+ zoom={
+ isTouchDevice
+ ? Math.max(1, optimalZoom - 2)
+ : optimalZoom
+ }
scrollWheelZoom={true}
zoomControl={false}
attributionControl={!isTouchDevice}
@@ -86,7 +90,11 @@ export const TripMap: React.FC<TripMapProps> = ({
/>
{/* Stadia Alidade Satellite - includes both imagery and labels */}
<TileLayer
- attribution={isTouchDevice ? '' : '&copy; <a href="https://stadiamaps.com/">Stadia Maps</a>, &copy; <a href="https://openmaptiles.org/">OpenMapTiles</a> &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'}
+ attribution={
+ isTouchDevice
+ ? ""
+ : '&copy; <a href="https://stadiamaps.com/">Stadia Maps</a>, &copy; <a href="https://openmaptiles.org/">OpenMapTiles</a> &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'
+ }
url="https://tiles.stadiamaps.com/tiles/alidade_satellite/{z}/{x}/{y}{r}.jpg"
maxZoom={20}
/>
@@ -102,9 +110,15 @@ export const TripMap: React.FC<TripMapProps> = ({
);
} else {
// Desktop: Use original logic
- currentLocationIndex = Math.round(scrollProgress * Math.max(0, photoClusters.length - 1));
+ currentLocationIndex = Math.round(
+ scrollProgress *
+ Math.max(0, photoClusters.length - 1),
+ );
}
- const isCovered = superCluster.clustersInvolved.some(clusterIndex => clusterIndex <= currentLocationIndex);
+ const isCovered = superCluster.clustersInvolved.some(
+ (clusterIndex) =>
+ clusterIndex <= currentLocationIndex,
+ );
return (
<Marker
@@ -159,9 +173,13 @@ export const TripMap: React.FC<TripMapProps> = ({
);
} else {
// Desktop: Use original logic
- currentLocationIndex = Math.round(scrollProgress * Math.max(0, photoClusters.length - 1));
+ currentLocationIndex = Math.round(
+ scrollProgress *
+ Math.max(0, photoClusters.length - 1),
+ );
}
- const isCovered = originalClusterIndex <= currentLocationIndex;
+ const isCovered =
+ originalClusterIndex <= currentLocationIndex;
return (
<Marker
@@ -205,14 +223,12 @@ export const TripMap: React.FC<TripMapProps> = ({
// Styled components
const MapContainerWrapper = styled(Box, {
- shouldForwardProp: (prop) => prop !== 'hasPhotoData',
-})<{ hasPhotoData: boolean }>(
- ({ hasPhotoData }) => ({
- width: "100%",
- height: "100%",
- backgroundColor: hasPhotoData ? "transparent" : "#000000",
- }),
-);
+ shouldForwardProp: (prop) => prop !== "hasPhotoData",
+})<{ hasPhotoData: boolean }>(({ hasPhotoData }) => ({
+ width: "100%",
+ height: "100%",
+ backgroundColor: hasPhotoData ? "transparent" : "#000000",
+}));
const StyledMapContainer = styled(MapContainer)({
width: "100%",
diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts b/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts
index 34b3c894c8..015ab1ed44 100644
--- a/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts
+++ b/web/apps/photos/src/components/TripTemplate/hooks/useFileViewer.ts
@@ -24,7 +24,7 @@ export const useFileViewer = ({
// Filter files to only include those from the cluster
const clusterFiles = files.filter((file) =>
- clusterFileIds.includes(file.id)
+ clusterFileIds.includes(file.id),
);
// Sort cluster files by creation time
diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts b/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts
index 4df3c3ce69..12eec94412 100644
--- a/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts
+++ b/web/apps/photos/src/components/TripTemplate/hooks/useLocationFetching.ts
@@ -30,17 +30,19 @@ export const useLocationFetching = ({
// Get all current photo IDs
const currentPhotoIds = new Set(
- photoClusters.flat().map((photo) => photo.fileId)
+ photoClusters.flat().map((photo) => photo.fileId),
);
// Check if we have new photos that haven't been processed
const hasNewPhotos = Array.from(currentPhotoIds).some(
- (id) => !processedPhotoIdsRef.current.has(id)
+ (id) => !processedPhotoIdsRef.current.has(id),
);
// Check if any photos need location fetching
const needsFetching = photoClusters.some((cluster) =>
- cluster.some((photo) => !locationDataRef.current?.has(photo.fileId))
+ cluster.some(
+ (photo) => !locationDataRef.current.has(photo.fileId),
+ ),
);
if (!hasNewPhotos && !needsFetching) {
@@ -77,10 +79,5 @@ export const useLocationFetching = ({
};
void fetchNames();
- }, [
- photoClusters,
- locationDataRef,
- setJourneyData,
- setIsLoadingLocations,
- ]);
+ }, [photoClusters, locationDataRef, setJourneyData, setIsLoadingLocations]);
};
diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts b/web/apps/photos/src/components/TripTemplate/hooks/useScrollHandling.ts
index 1411bcc8c1..83888ef084 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 { useIsTouchscreen } from "ente-base/components/utils/hooks";
+import { useCallback, useEffect, useMemo } from "react";
import type { JourneyPoint } from "../types";
import { throttle } from "../utils/geocoding";
diff --git a/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts b/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts
index e34960fd3d..d999859dd9 100644
--- a/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts
+++ b/web/apps/photos/src/components/TripTemplate/hooks/useThumbnailGeneration.ts
@@ -29,15 +29,17 @@ export const useThumbnailGeneration = ({
// Get all current photo IDs
const currentPhotoIds = new Set(
- photoClusters.flat().map((photo) => photo.fileId)
+ photoClusters.flat().map((photo) => photo.fileId),
);
// Check if we have photos that need thumbnails
const photosNeedingThumbnails = photoClusters
.flat()
- .filter((photo) =>
- !photo.image &&
- (!processedPhotoIdsRef.current.has(photo.fileId) || !thumbnailsGeneratedRef.current)
+ .filter(
+ (photo) =>
+ !photo.image &&
+ (!processedPhotoIdsRef.current.has(photo.fileId) ||
+ !thumbnailsGeneratedRef.current),
);
if (photosNeedingThumbnails.length === 0) return;
@@ -60,7 +62,10 @@ export const useThumbnailGeneration = ({
}
// Update processed photos set and mark as generated
- processedPhotoIdsRef.current = new Set([...processedPhotoIdsRef.current, ...currentPhotoIds]);
+ processedPhotoIdsRef.current = new Set([
+ ...processedPhotoIdsRef.current,
+ ...currentPhotoIds,
+ ]);
thumbnailsGeneratedRef.current = true;
};
diff --git a/web/apps/photos/src/components/TripTemplate/index.tsx b/web/apps/photos/src/components/TripTemplate/index.tsx
index e500869f8d..3b09945510 100644
--- a/web/apps/photos/src/components/TripTemplate/index.tsx
+++ b/web/apps/photos/src/components/TripTemplate/index.tsx
@@ -187,7 +187,11 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
setLocationPositions,
setHasUserScrolled: (scrolled: boolean) => {
setHasUserScrolled(scrolled);
- if (isTouchDevice && tripStartedRef.current && timelineRef.current) {
+ if (
+ isTouchDevice &&
+ tripStartedRef.current &&
+ timelineRef.current
+ ) {
const timelineContainer = timelineRef.current;
const tripStartedElement = tripStartedRef.current;
const tripStartedRect =
@@ -319,12 +323,6 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
key={index}
cluster={cluster}
index={index}
- photoClusters={
- photoClusters
- }
- scrollProgress={
- scrollProgress
- }
journeyData={
journeyData
}
diff --git a/web/apps/photos/src/components/TripTemplate/mapHelpers.ts b/web/apps/photos/src/components/TripTemplate/mapHelpers.ts
index 6bd4abcabd..ddc809f39b 100644
--- a/web/apps/photos/src/components/TripTemplate/mapHelpers.ts
+++ b/web/apps/photos/src/components/TripTemplate/mapHelpers.ts
@@ -456,29 +456,34 @@ export const getMapCenter = (
// Timeline takes up 50% of screen width, so visible map area is 50%
// We want the first location to be at 20% from right of the visible map area
// This means shifting map center left so marker appears more to the right
-
+
const timelineWidthRatio = 0.5; // Timeline takes up 50% of screen
-
+
// At zoom 10, approximately 0.35 degrees per 1000px at equator
// For positioning, we need to shift the longitude to place marker at desired position
const degreesPerPixelAtZoom10 = 0.35 / 1000; // rough approximation
- const pixelsToShiftFor20Percent = (window.innerWidth || 1400) * timelineWidthRatio * 3.0; // 300% of visible map width to shift map left
+ const pixelsToShiftFor20Percent =
+ (window.innerWidth || 1400) * timelineWidthRatio * 3.0; // 300% of visible map width to shift map left
const lngShift = pixelsToShiftFor20Percent * degreesPerPixelAtZoom10;
-
+
const adjustedLng = firstLng - lngShift;
return [firstLat, adjustedLng];
};
// Calculate position for a location to be at 20% from right edge of visible map
-export const getLocationPosition = (lat: number, lng: number): [number, number] => {
+export const getLocationPosition = (
+ lat: number,
+ lng: number,
+): [number, number] => {
// Position location at 20% from right edge (80% from left) of visible map area
const timelineWidthRatio = 0.5; // Timeline takes up 50% of screen
const degreesPerPixelAtZoom10 = 0.35 / 1000; // rough approximation at zoom 10
// Calculate shift to position marker at 20% from right edge of visible map
// Need to shift map center left so the marker appears more to the right
- const pixelsToShiftFor20Percent = (window.innerWidth || 1400) * timelineWidthRatio * 3.0; // 300% of visible map width to shift map left
+ const pixelsToShiftFor20Percent =
+ (window.innerWidth || 1400) * timelineWidthRatio * 3.0; // 300% of visible map width to shift map left
const lngShift = pixelsToShiftFor20Percent * degreesPerPixelAtZoom10;
-
+
return [lat, lng - lngShift];
};
diff --git a/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts b/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts
index c90d14254e..400803af8a 100644
--- a/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts
+++ b/web/apps/photos/src/components/TripTemplate/utils/scrollUtils.ts
@@ -111,8 +111,7 @@ export const handleTimelineScroll = ({
// Only pan map when active location changes (discrete panning)
if (
- mapRef &&
- mapRef.getContainer() &&
+ mapRef?.getContainer() &&
currentActiveLocationIndex !== previousActiveLocationIndex
) {
previousActiveLocationRef.current = currentActiveLocationIndex;
@@ -168,12 +167,16 @@ export const handleTimelineScroll = ({
});
setTimeout(() => {
- if (mapRef && mapRef.getContainer()) {
- mapRef.flyTo([positionedLat, positionedLng], targetZoom, {
- animate: true,
- duration: 1.2,
- easeLinearity: 0.25,
- });
+ if (mapRef?.getContainer()) {
+ mapRef.flyTo(
+ [positionedLat, positionedLng],
+ targetZoom,
+ {
+ animate: true,
+ duration: 1.2,
+ easeLinearity: 0.25,
+ },
+ );
}
}, 1600);
} else {
@@ -278,7 +281,7 @@ export const handleMarkerClick = ({
clusterLng,
);
- if (mapRef && mapRef.getContainer()) {
+ if (mapRef?.getContainer()) {
try {
const targetZoom = isTouchDevice ? 8 : 10; // Touch device-aware zoom level
mapRef.flyTo([positionedLat, positionedLng], targetZoom, {