Skip to content

armgit / ente

Public Imported from GitHub
0

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

refractor(memories):updating-ui

Aswin Asokf2bccf2943bd
diff --git a/web/apps/memories/public/images/memories-meta.png b/web/apps/memories/public/images/memories-meta.png
new file mode 100644
index 0000000000..a0920dfe81
Binary files /dev/null and b/web/apps/memories/public/images/memories-meta.png differ
diff --git a/web/apps/memories/src/components/LaneMemoryViewer.tsx b/web/apps/memories/src/components/LaneMemoryViewer.tsx
index 4391f6f4eb..0ab3c18885 100644
--- a/web/apps/memories/src/components/LaneMemoryViewer.tsx
+++ b/web/apps/memories/src/components/LaneMemoryViewer.tsx
@@ -31,8 +31,8 @@ import {
} from "../utils/lane";
import {
LaneCaptionText,
+ LanePlaybackGlyph,
LaneProgressSlider,
- PlaybackGlyph,
} from "./PublicMemoryControls";
import { PhotoImage, VideoPlayer } from "./PublicMemoryMedia";
import {
@@ -64,7 +64,7 @@ const LANE_GRID_LINE_COLOR = "#08c225";
const LANE_GRID_LINE_OPACITY = 0.06;
const LANE_GRID_DISPLACEMENT_SCALE = 9;
const LANE_VERTICAL_STACK_GAP_PX = 32;
-const LANE_CARD_TO_CONTROLS_GAP_PX = 40;
+const LANE_CARD_TO_CONTROLS_GAP_PX = 52;
const LANE_CARD_SIZE_SCALE = 0.94;
function calculateLaneXOffset(
@@ -545,7 +545,10 @@ export function LaneMemoryViewer({
Math.max(Math.round(clampedValue), 0),
files.length - 1,
);
+ restartOnResumeRef.current = false;
+ finishedLanePlaybackRef.current = false;
setIsScrubbing(false);
+ setPaused(false);
setStackProgress(roundedIndex);
if (displayIndexRef.current !== roundedIndex) {
commitDisplayIndex(roundedIndex);
@@ -583,7 +586,7 @@ export function LaneMemoryViewer({
variant="contained"
color="accent"
disableElevation
- href="https://ente.io"
+ href="https://ente.io/get"
target="_blank"
rel="noreferrer"
sx={laneHeaderJoinNowButtonSx}
@@ -594,187 +597,200 @@ export function LaneMemoryViewer({
</LaneTopBar>
<LaneCenterSection>
- <PhotoContainer
- style={{ flex: "0 0 auto", minHeight: "auto" }}
- onContextMenu={(event) => event.preventDefault()}
- onDragStart={(event) => event.preventDefault()}
- >
- <LaneCardStack
- style={{
- width: `${laneFrameSize.width}px`,
- height: `${laneFrameSize.height}px`,
- }}
- onClick={handleLaneMediaFrameClick}
+ <LaneMediaSection>
+ <LaneSliderTitle variant="h6">
+ {laneTitle}
+ </LaneSliderTitle>
+ <PhotoContainer
+ style={{ flex: "0 0 auto", minHeight: "auto" }}
+ onContextMenu={(event) => event.preventDefault()}
+ onDragStart={(event) => event.preventDefault()}
>
- {laneSlices.map((slice) => {
- const file = files[slice.index]!;
- const frame = laneFrames?.[slice.index];
- const scale = calculateLaneScale(
- slice.distance,
- );
- const xOffset: number = calculateLaneXOffset(
- slice.distance,
- laneFrameSize.width,
- viewport.width,
- );
- const opacity = calculateLaneOpacity(
- slice.distance,
- );
- const blurSigma =
- isScrubbing || isCompactLaneLayout
- ? 0
- : calculateLaneBlur(slice.distance);
- const rotation =
- (calculateLaneRotation(slice.distance) *
- 180) /
- Math.PI;
- const overlayOpacity =
- calculateLaneOverlayOpacity(slice.distance);
- const cropRect = resolveLaneCropRect(frame);
- const containerAspectRatio =
- laneFrameSize.width / laneFrameSize.height;
- const isDisplayCard =
- slice.index === displayIndex;
- const prefersRichImage =
- file.metadata.fileType === FileType.video
- ? isDisplayCard
- : Math.abs(slice.distance) < 1.1;
- const mediaAspectRatio = isDisplayCard
- ? (activeMediaAspectRatio ??
- getFileAspectRatio(file))
- : getFileAspectRatio(file);
-
- return (
- <LaneStackSlice
- key={`lane-slice-${slice.index}`}
- style={{
- opacity,
- transform: `translateX(${xOffset}px) rotate(${rotation}deg) scale(${scale})`,
- }}
- >
- <LaneCardSurface
+ <LaneCardStack
+ style={{
+ width: `${laneFrameSize.width}px`,
+ height: `${laneFrameSize.height}px`,
+ }}
+ onClick={handleLaneMediaFrameClick}
+ >
+ {laneSlices.map((slice) => {
+ const file = files[slice.index]!;
+ const frame = laneFrames?.[slice.index];
+ const scale = calculateLaneScale(
+ slice.distance,
+ );
+ const xOffset: number = calculateLaneXOffset(
+ slice.distance,
+ laneFrameSize.width,
+ viewport.width,
+ );
+ const opacity = calculateLaneOpacity(
+ slice.distance,
+ );
+ const blurSigma =
+ isScrubbing || isCompactLaneLayout
+ ? 0
+ : calculateLaneBlur(slice.distance);
+ const rotation =
+ (calculateLaneRotation(slice.distance) *
+ 180) /
+ Math.PI;
+ const overlayOpacity =
+ calculateLaneOverlayOpacity(
+ slice.distance,
+ );
+ const cropRect = resolveLaneCropRect(frame);
+ const containerAspectRatio =
+ laneFrameSize.width /
+ laneFrameSize.height;
+ const isDisplayCard =
+ slice.index === displayIndex;
+ const prefersRichImage =
+ file.metadata.fileType === FileType.video
+ ? isDisplayCard
+ : Math.abs(slice.distance) < 1.1;
+ const mediaAspectRatio = isDisplayCard
+ ? (activeMediaAspectRatio ??
+ getFileAspectRatio(file))
+ : getFileAspectRatio(file);
+
+ return (
+ <LaneStackSlice
+ key={`lane-slice-${slice.index}`}
style={{
- boxShadow: laneCardShadow(
- slice.distance,
- ),
+ opacity,
+ transform: `translateX(${xOffset}px) rotate(${rotation}deg) scale(${scale})`,
}}
>
- <LaneCardMediaLayer
+ <LaneCardSurface
style={{
- filter:
- blurSigma > 0
- ? `blur(${blurSigma}px)`
- : undefined,
+ boxShadow: laneCardShadow(
+ slice.distance,
+ ),
}}
>
- {file.metadata.fileType ===
- FileType.video &&
- isDisplayCard ? (
- <VideoPlayer
- file={file}
- paused={paused}
- mediaRef={
- activeVideoElementRef
- }
- fillFrame
- objectFit="cover"
- cropRect={cropRect}
- cropContainerAspectRatio={
- containerAspectRatio
- }
- mediaAspectRatio={
- mediaAspectRatio
- }
- onReady={handleFullLoad}
- onDuration={
- handleVideoDuration
- }
- onEnded={
- handleVideoEnded
- }
- onAspectRatio={
- handleActiveAspectRatio
- }
- />
- ) : (
- <PhotoImage
- file={file}
- fillFrame
- objectFit="cover"
- cropRect={cropRect}
- cropContainerAspectRatio={
- containerAspectRatio
- }
- mediaAspectRatio={
- mediaAspectRatio
- }
- onFullLoad={
- isDisplayCard
- ? handleFullLoad
- : undefined
- }
- onAspectRatio={
- isDisplayCard
- ? handleActiveAspectRatio
- : undefined
- }
- showLoadingOverlay={
- isDisplayCard
- }
- thumbnailOnly={
- !prefersRichImage
- }
- />
- )}
- </LaneCardMediaLayer>
- {overlayOpacity > 0 && (
- <LaneCardOverlayLayer
+ <LaneCardMediaLayer
style={{
- opacity: overlayOpacity,
+ filter:
+ blurSigma > 0
+ ? `blur(${blurSigma}px)`
+ : undefined,
}}
+ >
+ {file.metadata.fileType ===
+ FileType.video &&
+ isDisplayCard ? (
+ <VideoPlayer
+ file={file}
+ paused={paused}
+ mediaRef={
+ activeVideoElementRef
+ }
+ fillFrame
+ objectFit="cover"
+ cropRect={cropRect}
+ cropContainerAspectRatio={
+ containerAspectRatio
+ }
+ mediaAspectRatio={
+ mediaAspectRatio
+ }
+ onReady={
+ handleFullLoad
+ }
+ onDuration={
+ handleVideoDuration
+ }
+ onEnded={
+ handleVideoEnded
+ }
+ onAspectRatio={
+ handleActiveAspectRatio
+ }
+ />
+ ) : (
+ <PhotoImage
+ file={file}
+ fillFrame
+ objectFit="cover"
+ cropRect={cropRect}
+ cropContainerAspectRatio={
+ containerAspectRatio
+ }
+ mediaAspectRatio={
+ mediaAspectRatio
+ }
+ onFullLoad={
+ isDisplayCard
+ ? handleFullLoad
+ : undefined
+ }
+ onAspectRatio={
+ isDisplayCard
+ ? handleActiveAspectRatio
+ : undefined
+ }
+ showLoadingOverlay={
+ isDisplayCard
+ }
+ thumbnailOnly={
+ !prefersRichImage
+ }
+ />
+ )}
+ </LaneCardMediaLayer>
+ {overlayOpacity > 0 && (
+ <LaneCardOverlayLayer
+ style={{
+ opacity:
+ overlayOpacity,
+ }}
+ />
+ )}
+ </LaneCardSurface>
+ </LaneStackSlice>
+ );
+ })}
+ {showPlaybackOverlay && (
+ <LaneCornerPlaybackOverlay>
+ <LaneCornerPlaybackControl
+ type="button"
+ onClick={handlePlaybackToggle}
+ aria-label={playbackOverlayLabel}
+ data-memory-control="true"
+ >
+ <LaneCornerPlaybackGlyph>
+ <LanePlaybackGlyph
+ paused={paused}
/>
- )}
- </LaneCardSurface>
- </LaneStackSlice>
- );
- })}
- {showPlaybackOverlay && (
- <LaneCenteredPlaybackOverlay>
- <LaneCenteredPlaybackControl
- type="button"
- onClick={handlePlaybackToggle}
- aria-label={playbackOverlayLabel}
- data-memory-control="true"
- >
- <LaneCenteredPlaybackGlyph>
- <PlaybackGlyph paused={paused} />
- </LaneCenteredPlaybackGlyph>
- </LaneCenteredPlaybackControl>
- </LaneCenteredPlaybackOverlay>
- )}
- </LaneCardStack>
- </PhotoContainer>
+ </LaneCornerPlaybackGlyph>
+ </LaneCornerPlaybackControl>
+ </LaneCornerPlaybackOverlay>
+ )}
+ </LaneCardStack>
+ </PhotoContainer>
+ </LaneMediaSection>
<LaneBottomSection>
- <LaneCaptionRow>
- <LaneCaption>
- <LaneCaptionText
- model={laneCaptionModel}
- previousValue={previousCaptionValue}
- />
- </LaneCaption>
- </LaneCaptionRow>
- <LaneProgressSlider
- total={files.length}
- currentProgress={stackProgress}
- onSeek={onSeek}
- onScrubStart={handleScrubStart}
- onScrub={handleScrub}
- onScrubEnd={handleScrubEnd}
- />
- <LaneSliderTitle variant="h6">
- {laneTitle}
- </LaneSliderTitle>
+ <LaneSliderMetaStack>
+ <LaneProgressSlider
+ total={files.length}
+ currentProgress={stackProgress}
+ width={laneFrameSize.width}
+ onSeek={onSeek}
+ onScrubStart={handleScrubStart}
+ onScrub={handleScrub}
+ onScrubEnd={handleScrubEnd}
+ />
+ <LaneCaptionRow>
+ <LaneCaption>
+ <LaneCaptionText
+ model={laneCaptionModel}
+ previousValue={previousCaptionValue}
+ />
+ </LaneCaption>
+ </LaneCaptionRow>
+ </LaneSliderMetaStack>
</LaneBottomSection>
</LaneCenterSection>
</LaneContentContainer>
@@ -1068,19 +1084,24 @@ const laneHeaderJoinNowButtonSx = {
const LaneSliderTitle = styled(Typography)({
color: "rgba(255, 255, 255, 0.42)",
- fontWeight: 300,
- fontSize: "15px",
+ fontWeight: 600,
+ fontSize: "24px",
lineHeight: 1.15,
letterSpacing: "-0.01em",
textAlign: "center",
+ paddingBottom: "10px",
whiteSpace: "normal",
overflowWrap: "anywhere",
maxWidth: "min(42vw, 420px)",
"@media (max-width: 900px)": {
+ fontSize: "21px",
+ paddingBottom: "8px",
maxWidth: "min(56vw, 360px)",
},
[`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: {
- fontSize: "14px",
+ fontSize: "18px",
+ lineHeight: 1.2,
+ paddingBottom: "6px",
maxWidth: "min(100%, 280px)",
},
});
@@ -1100,6 +1121,20 @@ const LaneCenterSection = styled("div")({
},
});
+const LaneMediaSection = styled("div")({
+ width: "100%",
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ gap: "26px",
+ "@media (max-width: 900px)": {
+ gap: "22px",
+ },
+ [`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: {
+ gap: "18px",
+ },
+});
+
const LaneCardStack = styled("div")({ position: "relative", flexShrink: 0 });
const LaneStackSlice = styled("div")({
@@ -1152,6 +1187,14 @@ const LaneBottomSection = styled("div")({
paddingBottom: 0,
});
+const LaneSliderMetaStack = styled("div")({
+ width: "100%",
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ gap: `${LANE_VERTICAL_STACK_GAP_PX}px`,
+});
+
const LaneCaptionRow = styled("div")({
display: "flex",
alignItems: "center",
@@ -1177,19 +1220,26 @@ const LaneCaption = styled("div")({
},
});
-const LaneCenteredPlaybackOverlay = styled("div")({
+const LaneCornerPlaybackOverlay = styled("div")({
position: "absolute",
inset: 0,
zIndex: 4,
display: "flex",
- alignItems: "center",
- justifyContent: "center",
+ alignItems: "flex-end",
+ justifyContent: "flex-end",
+ padding: "20px",
pointerEvents: "none",
+ "@media (max-width: 900px)": {
+ padding: "18px",
+ },
+ [`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: {
+ padding: "14px",
+ },
});
-const LaneCenteredPlaybackControl = styled("button")({
- width: "88px",
- height: "88px",
+const LaneCornerPlaybackControl = styled("button")({
+ width: "58px",
+ height: "58px",
borderRadius: "999px",
border: 0,
cursor: "pointer",
@@ -1210,20 +1260,20 @@ const LaneCenteredPlaybackControl = styled("button")({
transform: "scale(1.03)",
},
"&:active": { transform: "scale(0.98)" },
- "@media (max-width: 900px)": { width: "80px", height: "80px" },
+ "@media (max-width: 900px)": { width: "54px", height: "54px" },
[`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: {
- width: "72px",
- height: "72px",
+ width: "48px",
+ height: "48px",
},
});
-const LaneCenteredPlaybackGlyph = styled("span")({
+const LaneCornerPlaybackGlyph = styled("span")({
display: "inline-flex",
alignItems: "center",
justifyContent: "center",
- transform: "scale(1.65)",
+ transform: "scale(1.55)",
transformOrigin: "center",
[`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: {
- transform: "scale(1.45)",
+ transform: "scale(1.35)",
},
});
diff --git a/web/apps/memories/src/components/MemoryViewer.tsx b/web/apps/memories/src/components/MemoryViewer.tsx
index 7116d0f838..c55a982c9e 100644
--- a/web/apps/memories/src/components/MemoryViewer.tsx
+++ b/web/apps/memories/src/components/MemoryViewer.tsx
@@ -497,7 +497,7 @@ export function MemoryViewer({
variant="contained"
color="accent"
disableElevation
- href="https://ente.io"
+ href="https://ente.io/get"
target="_blank"
rel="noreferrer"
>
@@ -525,7 +525,7 @@ export function MemoryViewer({
variant="contained"
color="accent"
disableElevation
- href="https://ente.io"
+ href="https://ente.io/get"
target="_blank"
rel="noreferrer"
>
diff --git a/web/apps/memories/src/components/PublicMemoryControls.tsx b/web/apps/memories/src/components/PublicMemoryControls.tsx
index e9a722a493..f74c8282bc 100644
--- a/web/apps/memories/src/components/PublicMemoryControls.tsx
+++ b/web/apps/memories/src/components/PublicMemoryControls.tsx
@@ -49,7 +49,9 @@ const LaneProgressTrack = styled("div")({
borderRadius: "999px",
backgroundColor: "rgba(193, 246, 235, 0.32)",
cursor: "pointer",
- "@media (max-width: 900px)": { maxWidth: "320px" },
+ "@media (max-width: 900px)": {
+ maxWidth: "320px",
+ },
[`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: {
maxWidth: "min(calc(100vw - 48px), 304px)",
},
@@ -204,6 +206,7 @@ interface LaneProgressSliderProps {
total: number;
current?: number;
currentProgress?: number;
+ width?: number;
onSeek: (index: number) => void;
onScrubStart?: () => void;
onScrub?: (value: number) => void;
@@ -218,6 +221,7 @@ export const LaneProgressSlider: React.FC<LaneProgressSliderProps> = ({
total,
current,
currentProgress,
+ width,
onSeek,
onScrubStart,
onScrub,
@@ -313,6 +317,9 @@ export const LaneProgressSlider: React.FC<LaneProgressSliderProps> = ({
return (
<LaneProgressTrack
data-memory-control="true"
+ style={{
+ maxWidth: typeof width === "number" ? `${width}px` : undefined,
+ }}
onPointerDown={handlePointerDown}
onLostPointerCapture={handleLostPointerCapture}
onPointerMove={handlePointerMove}
diff --git a/web/apps/memories/src/components/PublicMemoryPageShell.tsx b/web/apps/memories/src/components/PublicMemoryPageShell.tsx
index a1d294919f..006a19f4eb 100644
--- a/web/apps/memories/src/components/PublicMemoryPageShell.tsx
+++ b/web/apps/memories/src/components/PublicMemoryPageShell.tsx
@@ -6,6 +6,7 @@
import { CircularProgress, Typography } from "@mui/material";
import { Stack100vhCenter } from "ente-base/components/containers";
import { CustomHead } from "ente-base/components/Head";
+import { memoriesAppOrigin } from "ente-base/origins";
import Head from "next/head";
import type { PropsWithChildren } from "react";
@@ -14,11 +15,19 @@ import type { PropsWithChildren } from "react";
* Used only by `PublicMemoryPageShell` in this file.
*/
function PublicMemoryDocumentHead() {
+ const previewImage = `${memoriesAppOrigin()}/images/memories-meta.png`;
+
return (
<>
<CustomHead title="Ente Memories" />
<Head>
<meta name="robots" content="noindex, nofollow" />
+ <meta property="og:image" content={previewImage} />
+ <meta property="og:image:secure_url" content={previewImage} />
+ <meta property="og:image:type" content="image/png" />
+ <meta property="og:image:width" content="720" />
+ <meta property="og:image:height" content="405" />
+ <meta name="twitter:image" content={previewImage} />
</Head>
</>
);
diff --git a/web/apps/memories/src/utils/lane.ts b/web/apps/memories/src/utils/lane.ts
index 9e829bb7d7..04f0afba12 100644
--- a/web/apps/memories/src/utils/lane.ts
+++ b/web/apps/memories/src/utils/lane.ts
@@ -210,9 +210,7 @@ export const formatLaneCaption = ({
const yearsLabel = `${roundedValue} year${roundedValue === 1 ? "" : "s"}`;
if (captionType === "age") {
- return personName
- ? `${personName} ${yearsLabel} old`
- : `${yearsLabel} old`;
+ return `${yearsLabel} old`;
}
return personName ? `${personName} ${yearsLabel} ago` : `${yearsLabel} ago`;
@@ -247,7 +245,8 @@ export const buildLaneCaptionModel = ({
}
return Math.max(0, Math.round(yearsBetween(creationDate, new Date())));
})();
- const prefix = personName ? `${personName} ` : "";
+ const prefix =
+ captionType === "age" ? "" : personName ? `${personName} ` : "";
const suffix =
captionType === "age"
? ` year${roundedValue === 1 ? "" : "s"} old`
diff --git a/web/packages/base/origins.ts b/web/packages/base/origins.ts
index 7eb7394660..9c37f1d8a5 100644
--- a/web/packages/base/origins.ts
+++ b/web/packages/base/origins.ts
@@ -124,13 +124,13 @@ export const shareAppOrigin = (): string =>
/**
* Return the origin/path that serves the memories app landing experience.
*
- * Defaults to our production memories app, "https://memories.ente.io",
+ * Defaults to our production memories app, "https://ente.com",
* but can be overridden by setting the `NEXT_PUBLIC_ENTE_MEMORIES_ENDPOINT`
* environment variable.
*/
export const memoriesAppOrigin = (): string =>
process.env.NEXT_PUBLIC_ENTE_MEMORIES_ENDPOINT ??
- "https://memories.ente.io";
+ "https://ente.com";
/**
* Return the origin that serves the photos app.