π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Revert "[web][memories] Add memory link branding"
Aswin Asok9cf3c599f12d
diff --git a/web/apps/memories/package.json b/web/apps/memories/package.jsonindex 9e9c24bcdf..18f7e3147b 100644--- a/web/apps/memories/package.json+++ b/web/apps/memories/package.json@@ -6,7 +6,6 @@"build:post": "rm -f out/404.html"},"dependencies": {- "@fontsource-variable/outfit": "5.2.8","@fontsource/itim": "5.2.7","ente-base": "*","ente-gallery": "*",diff --git a/web/apps/memories/public/images/memories-end-card.webp b/web/apps/memories/public/images/memories-end-card.webpdeleted file mode 100644index e34265b4ba..0000000000Binary files a/web/apps/memories/public/images/memories-end-card.webp and /dev/null differdiff --git a/web/apps/memories/src/components/MemoryEndCard.tsx b/web/apps/memories/src/components/MemoryEndCard.tsxdeleted file mode 100644index 64e2b622f9..0000000000--- a/web/apps/memories/src/components/MemoryEndCard.tsx+++ /dev/null@@ -1,79 +0,0 @@-import { styled } from "@mui/material";--const CARD_WIDTH_PX = 518;-const CARD_HEIGHT_PX = 628;--interface MemoryEndCardProps {- width: number;-}--export function MemoryEndCard({ width }: MemoryEndCardProps) {- const scale = width / CARD_WIDTH_PX;-- return (- <CardContainer>- <CardStage style={{ transform: `scale(${scale})` }}>- <Artwork- src="/images/memories-end-card.webp"- alt="Preserve your memories with Ente"- />- <DownloadButton- href="https://ente.com/try"- target="_blank"- rel="noopener"- data-memory-control="true"- >- Download Ente- </DownloadButton>- </CardStage>- </CardContainer>- );-}--const CardContainer = styled("div")({- width: "100%",- height: "100%",- display: "flex",- alignItems: "center",- justifyContent: "center",-});--const CardStage = styled("div")({- position: "relative",- width: `${CARD_WIDTH_PX}px`,- height: `${CARD_HEIGHT_PX}px`,- flexShrink: 0,- overflow: "hidden",- borderRadius: "21px",- background: "linear-gradient(180deg, #f9f9f9 60%, #939393 184%)",- transformOrigin: "center",-});--const Artwork = styled("img")({- position: "absolute",- inset: 0,- width: "100%",- height: "100%",- display: "block",-});--const DownloadButton = styled("a")({- position: "absolute",- left: "317px",- top: "227.6px",- display: "inline-flex",- alignItems: "center",- justifyContent: "center",- borderRadius: "15.7px",- padding: "15.7px 27.9px",- color: "#fff",- backgroundColor: "#08c225",- fontFamily: "'Outfit Variable', sans-serif",- fontSize: "14px",- fontWeight: 700,- lineHeight: "normal",- textDecoration: "none",- whiteSpace: "nowrap",- transition: "background-color 150ms ease",- "&:hover": { backgroundColor: "#07a820" },-});diff --git a/web/apps/memories/src/components/MemoryViewer.tsx b/web/apps/memories/src/components/MemoryViewer.tsxindex 543b5a3ee4..efd52dc800 100644--- a/web/apps/memories/src/components/MemoryViewer.tsx+++ b/web/apps/memories/src/components/MemoryViewer.tsx@@ -19,7 +19,6 @@ import {useRef,useState,} from "react";-import { MemoryEndCard } from "./MemoryEndCard";import { PlaybackGlyph, ProgressIndicator } from "./PublicMemoryControls";import { PhotoImage, VideoPlayer } from "./PublicMemoryMedia";import {@@ -32,9 +31,9 @@ import {JoinNowButton,type MemoryViewerProps,MOBILE_LAYOUT_BREAKPOINT_PX,+ MobileJoinNowButton,PhotoContainer,readViewport,- ViewerFooterBar,ViewerRoot,} from "./PublicMemoryViewerShared";@@ -48,35 +47,28 @@ const DESKTOP_MEDIA_HORIZONTAL_PADDING_PX = 32;const DESKTOP_MEDIA_VERTICAL_RESERVED_PX = 184;const MOBILE_VIDEO_MAX_WIDTH_PX = 344;const MEDIA_SWITCH_TRANSITION_DURATION_MS = 380;-const MEMORY_END_CARD_ASPECT_RATIO = 518 / 628;const DESKTOP_MEDIA_MAX_WIDTH_CSS = `min(${DESKTOP_MEDIA_MAX_WIDTH_PX}px, calc(100vw - ${DESKTOP_MEDIA_HORIZONTAL_PADDING_PX}px))`;const DESKTOP_MEDIA_MAX_HEIGHT_CSS = `calc(min(100vh, 100dvh) - ${DESKTOP_MEDIA_VERTICAL_RESERVED_PX}px)`;const DESKTOP_BACKGROUND_IMAGE_PATH = "/images/memory-lane-bg-desktop.svg";const MOBILE_BACKGROUND_IMAGE_PATH = "/images/memory-lane-bg-mobile.svg";-const shareHeaderJoinNowButtonSx = {- borderRadius: "999px",- fontSize: "16px",- fontWeight: 700,- lineHeight: "14px",- paddingBlock: "18px",- paddingInline: "32px",-};const compactShareHeaderJoinNowButtonSx = {- ...shareHeaderJoinNowButtonSx,+ borderRadius: "14px",fontSize: "15px",- paddingBlock: "13px",- paddingInline: "24px",+ lineHeight: 1.1,+ minHeight: "42px",+ paddingBlock: "10px",+ paddingInline: "20px",};interface SharedMemoryHeaderProps {title: string;- date?: string;total: number;current: number;paused: boolean;duration: number;onComplete: () => void;isVideo: boolean;+ showTitle?: boolean;}/**@@ -85,13 +77,13 @@ interface SharedMemoryHeaderProps {*/function SharedMemoryHeader({title,- date,total,current,paused,duration,onComplete,isVideo,+ showTitle = true,}: SharedMemoryHeaderProps) {const progressIndicator = (<ProgressIndicator@@ -107,15 +99,58 @@ function SharedMemoryHeader({return (<HeaderSection>- <HeaderMeta>- <MemoryTitle variant="h6">{title}</MemoryTitle>- {!!date && <MemoryDate variant="body">{date}</MemoryDate>}- </HeaderMeta>+ {showTitle && <MemoryTitle variant="h6">{title}</MemoryTitle>}{progressIndicator}</HeaderSection>);}+interface MobileProgressHeaderProps {+ title: string;+ date?: string;+ total: number;+ current: number;+ paused: boolean;+ duration: number;+ onComplete: () => void;+ isVideo: boolean;+}++function MobileProgressHeader({+ title,+ date,+ total,+ current,+ paused,+ duration,+ onComplete,+ isVideo,+}: MobileProgressHeaderProps) {+ return (+ <HeaderSection>+ <MobileFooterMeta>+ <MobileFooterPrimaryLine variant="h6">+ {title}+ </MobileFooterPrimaryLine>+ {!!date && (+ <MobileFooterSecondaryLine variant="body">+ {date}+ </MobileFooterSecondaryLine>+ )}+ </MobileFooterMeta>+ <ProgressIndicator+ total={total}+ current={current}+ paused={paused}+ duration={duration}+ onComplete={onComplete}+ isVideo={isVideo}+ minimal+ />+ </HeaderSection>+ );+}+/*** Primary viewer for normal public memory shares.* Used by `pages/index.tsx` when `viewerVariant` resolves to `"share"`.@@ -126,6 +161,7 @@ export function MemoryViewer({memoryName,onNext,onPrev,+ onSeek,}: MemoryViewerProps) {const currentFile = files[currentIndex]!;const [paused, setPaused] = useState(false);@@ -237,21 +273,28 @@ export function MemoryViewer({setPaused(true);}, []);- const resumeCurrentVideoPlayback = useCallback(() => {- const video = activeVideoElementRef.current;- if (!video) {- return;- }+ const resumeCurrentVideoPlayback = useCallback(+ ({ restart = false }: { restart?: boolean } = {}) => {+ const video = activeVideoElementRef.current;+ if (!video) {+ return;+ }- video.muted = false;- void video.play().catch((error: unknown) => {- log.warn(- "Failed to start memory video playback from user gesture",- error,- );- handleVideoPlaybackBlocked();- });- }, [handleVideoPlaybackBlocked]);+ if (restart) {+ video.currentTime = 0;+ }++ video.muted = false;+ void video.play().catch((error: unknown) => {+ log.warn(+ "Failed to start memory video playback from user gesture",+ error,+ );+ handleVideoPlaybackBlocked();+ });+ },+ [handleVideoPlaybackBlocked],+ );const handleMediaAspectRatio = useCallback((width: number, height: number) => {@@ -272,40 +315,6 @@ export function MemoryViewer({onNext();}, [currentIndex, files.length, onNext]);- const handlePrevious = useCallback(() => {- if (finishedPlayback) {- setFinishedPlayback(false);- setPaused(false);- return;- }- onPrev();- }, [finishedPlayback, onPrev]);-- // The page-level key handler cannot see the viewer-local end-card state.- useEffect(() => {- const handleKeyDown = (event: KeyboardEvent) => {- if (event.key === "ArrowLeft" && finishedPlayback) {- event.preventDefault();- event.stopPropagation();- handlePrevious();- } else if (- event.key === "ArrowRight" &&- currentIndex >= files.length - 1- ) {- handleAdvanceOrFinish();- }- };- document.addEventListener("keydown", handleKeyDown, true);- return () =>- document.removeEventListener("keydown", handleKeyDown, true);- }, [- currentIndex,- files.length,- finishedPlayback,- handleAdvanceOrFinish,- handlePrevious,- ]);-useEffect(() => {if (!isCurrentThumbnailResolved) {return;@@ -398,19 +407,55 @@ export function MemoryViewer({}}, [currentFile]);- const headerTitle = memoryName || currentFileDate || "Memory";- const headerDate =- memoryName && currentFileDate ? currentFileDate : undefined;+ const headerTitle = useMemo(() => {+ if (memoryName && currentFileDate) {+ return `${memoryName} β’ ${currentFileDate}`;+ }+ return memoryName || currentFileDate || "Memory";+ }, [currentFileDate, memoryName]);++ const mobileFooterTitle = useMemo(+ () => memoryName || currentFileDate || "Memory",+ [currentFileDate, memoryName],+ );+ const mobileFooterDate = useMemo(+ () => (memoryName && currentFileDate ? currentFileDate : undefined),+ [currentFileDate, memoryName],+ );++ const handleRestartPlayback = useCallback(() => {+ if (currentIndex > 0) {+ onSeek(0);+ return;+ }++ setFinishedPlayback(false);+ setPaused(false);+ if (isVideo) {+ resumeCurrentVideoPlayback({ restart: true });+ }+ }, [currentIndex, isVideo, onSeek, resumeCurrentVideoPlayback]);const handlePlaybackOverlayClick = useCallback((event: ReactMouseEvent<HTMLButtonElement>) => {event.stopPropagation();++ if (finishedPlayback) {+ handleRestartPlayback();+ return;+ }+setPaused(false);if (isVideo) {resumeCurrentVideoPlayback();}},- [isVideo, resumeCurrentVideoPlayback],+ [+ finishedPlayback,+ handleRestartPlayback,+ isVideo,+ resumeCurrentVideoPlayback,+ ],);const handleViewerClick = useCallback(@@ -421,15 +466,15 @@ export function MemoryViewer({const clickX = event.clientX;if (clickX <= viewport.width * EDGE_NAV_TAP_ZONE_RATIO) {- handlePrevious();+ onPrev();} else if (clickX >=viewport.width * (1 - EDGE_NAV_TAP_ZONE_RATIO)) {- handleAdvanceOrFinish();+ onNext();}},- [handleAdvanceOrFinish, handlePrevious, viewport.width],+ [onNext, onPrev, viewport.width],);const handleMediaFrameClick = useCallback(@@ -442,12 +487,12 @@ export function MemoryViewer({const clickX = event.clientX;if (clickX <= viewport.width * EDGE_NAV_TAP_ZONE_RATIO) {- handlePrevious();+ onPrev();return;}if (clickX >= viewport.width * (1 - EDGE_NAV_TAP_ZONE_RATIO)) {- handleAdvanceOrFinish();+ onNext();return;}@@ -455,7 +500,7 @@ export function MemoryViewer({setPaused(true);}},- [handleAdvanceOrFinish, handlePrevious, paused, viewport.width],+ [onNext, onPrev, paused, viewport.width],);const resolvedMediaAspectRatio = useMemo(() => {@@ -476,30 +521,23 @@ export function MemoryViewer({return undefined;}, [currentFile, mediaAspectRatio]);- const effectiveMediaAspectRatio = finishedPlayback- ? MEMORY_END_CARD_ASPECT_RATIO- : resolvedMediaAspectRatio;- const useMobileVideoSizing = isVideo && !finishedPlayback;const mobileFrameSize = useMemo(() => {const availableWidth = Math.max(220,- viewport.width -- (useMobileVideoSizing ? 32 : MOBILE_MEDIA_HORIZONTAL_INSET_PX),+ viewport.width - (isVideo ? 32 : MOBILE_MEDIA_HORIZONTAL_INSET_PX),);- const maxWidth = useMobileVideoSizing+ const maxWidth = isVideo? Math.min(MOBILE_VIDEO_MAX_WIDTH_PX, availableWidth): availableWidth;const maxHeight = Math.max(180,viewport.height -- (useMobileVideoSizing+ (isVideo? MOBILE_VIDEO_MEDIA_RESERVED_VERTICAL_SPACE_PX: MOBILE_MEDIA_RESERVED_VERTICAL_SPACE_PX),);- const ratio =- effectiveMediaAspectRatio ??- (useMobileVideoSizing ? 16 / 9 : 4 / 3);+ const ratio = resolvedMediaAspectRatio ?? (isVideo ? 16 / 9 : 4 / 3);let width = maxWidth;let height = width / ratio;@@ -510,12 +548,7 @@ export function MemoryViewer({}return { width: Math.round(width), height: Math.round(height) };- }, [- effectiveMediaAspectRatio,- useMobileVideoSizing,- viewport.height,- viewport.width,- ]);+ }, [isVideo, resolvedMediaAspectRatio, viewport.height, viewport.width]);const desktopFrameSize = useMemo(() => {const availableWidth = Math.max(@@ -528,8 +561,8 @@ export function MemoryViewer({);const maxWidth = Math.min(DESKTOP_MEDIA_MAX_WIDTH_PX, availableWidth);const ratio =- typeof effectiveMediaAspectRatio === "number"- ? effectiveMediaAspectRatio+ typeof resolvedMediaAspectRatio === "number"+ ? resolvedMediaAspectRatio: 4 / 3;let width = maxWidth;@@ -541,29 +574,27 @@ export function MemoryViewer({}return { width: Math.round(width), height: Math.round(height) };- }, [effectiveMediaAspectRatio, viewport.height, viewport.width]);+ }, [resolvedMediaAspectRatio, viewport.height, viewport.width]);const mediaFrameStyle = isMobileLayout? {width: `${mobileFrameSize.width}px`,- aspectRatio: `${effectiveMediaAspectRatio ?? (useMobileVideoSizing ? 16 / 9 : 4 / 3)}`,+ aspectRatio: `${resolvedMediaAspectRatio ?? (isVideo ? 16 / 9 : 4 / 3)}`,}: {width: `${desktopFrameSize.width}px`,- aspectRatio: `${effectiveMediaAspectRatio ?? 4 / 3}`,+ aspectRatio: `${resolvedMediaAspectRatio ?? 4 / 3}`,};- const mediaFrameSize = isMobileLayout ? mobileFrameSize : desktopFrameSize;const isProgressPaused =paused || !fileLoaded || (isVideo && !videoDurationKnown);- const showPlaybackOverlay = paused && !finishedPlayback;+ const showPlaybackOverlay = paused;- const header = (+ const sharedHeader = (<SharedMemoryHeadertitle={headerTitle}- date={headerDate}total={files.length}- current={finishedPlayback ? files.length : currentIndex}+ current={currentIndex}paused={isProgressPaused}duration={progressDuration}onComplete={handleAdvanceOrFinish}@@ -571,22 +602,17 @@ export function MemoryViewer({/>);- const joinEnteButton = (- <JoinNowButton- variant="contained"- color="accent"- disableElevation- href="https://ente.com/try"- target="_blank"- rel="noopener"- sx={- isTabletShareLayout- ? compactShareHeaderJoinNowButtonSx- : shareHeaderJoinNowButtonSx- }- >- Join Ente- </JoinNowButton>+ const mobileProgressHeader = (+ <MobileProgressHeader+ title={mobileFooterTitle}+ date={mobileFooterDate}+ total={files.length}+ current={currentIndex}+ paused={isProgressPaused}+ duration={progressDuration}+ onComplete={handleAdvanceOrFinish}+ isVideo={isVideo}+ />);const mediaLayers = (@@ -663,7 +689,30 @@ export function MemoryViewer({}>{isMobileLayout ? (- header+ <MobileTopActions>+ <BrandLink+ href="https://ente.com"+ target="_blank"+ rel="noopener"+ data-memory-control="true"+ >+ <EnteBrandTagImage+ src={ENTE_BRAND_TAG_IMAGE_PATH}+ alt="Ente Photos"+ />+ </BrandLink>+ <MobileHeaderSpacer aria-hidden="true" />+ <MobileJoinNowButton+ variant="contained"+ color="accent"+ disableElevation+ href="https://ente.com/try"+ target="_blank"+ rel="noopener"+ >+ Get Ente Photos+ </MobileJoinNowButton>+ </MobileTopActions>) : (<TopControls><TopLeftBrandLink@@ -678,9 +727,25 @@ export function MemoryViewer({/></TopLeftBrandLink>- {header}-- <TopRightActions>{joinEnteButton}</TopRightActions>+ {sharedHeader}++ <TopRightActions>+ <JoinNowButton+ variant="contained"+ color="accent"+ disableElevation+ href="https://ente.com/try"+ target="_blank"+ rel="noopener"+ sx={+ isTabletShareLayout+ ? compactShareHeaderJoinNowButtonSx+ : undefined+ }+ >+ Get Ente Photos+ </JoinNowButton>+ </TopRightActions></TopControls>)}@@ -692,22 +757,17 @@ export function MemoryViewer({style={mediaFrameStyle}onClick={handleMediaFrameClick}>- {finishedPlayback ? (- <MediaSwitchLayer- phase="in"- style={{ pointerEvents: "auto" }}- >- <MemoryEndCard width={mediaFrameSize.width} />- </MediaSwitchLayer>- ) : (- mediaLayers- )}+ {mediaLayers}{showPlaybackOverlay && (<CenteredPlaybackOverlay><CenteredPlaybackControltype="button"onClick={handlePlaybackOverlayClick}- aria-label="Resume playback"+ aria-label={+ finishedPlayback+ ? "Restart memories"+ : "Resume playback"+ }data-memory-control="true"><CenteredPlaybackGlyph>@@ -719,22 +779,7 @@ export function MemoryViewer({</MediaFrame></PhotoContainer>- {isMobileLayout && (- <ViewerFooterBar style={{ gap: "24px" }}>- <BrandLink- href="https://ente.com"- target="_blank"- rel="noopener"- data-memory-control="true"- >- <EnteBrandTagImage- src={ENTE_BRAND_TAG_IMAGE_PATH}- alt="Ente Photos"- />- </BrandLink>- {joinEnteButton}- </ViewerFooterBar>- )}+ {isMobileLayout && mobileProgressHeader}</ContentContainer></ViewerRoot>);@@ -830,51 +875,65 @@ const HeaderSection = styled("div")({},});-const HeaderMeta = styled("div")({+const MemoryTitle = styled(Typography)({+ color: "rgba(255, 255, 255, 0.84)",+ fontWeight: 600,+ fontSize: "16px",+ lineHeight: 1.15,+ letterSpacing: "-0.01em",+ textAlign: "center",+ whiteSpace: "normal",+ overflowWrap: "anywhere",+ maxWidth: "100%",+ "@media (max-width: 900px)": { fontSize: "15px" },+ "@media (max-width: 700px)": { fontSize: "14px", lineHeight: 1.2 },+});++const MobileTopActions = styled("div")({+ width: "100%",+ display: "grid",+ gridTemplateColumns: "auto minmax(0, 1fr) auto",+ alignItems: "center",+ gap: "12px",+ padding: "0 24px",+ boxSizing: "border-box",+});++const MobileHeaderSpacer = styled("div")({ minWidth: 0 });++const MobileFooterMeta = styled("div")({display: "flex",flexDirection: "column",alignItems: "center",- gap: "6px",+ gap: "5px",width: "100%",- [`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: { gap: "5px" },+ transform: "translateY(-8px)",});-const MemoryDate = styled(Typography)({- color: "rgba(255, 255, 255, 0.72)",- fontWeight: 500,- fontSize: "15px",- lineHeight: 1.2,- letterSpacing: "0.01em",+const MobileFooterPrimaryLine = styled(Typography)({+ color: "rgba(255, 255, 255, 0.9)",+ fontWeight: 600,+ fontSize: "19px",+ lineHeight: 1.08,+ letterSpacing: "-0.01em",textAlign: "center",whiteSpace: "nowrap",maxWidth: "100%",overflow: "hidden",textOverflow: "ellipsis",- "@media (max-width: 700px)": { fontSize: "14px" },- [`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: {- lineHeight: 1.18,- },});-const MemoryTitle = styled(Typography)({- color: "#fff",- fontFamily: "'Outfit Variable', sans-serif",- fontWeight: 800,- fontSize: "28px",- lineHeight: 1.15,+const MobileFooterSecondaryLine = styled(Typography)({+ color: "rgba(255, 255, 255, 0.72)",+ fontWeight: 500,+ fontSize: "14px",+ lineHeight: 1.18,+ letterSpacing: "0.01em",textAlign: "center",- whiteSpace: "normal",- overflowWrap: "anywhere",+ whiteSpace: "nowrap",maxWidth: "100%",- "@media (max-width: 900px)": { fontSize: "24px" },- "@media (max-width: 700px)": { fontSize: "20px", lineHeight: 1.2 },- [`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: {- fontSize: "28px",- lineHeight: 1.08,- whiteSpace: "nowrap",- overflow: "hidden",- textOverflow: "ellipsis",- },+ overflow: "hidden",+ textOverflow: "ellipsis",});const TopLeftBrandLink = styled(BrandLink)({diff --git a/web/apps/memories/src/pages/_app.tsx b/web/apps/memories/src/pages/_app.tsxindex 8dc6c9a3b2..96c0d4e76d 100644--- a/web/apps/memories/src/pages/_app.tsx+++ b/web/apps/memories/src/pages/_app.tsx@@ -1,5 +1,4 @@import "@fontsource-variable/inter";-import "@fontsource-variable/outfit";import "@fontsource/itim";import { CssBaseline, GlobalStyles } from "@mui/material";import { ThemeProvider } from "@mui/material/styles";diff --git a/web/package-lock.json b/web/package-lock.jsonindex aea16a3c12..64a30a2bc8 100644--- a/web/package-lock.json+++ b/web/package-lock.json@@ -236,7 +236,6 @@"apps/memories": {"version": "0.0.0","dependencies": {- "@fontsource-variable/outfit": "5.2.8","@fontsource/itim": "5.2.7","ente-base": "*","ente-gallery": "*",