Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor: inline stlyes to styled components

anandbaburajan2a0c353c85ee
diff --git a/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx b/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx
index ffbc932c0d..8658565b32 100644
--- a/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx
+++ b/web/apps/photos/src/components/TripTemplate/PhotoFan.tsx
@@ -1,3 +1,4 @@
+import { Box, styled } from "@mui/material";
import { memo } from "react";
import Image from "next/image";
import type { JourneyPoint } from "./types";
@@ -16,45 +17,15 @@ export const PhotoFan = memo<PhotoFanProps>(({
}
return (
- <div
- className="photo-fan-hover"
- style={{
- position: "relative",
- width: "180px",
- height: "240px",
- }}
- >
+ <PhotoFanContainer>
{cluster.length === 2 && cluster[1] && (
- <div
+ <PhotoFrameTwo
onClick={() =>
cluster[1] &&
onPhotoClick?.(cluster, cluster[1].fileId)
}
- style={{
- position: "absolute",
- border: "2px solid white",
- boxShadow:
- "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
- zIndex: 10,
- width: "180px",
- height: "207px",
- borderRadius: "14px",
- overflow: "hidden",
- transform: "translateX(33px) skewY(8deg)",
- top: "50%",
- left: "0",
- marginTop: "-103.5px",
- cursor: "pointer",
- }}
>
- <div
- style={{
- position: "relative",
- width: "100%",
- height: "100%",
- transform: "skewY(-8deg) scale(1.1)",
- }}
- >
+ <ImageWrapper sx={{ transform: 'skewY(-8deg) scale(1.1)' }}>
<Image
src={cluster[1].image}
alt={cluster[1].name}
@@ -62,41 +33,19 @@ export const PhotoFan = memo<PhotoFanProps>(({
style={{ objectFit: "cover" }}
sizes="200px"
/>
- </div>
- </div>
+ </ImageWrapper>
+ </PhotoFrameTwo>
)}
{cluster.length >= 3 && (
<>
{cluster[1] && (
- <div
+ <PhotoFrameLeft
onClick={() =>
cluster[1] &&
onPhotoClick?.(cluster, cluster[1].fileId)
}
- style={{
- position: "absolute",
- border: "2px solid white",
- boxShadow:
- "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
- zIndex: 10,
- width: "180px",
- height: "207px",
- borderRadius: "14px",
- overflow: "hidden",
- transform: "translateX(-33px) skewY(-8deg)",
- top: "16.5px",
- left: "0",
- cursor: "pointer",
- }}
>
- <div
- style={{
- position: "relative",
- width: "100%",
- height: "100%",
- transform: "skewY(8deg) scale(1.1)",
- }}
- >
+ <ImageWrapper sx={{ transform: 'skewY(8deg) scale(1.1)' }}>
<Image
src={cluster[1].image}
alt={cluster[1].name}
@@ -104,39 +53,17 @@ export const PhotoFan = memo<PhotoFanProps>(({
style={{ objectFit: "cover" }}
sizes="200px"
/>
- </div>
- </div>
+ </ImageWrapper>
+ </PhotoFrameLeft>
)}
{cluster[2] && (
- <div
+ <PhotoFrameRight
onClick={() =>
cluster[2] &&
onPhotoClick?.(cluster, cluster[2].fileId)
}
- style={{
- position: "absolute",
- border: "2px solid white",
- boxShadow:
- "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
- zIndex: 10,
- width: "180px",
- height: "207px",
- borderRadius: "14px",
- overflow: "hidden",
- transform: "translateX(33px) skewY(8deg)",
- top: "16.5px",
- left: "0",
- cursor: "pointer",
- }}
>
- <div
- style={{
- position: "relative",
- width: "100%",
- height: "100%",
- transform: "skewY(-8deg) scale(1.1)",
- }}
- >
+ <ImageWrapper sx={{ transform: 'skewY(-8deg) scale(1.1)' }}>
<Image
src={cluster[2].image}
alt={cluster[2].name}
@@ -144,30 +71,18 @@ export const PhotoFan = memo<PhotoFanProps>(({
style={{ objectFit: "cover" }}
sizes="200px"
/>
- </div>
- </div>
+ </ImageWrapper>
+ </PhotoFrameRight>
)}
</>
)}
{cluster[0] && (
- <div
+ <MainPhotoFrame
onClick={() =>
cluster[0] &&
onPhotoClick?.(cluster, cluster[0].fileId)
}
- style={{
- position: "relative",
- width: "100%",
- height: "100%",
- border: "2px solid white",
- boxShadow:
- "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
- zIndex: 20,
- borderRadius: "14px",
- overflow: "hidden",
- cursor: "pointer",
- }}
>
<Image
src={cluster[0].image}
@@ -178,29 +93,90 @@ export const PhotoFan = memo<PhotoFanProps>(({
/>
{cluster.length > 3 && (
- <div
- style={{
- position: "absolute",
- bottom: "6px",
- right: "6px",
- background: "white",
- color: "black",
- borderRadius: "6px",
- padding: "4px 6px",
- minHeight: "20px",
- display: "inline-flex",
- alignItems: "center",
- justifyContent: "center",
- fontSize: "11px",
- fontWeight: "600",
- boxShadow: "0 1px 3px rgba(0,0,0,0.3)",
- }}
- >
+ <CountBadge>
+{cluster.length - 3}
- </div>
+ </CountBadge>
)}
- </div>
+ </MainPhotoFrame>
)}
- </div>
+ </PhotoFanContainer>
);
+});
+
+// Styled components
+const PhotoFanContainer = styled(Box)({
+ position: "relative",
+ width: "180px",
+ height: "240px",
+ transition: "transform 0.3s ease-in-out",
+ cursor: "pointer",
+ "&:hover": {
+ transform: "scale(1.05)",
+ },
+});
+
+const PhotoFrame = styled(Box)(({ theme }) => ({
+ position: "absolute",
+ border: "2px solid white",
+ boxShadow: theme.shadows[10],
+ zIndex: 10,
+ width: "180px",
+ height: "207px",
+ borderRadius: "14px",
+ overflow: "hidden",
+ cursor: "pointer",
+}));
+
+const PhotoFrameTwo = styled(PhotoFrame)({
+ transform: "translateX(33px) skewY(8deg)",
+ top: "50%",
+ left: "0",
+ marginTop: "-103.5px",
+});
+
+const PhotoFrameLeft = styled(PhotoFrame)({
+ transform: "translateX(-33px) skewY(-8deg)",
+ top: "16.5px",
+ left: "0",
+});
+
+const PhotoFrameRight = styled(PhotoFrame)({
+ transform: "translateX(33px) skewY(8deg)",
+ top: "16.5px",
+ left: "0",
+});
+
+const MainPhotoFrame = styled(Box)(({ theme }) => ({
+ position: "relative",
+ width: "100%",
+ height: "100%",
+ border: "2px solid white",
+ boxShadow: theme.shadows[10],
+ zIndex: 20,
+ borderRadius: "14px",
+ overflow: "hidden",
+ cursor: "pointer",
+}));
+
+const ImageWrapper = styled(Box)({
+ position: "relative",
+ width: "100%",
+ height: "100%",
+});
+
+const CountBadge = styled(Box)({
+ position: "absolute",
+ bottom: "6px",
+ right: "6px",
+ background: "white",
+ color: "black",
+ borderRadius: "6px",
+ padding: "4px 6px",
+ minHeight: "20px",
+ display: "inline-flex",
+ alignItems: "center",
+ justifyContent: "center",
+ fontSize: "11px",
+ fontWeight: "600",
+ boxShadow: "0 1px 3px rgba(0,0,0,0.3)",
});
\ 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.tsx
index e13b584573..a0bdcbc6d1 100644
--- a/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TimelineBaseLine.tsx
@@ -1,3 +1,4 @@
+import { Box, styled } from "@mui/material";
import { memo } from "react";
interface TimelineBaseLineProps {
@@ -29,34 +30,37 @@ export const TimelineBaseLine = memo<TimelineBaseLineProps>(({
return (
<>
- {/* Long dashed line from trip started dot to first location */}
- <div
- style={{
- position: "absolute",
- left: "50%",
- transform: "translateX(-1.5px)",
- width: "3px",
- backgroundImage:
- "linear-gradient(to bottom, #d1d5db 58%, transparent 58%)",
- backgroundSize: "100% 22px",
- backgroundRepeat: "repeat-y",
+ <DashedLine
+ sx={{
top: "-60px",
height: `${firstLocationCenter + 60}px`,
- zIndex: 0,
}}
/>
- {/* Solid line from first location to end */}
- <div
- style={{
- position: "absolute",
- left: "50%",
- transform: "translateX(-1.5px)",
- width: "3px",
- backgroundColor: "#d1d5db",
+ <SolidLine
+ sx={{
top: `${firstLocationCenter}px`,
height: `${heightToLastDot - firstLocationCenter}px`,
}}
/>
</>
);
-});
\ No newline at end of file
+});
+
+// Styled components
+const BaseLine = styled(Box)(({ theme }) => ({
+ position: "absolute",
+ left: "50%",
+ transform: "translateX(-1.5px)",
+ width: "3px",
+ 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],
+}));
\ 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.tsx
index 7a3568e258..ac8ed23f68 100644
--- a/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TimelineLocation.tsx
@@ -1,3 +1,4 @@
+import { Box, Typography, styled } from "@mui/material";
import { memo } from "react";
import type { JourneyPoint } from "./types";
import { PhotoFan } from "./PhotoFan";
@@ -52,115 +53,39 @@ export const TimelineLocation = memo<TimelineLocationProps>(({
scrollProgress >= index / Math.max(1, photoClusters.length - 1);
return (
- <div
+ <LocationContainer
ref={onRef}
id={`location-${index}`}
className="timeline-location"
- style={{
- position: "relative",
- display: "flex",
- alignItems: "center",
+ sx={{
marginBottom:
index === photoClusters.length - 1 ? "24px" : "192px",
}}
>
- <div
- style={{
- position: "absolute",
- left: "50%",
- top: "50%",
- transform: "translate(-50%, -50%)",
- width: "24px",
- height: "40px",
- borderRadius: "50%",
- zIndex: 10,
- backgroundColor: "white",
- }}
- ></div>
- <div
- className="timeline-dot"
- style={{
- position: "absolute",
- left: "50%",
- top: "50%",
- transform: "translate(-50%, -50%)",
- borderRadius: "50%",
- border: "2px solid white",
- zIndex: 20,
- width: "12px",
- height: "12px",
- transition: "all 0.3s",
- backgroundColor: isReached ? "#10b981" : "#111827",
- boxShadow: isReached
- ? "0 0 0 3px rgba(34, 197, 94, 0.3), 0 0 0 6px rgba(34, 197, 94, 0.15)"
- : "none",
- }}
- ></div>
+ <DotBackground />
+ <TimelineDot isReached={isReached} />
{isLeft ? (
<>
- <div
- style={{
- width: "50%",
- paddingRight: "32px",
- paddingTop: "58px",
- textAlign: "right",
- }}
- >
- <div
- style={{
- display: "inline-flex",
- alignItems: "center",
- border: "1px solid #e5e7eb",
- borderRadius: "8px",
- padding: "4px 12px",
- marginBottom: "10px",
- }}
- >
- <span
- style={{
- fontSize: "11px",
- fontWeight: "600",
- color: "#4b5563",
- textTransform: "uppercase",
- letterSpacing: "0.15em",
- }}
- >
- DAY {dayNumber} β€’{" "}
- {new Date(firstPhoto.timestamp)
- .toLocaleDateString("en-US", {
- month: "long",
- day: "numeric",
- })
- .toUpperCase()}
- </span>
- </div>
- <h3
- style={{
- fontSize: "20px",
- fontWeight: "600",
- color: "#111827",
- textAlign: "right",
- margin: "0",
- lineHeight: "1.2",
- }}
- >
+ <LeftContent>
+ <DayBadge>
+ DAY {dayNumber} β€’{" "}
+ {new Date(firstPhoto.timestamp)
+ .toLocaleDateString("en-US", {
+ month: "long",
+ day: "numeric",
+ })
+ .toUpperCase()}
+ </DayBadge>
+ <LocationTitle sx={{ textAlign: "right" }}>
{firstPhoto.name}
- </h3>
- <p
- style={{
- fontSize: "14px",
- color: "#6b7280",
- textAlign: "right",
- margin: "4px 0 0 0",
- }}
- >
+ </LocationTitle>
+ <LocationCountry sx={{ textAlign: "right" }}>
{firstPhoto.country}
- </p>
- </div>
- <div
- style={{
- width: "50%",
+ </LocationCountry>
+ </LeftContent>
+ <RightPhotoContainer
+ sx={{
paddingLeft:
cluster.length >= 3 ? "72px" : "40px",
}}
@@ -169,15 +94,12 @@ export const TimelineLocation = memo<TimelineLocationProps>(({
cluster={cluster}
onPhotoClick={onPhotoClick}
/>
- </div>
+ </RightPhotoContainer>
</>
) : (
<>
- <div
- style={{
- width: "50%",
- display: "flex",
- justifyContent: "flex-end",
+ <LeftPhotoContainer
+ sx={{
paddingRight:
cluster.length >= 3 ? "72px" : "40px",
}}
@@ -186,68 +108,118 @@ export const TimelineLocation = memo<TimelineLocationProps>(({
cluster={cluster}
onPhotoClick={onPhotoClick}
/>
- </div>
- <div
- style={{
- width: "50%",
- paddingLeft: "32px",
- paddingTop: "58px",
- textAlign: "left",
- }}
- >
- <div
- style={{
- display: "inline-flex",
- alignItems: "center",
- border: "1px solid #e5e7eb",
- borderRadius: "8px",
- padding: "4px 12px",
- marginBottom: "10px",
- }}
- >
- <span
- style={{
- fontSize: "11px",
- fontWeight: "600",
- color: "#4b5563",
- textTransform: "uppercase",
- letterSpacing: "0.15em",
- }}
- >
- DAY {dayNumber} β€’{" "}
- {new Date(firstPhoto.timestamp)
- .toLocaleDateString("en-US", {
- month: "long",
- day: "numeric",
- })
- .toUpperCase()}
- </span>
- </div>
- <h3
- style={{
- fontSize: "20px",
- fontWeight: "600",
- color: "#111827",
- textAlign: "left",
- margin: "0",
- lineHeight: "1.2",
- }}
- >
+ </LeftPhotoContainer>
+ <RightContent>
+ <DayBadge>
+ DAY {dayNumber} β€’{" "}
+ {new Date(firstPhoto.timestamp)
+ .toLocaleDateString("en-US", {
+ month: "long",
+ day: "numeric",
+ })
+ .toUpperCase()}
+ </DayBadge>
+ <LocationTitle sx={{ textAlign: "left" }}>
{firstPhoto.name}
- </h3>
- <p
- style={{
- fontSize: "14px",
- color: "#6b7280",
- textAlign: "left",
- margin: "4px 0 0 0",
- }}
- >
+ </LocationTitle>
+ <LocationCountry sx={{ textAlign: "left" }}>
{firstPhoto.country}
- </p>
- </div>
+ </LocationCountry>
+ </RightContent>
</>
)}
- </div>
+ </LocationContainer>
);
-});
\ No newline at end of file
+});
+
+// Styled components
+const LocationContainer = styled(Box)({
+ position: "relative",
+ display: "flex",
+ alignItems: "center",
+});
+
+const DotBackground = styled(Box)(({ theme }) => ({
+ position: "absolute",
+ left: "50%",
+ top: "50%",
+ transform: "translate(-50%, -50%)",
+ width: "24px",
+ height: "40px",
+ borderRadius: "50%",
+ zIndex: 10,
+ 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 LeftContent = styled(ContentContainer)({
+ paddingRight: "32px",
+ textAlign: "right",
+});
+
+const RightContent = styled(ContentContainer)({
+ paddingLeft: "32px",
+ textAlign: "left",
+});
+
+const PhotoContainer = styled(Box)({
+ width: "50%",
+});
+
+const LeftPhotoContainer = styled(PhotoContainer)({
+ display: "flex",
+ justifyContent: "flex-end",
+});
+
+const RightPhotoContainer = styled(PhotoContainer)({});
+
+const DayBadge = styled(Box)(({ theme }) => ({
+ display: "inline-flex",
+ alignItems: "center",
+ border: `1px solid ${theme.palette.grey[300]}`,
+ borderRadius: "8px",
+ padding: "4px 12px",
+ marginBottom: "10px",
+ fontSize: "11px",
+ fontWeight: "600",
+ color: theme.palette.text.secondary,
+ textTransform: "uppercase",
+ letterSpacing: "0.15em",
+}));
+
+const LocationTitle = styled(Typography)(({ theme }) => ({
+ fontSize: "20px",
+ fontWeight: "600",
+ color: theme.palette.text.primary,
+ margin: "0",
+ lineHeight: "1.2",
+ component: "h3",
+}));
+
+const LocationCountry = styled(Typography)(({ theme }) => ({
+ fontSize: "14px",
+ 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.tsx
index 331a3e0e19..4bc205d245 100644
--- a/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TimelineProgressLine.tsx
@@ -1,3 +1,4 @@
+import { Box, styled } from "@mui/material";
import { memo } from "react";
import type { JourneyPoint } from "./types";
@@ -31,13 +32,8 @@ export const TimelineProgressLine = memo<TimelineProgressLineProps>(({
}
return (
- <div
- style={{
- position: "absolute",
- left: "50%",
- transform: "translateX(-1.5px)",
- width: "3px",
- backgroundColor: "#10b981",
+ <ProgressLine
+ sx={{
top: `${firstLocationCenter}px`,
height: `${
(lastLocationCenter - firstLocationCenter) *
@@ -46,4 +42,13 @@ export const TimelineProgressLine = memo<TimelineProgressLineProps>(({
}}
/>
);
-});
\ No newline at end of file
+});
+
+// Styled components
+const ProgressLine = styled(Box)(({ theme }) => ({
+ position: "absolute",
+ left: "50%",
+ 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/TopNavButtons.tsx b/web/apps/photos/src/components/TripTemplate/TopNavButtons.tsx
index e1a52c8cd9..db3bd0cd42 100644
--- a/web/apps/photos/src/components/TripTemplate/TopNavButtons.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TopNavButtons.tsx
@@ -1,6 +1,7 @@
import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternateOutlined";
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import ShareIcon from "@mui/icons-material/Share";
+import { Box, IconButton, Button, styled } from "@mui/material";
import { useIsTouchscreen } from "ente-base/components/utils/hooks";
import { t } from "i18next";
import { useState } from "react";
@@ -33,120 +34,101 @@ export const TopNavButtons: React.FC<TopNavButtonsProps> = ({
}
};
- const buttonStyle = {
- padding: "12px",
- backgroundColor: "rgba(255, 255, 255, 0.9)",
- border: "none",
- borderRadius: "8px",
- cursor: "pointer",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- color: "#1f2937",
- transition: "background-color 0.2s",
- backdropFilter: "blur(10px)",
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.1)",
- width: "44px",
- height: "44px",
- } as const;
-
- const signUpButtonStyle = {
- ...buttonStyle,
- padding: "12px 16px",
- marginLeft: "12px",
- fontSize: "16px",
- fontWeight: "600",
- whiteSpace: "nowrap",
- width: "auto",
- } as const;
-
- const handleButtonHover = (e: React.MouseEvent<HTMLButtonElement>) => {
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
- };
-
- const handleButtonLeave = (e: React.MouseEvent<HTMLButtonElement>) => {
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.9)";
- };
-
return (
<>
- {/* Top right buttons - Fixed to viewport */}
- <div
- style={{
- position: "fixed",
- top: "58px",
- right: "58px",
- display: "flex",
- gap: "8px",
- zIndex: 2000,
- }}
- >
- <button
- onClick={handleShare}
- style={buttonStyle}
- onMouseEnter={handleButtonHover}
- onMouseLeave={handleButtonLeave}
- >
- <ShareIcon style={{ fontSize: "20px" }} />
- </button>
+ <ButtonContainer>
+ <NavButton onClick={handleShare}>
+ <ShareIcon sx={{ fontSize: "20px" }} />
+ </NavButton>
{onAddPhotos && (
- <button
- onClick={onAddPhotos}
- style={buttonStyle}
- onMouseEnter={handleButtonHover}
- onMouseLeave={handleButtonLeave}
- >
+ <NavButton onClick={onAddPhotos}>
<AddPhotoAlternateOutlinedIcon
- style={{ fontSize: "22px" }}
+ sx={{ fontSize: "22px" }}
/>
- </button>
+ </NavButton>
)}
{!enableDownload && (
- <button
- onClick={downloadAllFiles}
- style={buttonStyle}
- onMouseEnter={handleButtonHover}
- onMouseLeave={handleButtonLeave}
- >
+ <NavButton onClick={downloadAllFiles}>
<FileDownloadOutlinedIcon
- style={{ fontSize: "23px" }}
+ sx={{ fontSize: "23px" }}
/>
- </button>
+ </NavButton>
)}
- <button
- onClick={handleSignUp}
- style={signUpButtonStyle}
- onMouseEnter={handleButtonHover}
- onMouseLeave={handleButtonLeave}
- >
+ <SignUpButton onClick={handleSignUp}>
{isTouchscreen ? t("install") : t("sign_up")}
- </button>
- </div>
+ </SignUpButton>
+ </ButtonContainer>
- {/* Copied message */}
{showCopiedMessage && (
- <div
- style={{
- position: "fixed",
- top: "118px",
- right: "180px",
- backgroundColor: "#22c55e",
- color: "white",
- padding: "8px 16px",
- borderRadius: "8px",
- fontSize: "14px",
- fontWeight: "500",
- zIndex: 2001,
- boxShadow: "0 4px 12px rgba(0, 0, 0, 0.2)",
- animation: "fadeInOut 2s ease-in-out forwards",
- }}
- >
+ <CopiedMessage>
Copied!
- </div>
+ </CopiedMessage>
)}
</>
);
-};
\ No newline at end of file
+};
+
+// Styled components
+const ButtonContainer = styled(Box)({
+ position: "fixed",
+ top: "58px",
+ right: "58px",
+ display: "flex",
+ gap: "8px",
+ zIndex: 2000,
+});
+
+const NavButton = styled(IconButton)({
+ padding: "12px",
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
+ borderRadius: "8px",
+ color: "#1f2937",
+ transition: "background-color 0.2s",
+ backdropFilter: "blur(10px)",
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.1)",
+ width: "44px",
+ height: "44px",
+ "&:hover": {
+ backgroundColor: "rgba(255, 255, 255, 1)",
+ },
+});
+
+const SignUpButton = styled(Button)({
+ padding: "12px 16px",
+ marginLeft: "12px",
+ fontSize: "16px",
+ fontWeight: "600",
+ whiteSpace: "nowrap",
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
+ borderRadius: "8px",
+ color: "#1f2937",
+ transition: "background-color 0.2s",
+ backdropFilter: "blur(10px)",
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.1)",
+ "&:hover": {
+ backgroundColor: "rgba(255, 255, 255, 1)",
+ },
+});
+
+const CopiedMessage = styled(Box)(({ theme }) => ({
+ position: "fixed",
+ top: "118px",
+ right: "180px",
+ backgroundColor: theme.palette.success.main,
+ color: "white",
+ padding: "8px 16px",
+ borderRadius: "8px",
+ fontSize: "14px",
+ fontWeight: "500",
+ zIndex: 2001,
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.2)",
+ animation: "fadeInOut 2s ease-in-out forwards",
+ "@keyframes fadeInOut": {
+ "0%": { opacity: 0, transform: "translateY(-10px)" },
+ "15%, 85%": { opacity: 1, transform: "translateY(0)" },
+ "100%": { opacity: 0, transform: "translateY(-10px)" },
+ },
+}));
\ No newline at end of file
diff --git a/web/apps/photos/src/components/TripTemplate/TripCover.tsx b/web/apps/photos/src/components/TripTemplate/TripCover.tsx
index 7c8c56023d..d92b15f08c 100644
--- a/web/apps/photos/src/components/TripTemplate/TripCover.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TripCover.tsx
@@ -1,3 +1,4 @@
+import { Box, Typography, styled } from "@mui/material";
import { memo } from "react";
import Image from "next/image";
import { EnteLogo } from "ente-base/components/EnteLogo";
@@ -36,16 +37,8 @@ export const TripCover = memo<TripCoverProps>(({
});
return (
- <div style={{ marginBottom: "48px" }}>
- <div
- style={{
- aspectRatio: "16/8",
- position: "relative",
- marginBottom: "12px",
- borderRadius: "24px",
- overflow: "hidden",
- }}
- >
+ <CoverContainer>
+ <CoverImageContainer>
<Image
src={coverImageUrl || journeyData[0]?.image || ""}
alt="Trip Cover"
@@ -53,59 +46,72 @@ export const TripCover = memo<TripCoverProps>(({
style={{ objectFit: "cover" }}
sizes="(max-width: 768px) 90vw, (max-width: 1200px) 45vw, 600px"
/>
- <div
- style={{
- position: "absolute",
- inset: 0,
- background:
- "linear-gradient(to bottom, rgba(0,0,0,0.4), transparent 30%, transparent 70%, rgba(0,0,0,0.7))",
- }}
- ></div>
+ <GradientOverlay />
- {/* Ente logo */}
- <div
- style={{
- position: "absolute",
- top: "20px",
- left: "20px",
- color: "#22c55e",
- }}
- >
+ <LogoContainer>
<EnteLogo height={24} />
- </div>
+ </LogoContainer>
- <div
- style={{
- position: "absolute",
- bottom: 0,
- left: 0,
- right: 0,
- padding: "24px",
- color: "white",
- }}
- >
- <h1
- style={{
- fontSize: "30px",
- fontWeight: "bold",
- marginBottom: "2px",
- }}
- >
+ <ContentContainer>
+ <TripTitle>
{albumTitle || "Trip"}
- </h1>
- <p
- style={{
- color: "rgba(255, 255, 255, 0.8)",
- fontSize: "16px",
- fontWeight: "600",
- margin: "0",
- }}
- >
+ </TripTitle>
+ <TripSubtitle>
{monthYear} β€’ {diffDays} days β€’{" "}
{photoClusters.length} locations
- </p>
- </div>
- </div>
- </div>
+ </TripSubtitle>
+ </ContentContainer>
+ </CoverImageContainer>
+ </CoverContainer>
);
+});
+
+// Styled components
+const CoverContainer = styled(Box)({
+ marginBottom: "48px",
+});
+
+const CoverImageContainer = styled(Box)({
+ aspectRatio: "16/8",
+ position: "relative",
+ marginBottom: "12px",
+ borderRadius: "24px",
+ overflow: "hidden",
+});
+
+const GradientOverlay = styled(Box)({
+ position: "absolute",
+ inset: 0,
+ background:
+ "linear-gradient(to bottom, rgba(0,0,0,0.4), transparent 30%, transparent 70%, rgba(0,0,0,0.7))",
+});
+
+const LogoContainer = styled(Box)(({ theme }) => ({
+ position: "absolute",
+ top: "20px",
+ left: "20px",
+ color: theme.palette.success.main,
+}));
+
+const ContentContainer = styled(Box)({
+ position: "absolute",
+ bottom: 0,
+ left: 0,
+ right: 0,
+ padding: "24px",
+ color: "white",
+});
+
+const TripTitle = styled(Typography)({
+ fontSize: "30px",
+ fontWeight: "bold",
+ marginBottom: "2px",
+ component: "h1",
+});
+
+const TripSubtitle = styled(Typography)({
+ color: "rgba(255, 255, 255, 0.8)",
+ fontSize: "16px",
+ fontWeight: "600",
+ margin: "0",
});
\ 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.tsx
index a6d3636768..f763742724 100644
--- a/web/apps/photos/src/components/TripTemplate/TripMap.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TripMap.tsx
@@ -1,3 +1,4 @@
+import { Box, styled } from "@mui/material";
import L from "leaflet";
import dynamic from "next/dynamic";
import type { JourneyPoint } from "./types";
@@ -68,22 +69,15 @@ export const TripMap: React.FC<TripMapProps> = ({
);
return (
- <div
- style={{
- width: "100%",
- height: "100%",
- backgroundColor: hasPhotoData ? "transparent" : "#000000",
- }}
- >
+ <MapContainerWrapper hasPhotoData={hasPhotoData}>
{hasPhotoData ? (
- <MapContainer
+ <StyledMapContainer
center={getMapCenter(
photoClusters,
journeyData,
screenDimensions,
)}
zoom={optimalZoom}
- style={{ width: "100%", height: "100%" }}
scrollWheelZoom={true}
zoomControl={false}
>
@@ -193,8 +187,20 @@ export const TripMap: React.FC<TripMapProps> = ({
/>
);
})}
- </MapContainer>
+ </StyledMapContainer>
) : null}
- </div>
+ </MapContainerWrapper>
);
-};
\ No newline at end of file
+};
+
+// Styled components
+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.tsx
index a909ac2a1d..229665f7f9 100644
--- a/web/apps/photos/src/components/TripTemplate/TripStartedSection.tsx
+++ b/web/apps/photos/src/components/TripTemplate/TripStartedSection.tsx
@@ -1,3 +1,4 @@
+import { Box, styled } from "@mui/material";
import { memo } from "react";
import type { JourneyPoint } from "./types";
@@ -18,63 +19,63 @@ export const TripStartedSection = memo<TripStartedSectionProps>(({ journeyData }
const firstDate = new Date(firstData.timestamp);
return (
- <div
- style={{
- position: "relative",
- marginTop: "32px",
- marginBottom: "100px",
- textAlign: "center",
- zIndex: 1,
- }}
- >
- <div
- style={{
- fontSize: "20px",
- fontWeight: "600",
- color: "#111827",
- marginBottom: "2px",
- lineHeight: "1.2",
- backgroundColor: "white",
- padding: "4px 8px",
- borderRadius: "4px",
- display: "inline-block",
- }}
- >
+ <SectionContainer>
+ <TripStartedLabel>
Trip started
- </div>
+ </TripStartedLabel>
<br />
- <div
- style={{
- fontSize: "14px",
- color: "#6b7280",
- backgroundColor: "white",
- padding: "2px 6px",
- borderRadius: "4px",
- display: "inline-block",
- marginTop: "0px",
- }}
- >
+ <DateLabel>
{firstDate.toLocaleDateString("en-US", {
month: "long",
day: "2-digit",
})}
- </div>
+ </DateLabel>
- {/* Starting dot after some space */}
- <div
- style={{
- position: "absolute",
- left: "50%",
- top: "80px",
- transform: "translate(-50%, 0)",
- borderRadius: "50%",
- border: "2px solid white",
- zIndex: 20,
- width: "12px",
- height: "12px",
- backgroundColor: "#d1d5db",
- }}
- ></div>
- </div>
+ <StartingDot />
+ </SectionContainer>
);
-});
\ No newline at end of file
+});
+
+// Styled components
+const SectionContainer = styled(Box)({
+ position: "relative",
+ marginTop: "32px",
+ marginBottom: "100px",
+ textAlign: "center",
+ zIndex: 1,
+});
+
+const TripStartedLabel = styled(Box)(({ theme }) => ({
+ fontSize: "20px",
+ fontWeight: "600",
+ color: theme.palette.text.primary,
+ marginBottom: "2px",
+ lineHeight: "1.2",
+ backgroundColor: theme.palette.background.paper,
+ padding: "4px 8px",
+ borderRadius: "4px",
+ display: "inline-block",
+}));
+
+const DateLabel = styled(Box)(({ theme }) => ({
+ fontSize: "14px",
+ color: theme.palette.text.secondary,
+ backgroundColor: theme.palette.background.paper,
+ padding: "2px 6px",
+ borderRadius: "4px",
+ display: "inline-block",
+ marginTop: "0px",
+}));
+
+const StartingDot = styled(Box)(({ theme }) => ({
+ position: "absolute",
+ left: "50%",
+ top: "80px",
+ transform: "translate(-50%, 0)",
+ borderRadius: "50%",
+ border: `2px solid ${theme.palette.background.paper}`,
+ zIndex: 20,
+ width: "12px",
+ height: "12px",
+ backgroundColor: theme.palette.grey[300],
+}));
\ 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.tsx
index 61920a0532..1b6a90ff73 100644
--- a/web/apps/photos/src/components/TripTemplate/index.tsx
+++ b/web/apps/photos/src/components/TripTemplate/index.tsx
@@ -1,3 +1,4 @@
+import { Box, styled } from "@mui/material";
import { DownloadStatusNotifications } from "components/DownloadStatusNotifications";
import { useSaveGroups } from "ente-gallery/components/utils/save-groups";
import { FileViewer } from "ente-gallery/components/viewer/FileViewer";
@@ -82,39 +83,6 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
onAddSaveGroup,
);
};
- // Add CSS animation for spinner
- useEffect(() => {
- if (typeof document !== "undefined") {
- const style = document.createElement("style");
- style.textContent = `
- @keyframes spin {
- from { transform: rotate(0deg); }
- to { transform: rotate(360deg); }
- }
- @keyframes pulse {
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.5; }
- }
- @keyframes fadeInOut {
- 0% { opacity: 0; transform: translateY(-10px); }
- 15%, 85% { opacity: 1; transform: translateY(0); }
- 100% { opacity: 0; transform: translateY(-10px); }
- }
- .photo-fan-hover {
- transition: transform 0.3s ease-in-out;
- cursor: pointer;
- }
- .photo-fan-hover:hover {
- transform: scale(1.05);
- }
- `;
- document.head.appendChild(style);
- return () => {
- document.head.removeChild(style);
- };
- }
- return undefined;
- }, []);
const [journeyData, setJourneyData] = useState<JourneyPoint[]>([]);
const [coverImageUrl, setCoverImageUrl] = useState<string | null>(null);
@@ -768,111 +736,28 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
const hasPhotoData = journeyData.length > 0;
return (
- <div style={{ position: "relative", width: "100%", height: "100%" }}>
+ <TripTemplateContainer>
<TopNavButtons
onAddPhotos={onAddPhotos}
downloadAllFiles={downloadAllFiles}
enableDownload={enableDownload}
/>
{/* Left Sidebar - Floating Timeline */}
- <div
- ref={timelineRef}
- style={{
- position: "absolute",
- left: "16px",
- top: "16px",
- bottom: "16px",
- width: "min(50%, 1000px)",
- overflow: "auto",
- boxShadow:
- "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
- backgroundColor: "white",
- zIndex: 1000,
- borderRadius: "48px",
- }}
- >
- <div style={{ padding: "32px" }}>
+ <TimelineSidebar ref={timelineRef}>
+ <TimelineContent>
{isInitialLoad ? (
- // Show loading cover placeholder
- <div style={{ marginBottom: "96px" }}>
- <div
- style={{
- aspectRatio: "16/8",
- position: "relative",
- marginBottom: "12px",
- borderRadius: "24px",
- overflow: "hidden",
- backgroundColor: "#f3f4f6",
- animation:
- "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
- }}
- >
- <div
- style={{
- position: "absolute",
- bottom: 0,
- left: 0,
- right: 0,
- height: "128px",
- background:
- "linear-gradient(to top, rgba(0,0,0,0.3), transparent)",
- }}
- ></div>
- <div
- style={{
- position: "absolute",
- bottom: 0,
- left: 0,
- right: 0,
- padding: "24px",
- color: "rgba(255, 255, 255, 0.7)",
- }}
- >
- <div
- style={{
- height: "30px",
- width: "200px",
- backgroundColor:
- "rgba(255, 255, 255, 0.2)",
- borderRadius: "4px",
- marginBottom: "2px",
- }}
- ></div>
- <div
- style={{
- height: "16px",
- width: "120px",
- backgroundColor:
- "rgba(255, 255, 255, 0.2)",
- borderRadius: "4px",
- margin: "0",
- }}
- ></div>
- </div>
- </div>
- <div
- style={{
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- padding: "60px 20px",
- minHeight: "200px",
- }}
- >
- <div
- style={{
- animation: "spin 1s linear infinite",
- borderRadius: "50%",
- height: "40px",
- width: "40px",
- borderTop: "3px solid #10b981",
- borderRight: "3px solid transparent",
- borderBottom: "3px solid #10b981",
- borderLeft: "3px solid transparent",
- }}
- ></div>
- </div>
- </div>
+ <LoadingCoverPlaceholder>
+ <LoadingCoverImage>
+ <CoverGradientOverlay />
+ <CoverPlaceholderContent>
+ <PlaceholderTextBox sx={{ height: '30px', width: '200px', mb: '2px' }} />
+ <PlaceholderTextBox sx={{ height: '16px', width: '120px', margin: 0 }} />
+ </CoverPlaceholderContent>
+ </LoadingCoverImage>
+ <LoadingSpinnerContainer>
+ <LoadingSpinner />
+ </LoadingSpinnerContainer>
+ </LoadingCoverPlaceholder>
) : journeyData.length > 0 ? (
<div>
<TripCover
@@ -882,45 +767,17 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
coverImageUrl={coverImageUrl}
/>
- {/* Show either loading spinner or trip started section + timeline */}
{isLoadingLocations ? (
- <div
- style={{
- position: "relative",
- marginTop: "64px",
- marginBottom: "200px",
- textAlign: "center",
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- }}
- >
- <div
- style={{
- animation:
- "spin 1s linear infinite",
- borderRadius: "50%",
- height: "40px",
- width: "40px",
- borderTop: "3px solid #10b981",
- borderRight:
- "3px solid transparent",
- borderBottom: "3px solid #10b981",
- borderLeft: "3px solid transparent",
- }}
- ></div>
- </div>
+ <LocationsLoadingContainer>
+ <LoadingSpinner />
+ </LocationsLoadingContainer>
) : (
<>
<TripStartedSection
journeyData={journeyData}
/>
- {/* Timeline */}
- <div
- style={{ position: "relative" }}
- id="timeline-container"
- >
+ <TimelineContainer id="timeline-container">
<TimelineBaseLine
locationPositions={
locationPositions
@@ -955,23 +812,20 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
/>
))}
- {/* Bottom padding for scrolling */}
- <div
- style={{ marginBottom: "24px" }}
- ></div>
- </div>
+ <Box sx={{ mb: 3 }} />
+ </TimelineContainer>
</>
)}
</div>
) : (
- <div style={{ textAlign: "center" }}>
- <p style={{ color: "#4b5563" }}>
+ <NoPhotosContainer>
+ <Box sx={{ color: 'text.muted' }}>
No photos with location data found.
- </p>
- </div>
+ </Box>
+ </NoPhotosContainer>
)}
- </div>
- </div>
+ </TimelineContent>
+ </TimelineSidebar>
{/* Map Container */}
<TripMap
@@ -1010,6 +864,112 @@ export const TripTemplate: React.FC<TripTemplateProps> = ({
saveGroups={saveGroups}
onRemoveSaveGroup={onRemoveSaveGroup}
/>
- </div>
+ </TripTemplateContainer>
);
};
+
+// Styled components
+const TripTemplateContainer = styled(Box)({
+ position: "relative",
+ width: "100%",
+ height: "100%",
+});
+
+const TimelineSidebar = styled(Box)(({ theme }) => ({
+ position: "absolute",
+ left: "16px",
+ top: "16px",
+ bottom: "16px",
+ width: "min(50%, 1000px)",
+ overflow: "auto",
+ boxShadow: theme.shadows[10],
+ backgroundColor: theme.palette.background.paper,
+ zIndex: 1000,
+ borderRadius: "48px",
+}));
+
+const TimelineContent = styled(Box)({
+ padding: "32px",
+});
+
+const LoadingCoverPlaceholder = styled(Box)({
+ marginBottom: "96px",
+});
+
+const LoadingCoverImage = styled(Box)(({ theme }) => ({
+ aspectRatio: "16/8",
+ position: "relative",
+ marginBottom: "12px",
+ borderRadius: "24px",
+ overflow: "hidden",
+ backgroundColor: theme.palette.grey[200],
+ animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
+ "@keyframes pulse": {
+ "0%, 100%": { opacity: 1 },
+ "50%": { opacity: 0.5 },
+ },
+}));
+
+const CoverGradientOverlay = styled(Box)({
+ position: "absolute",
+ bottom: 0,
+ left: 0,
+ right: 0,
+ height: "128px",
+ background: "linear-gradient(to top, rgba(0,0,0,0.3), transparent)",
+});
+
+const CoverPlaceholderContent = styled(Box)({
+ position: "absolute",
+ bottom: 0,
+ left: 0,
+ right: 0,
+ padding: "24px",
+ color: "rgba(255, 255, 255, 0.7)",
+});
+
+const PlaceholderTextBox = styled(Box)({
+ backgroundColor: "rgba(255, 255, 255, 0.2)",
+ borderRadius: "4px",
+});
+
+const LoadingSpinnerContainer = styled(Box)({
+ display: "flex",
+ justifyContent: "center",
+ alignItems: "center",
+ padding: "60px 20px",
+ minHeight: "200px",
+});
+
+const LoadingSpinner = styled(Box)(({ theme }) => ({
+ animation: "spin 1s linear infinite",
+ borderRadius: "50%",
+ height: "40px",
+ width: "40px",
+ borderTop: `3px solid ${theme.palette.success.main}`,
+ borderRight: "3px solid transparent",
+ borderBottom: `3px solid ${theme.palette.success.main}`,
+ borderLeft: "3px solid transparent",
+ "@keyframes spin": {
+ from: { transform: "rotate(0deg)" },
+ to: { transform: "rotate(360deg)" },
+ },
+}));
+
+const LocationsLoadingContainer = styled(Box)({
+ position: "relative",
+ marginTop: "64px",
+ marginBottom: "200px",
+ textAlign: "center",
+ display: "flex",
+ justifyContent: "center",
+ alignItems: "center",
+});
+
+const TimelineContainer = styled(Box)({
+ position: "relative",
+});
+
+const NoPhotosContainer = styled(Box)({
+ textAlign: "center",
+});