Skip to content

armgit / ente

Public Imported from GitHub
0

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

chore: mobile trip timeline changes

anandbaburajaneb1baa236adc
diff --git a/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx b/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx
index 1244b7059d..9796c56285 100644
--- a/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx
+++ b/web/apps/photos/src/components/TripTemplate/MobileTimelineLocation.tsx
@@ -87,12 +87,6 @@ export const MobileTimelineLocation = memo<MobileTimelineLocationProps>(
</PhotoOverlay>
</PhotoFanWrapper>
</CenteredPhotoContainer>
-
- {/* Dots positioned after the photo fan */}
- <DotsContainer>
- <DotBackground />
- <TimelineDot isReached={isCovered} />
- </DotsContainer>
</MobileLocationContainer>
);
},
@@ -106,16 +100,15 @@ const MobileLocationContainer = styled(Box)({
alignItems: "center",
justifyContent: "center",
width: "100%",
- minHeight: "100vh",
+ height: "40vh",
scrollSnapAlign: "start",
- padding: "40px 20px",
+ padding: "20px",
});
const CenteredPhotoContainer = styled(Box)({
position: "relative",
display: "flex",
justifyContent: "center",
- marginBottom: "16px",
});
const PhotoFanWrapper = styled(Box)({
@@ -136,45 +129,6 @@ const PhotoOverlay = styled(Box)({
padding: "24px 16px 16px 16px",
});
-const DotsContainer = styled(Box)({
- position: "relative",
- width: "32px",
- height: "32px",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- marginTop: "32px",
-});
-
-const DotBackground = styled(Box)(({ theme }) => ({
- position: "absolute",
- width: "32px",
- height: "32px",
- borderRadius: "50%",
- zIndex: 10,
- backgroundColor: theme.palette.background.paper,
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.1)",
-}));
-
-const TimelineDot = styled(Box, {
- shouldForwardProp: (prop) => prop !== 'isReached',
-})<{ isReached: boolean }>(
- ({ theme, isReached }) => ({
- position: "absolute",
- borderRadius: "50%",
- border: `3px solid ${theme.palette.background.paper}`,
- zIndex: 20,
- width: "16px",
- height: "16px",
- transition: "all 0.3s",
- backgroundColor: isReached
- ? theme.palette.success.main
- : theme.palette.text.primary,
- boxShadow: isReached
- ? `0 0 0 4px ${theme.palette.success.main}30, 0 0 0 8px ${theme.palette.success.main}15`
- : "0 2px 8px rgba(0, 0, 0, 0.2)",
- }),
-);
const DayBadge = styled(Box)(({ theme }) => ({
display: "inline-flex",
diff --git a/web/apps/photos/src/components/TripTemplate/MobileTripStarted.tsx b/web/apps/photos/src/components/TripTemplate/MobileTripStarted.tsx
index 44b26e6ee6..bd8504ff1b 100644
--- a/web/apps/photos/src/components/TripTemplate/MobileTripStarted.tsx
+++ b/web/apps/photos/src/components/TripTemplate/MobileTripStarted.tsx
@@ -1,30 +1,60 @@
import { Box, styled, Typography } from "@mui/material";
import { memo } from "react";
+import type { JourneyPoint } from "./types";
interface MobileTripStartedProps {
onRef: (el: HTMLDivElement | null) => void;
+ journeyData: JourneyPoint[];
}
-export const MobileTripStarted = memo<MobileTripStartedProps>(({ onRef }) => {
- return (
- <MobileTripStartedContainer ref={onRef}>
- <MobileTripStartedContent>
- <MobileTripStartedText>Trip Started</MobileTripStartedText>
- </MobileTripStartedContent>
- <MobileTripStartedLine />
- </MobileTripStartedContainer>
- );
-});
+export const MobileTripStarted = memo<MobileTripStartedProps>(
+ ({ onRef, journeyData }) => {
+ // Get the first photo's date
+ const sortedData = [...journeyData].sort(
+ (a, b) =>
+ new Date(a.timestamp).getTime() -
+ new Date(b.timestamp).getTime(),
+ );
+ const firstPhoto = sortedData[0];
+ const firstPhotoDate = firstPhoto
+ ? new Date(firstPhoto.timestamp).toLocaleDateString("en-US", {
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ })
+ : "";
+
+ return (
+ <MobileTripStartedContainer ref={onRef}>
+ <MobileTripStartedContent>
+ <MobileTripStartedText>
+ <TripStartedTitle>Trip started</TripStartedTitle>
+ {firstPhotoDate && (
+ <>
+ <br />
+ <TripStartedDate>
+ {firstPhotoDate}
+ </TripStartedDate>
+ </>
+ )}
+ </MobileTripStartedText>
+ </MobileTripStartedContent>
+ <MobileTripStartedLine />
+ </MobileTripStartedContainer>
+ );
+ },
+);
const MobileTripStartedContainer = styled(Box)({
position: "relative",
- minHeight: "100vh",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
+ height: "40vh",
scrollSnapAlign: "start",
- padding: "40px 20px",
+ padding: "60px 20px 40px 20px",
+ overflow: "visible",
});
const MobileTripStartedContent = styled(Box)({
@@ -35,24 +65,31 @@ const MobileTripStartedContent = styled(Box)({
});
const MobileTripStartedText = styled(Typography)(({ theme }) => ({
- fontSize: "24px",
- fontWeight: "600",
- color: theme.palette.success.main,
- backgroundColor: theme.palette.background.paper,
- padding: "16px 32px",
- borderRadius: "30px",
- border: `3px solid ${theme.palette.success.main}`,
- boxShadow: "0 4px 20px rgba(0, 0, 0, 0.1)",
+ fontSize: "16px",
+ fontWeight: "500",
+ color: theme.palette.text.secondary,
textAlign: "center",
}));
const MobileTripStartedLine = styled(Box)(({ theme }) => ({
position: "absolute",
left: "50%",
- top: "70%",
- bottom: "0",
- width: "4px",
- backgroundColor: theme.palette.success.main,
- transform: "translateX(-50%)",
- borderRadius: "2px",
-}));
\ No newline at end of file
+ bottom: "-100px",
+ height: "200px",
+ width: "3px",
+ backgroundColor: theme.palette.grey[300],
+ transform: "translateX(-1.5px)",
+ zIndex: 1,
+}));
+
+const TripStartedTitle = styled("span")(({ theme }) => ({
+ fontSize: "14px",
+ fontWeight: 500,
+ color: theme.palette.text.primary,
+}));
+
+const TripStartedDate = styled("span")(({ theme }) => ({
+ fontSize: "12px",
+ fontWeight: "normal",
+ color: theme.palette.text.secondary,
+}));
diff --git a/web/apps/photos/src/components/TripTemplate/index.tsx b/web/apps/photos/src/components/TripTemplate/index.tsx
index 7dd3744587..014486e219 100644
--- a/web/apps/photos/src/components/TripTemplate/index.tsx
+++ b/web/apps/photos/src/components/TripTemplate/index.tsx
@@ -265,7 +265,7 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
{/* Timeline takes 40% of height */}
<MobileTimelineContainer ref={timelineRef}>
- <TimelineContent>
+ <MobileTimelineContent>
{isInitialLoad ? (
<LoadingCoverPlaceholder>
<LoadingCoverImage>
@@ -303,9 +303,14 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
onRef={(el) => {
tripStartedRef.current = el;
}}
+ journeyData={journeyData}
/>
<TimelineContainer id="timeline-container">
+ <MobileTimelineBaseLine
+ photoClusters={photoClusters}
+ />
+
{photoClusters.map((cluster, index) => (
<MobileTimelineLocation
key={index}
@@ -329,7 +334,7 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
No photos found with location information.
</NoPhotosContainer>
)}
- </TimelineContent>
+ </MobileTimelineContent>
</MobileTimelineContainer>
</MobileContainer>
) : (
@@ -632,3 +637,21 @@ const MobileCoverOverlay = styled(Box)<{ show: boolean }>(({ show }) => ({
transition: "opacity 0.5s ease-in-out",
pointerEvents: show ? "auto" : "none",
}));
+
+const MobileTimelineContent = styled(Box)({
+ padding: "16px 20px",
+ height: "100%",
+ display: "flex",
+ flexDirection: "column",
+});
+
+const MobileTimelineBaseLine = styled(Box)<{ photoClusters: JourneyPoint[][] }>(({ theme, photoClusters }) => ({
+ position: "absolute",
+ left: "50%",
+ top: "-15vh",
+ height: `${(photoClusters.length - 1) * 40 + 35}vh`,
+ width: "3px",
+ backgroundColor: theme.palette.grey[300],
+ transform: "translateX(-1.5px)",
+ zIndex: 0,
+}));