Skip to content

armgit / ente

Public Imported from GitHub
0

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

update(memories):ui-updated

Aswin Asok42b3e8760bc9
diff --git a/web/apps/memories/src/components/MemoryViewer.tsx b/web/apps/memories/src/components/MemoryViewer.tsx
index 98eee5ac98..e44f6df40e 100644
--- a/web/apps/memories/src/components/MemoryViewer.tsx
+++ b/web/apps/memories/src/components/MemoryViewer.tsx
@@ -33,11 +33,11 @@ import {
MobileJoinNowButton,
PhotoContainer,
readViewport,
- ViewerFooterBar,
ViewerRoot,
} from "./PublicMemoryViewerShared";
const SHARE_COMPACT_LAYOUT_BREAKPOINT_PX = 960;
+const SHARE_TABLET_MEDIA_QUERY = `@media (min-width: ${MOBILE_LAYOUT_BREAKPOINT_PX + 1}px) and (max-width: ${SHARE_COMPACT_LAYOUT_BREAKPOINT_PX - 1}px)`;
const MOBILE_MEDIA_HORIZONTAL_INSET_PX = 8;
const MOBILE_MEDIA_RESERVED_VERTICAL_SPACE_PX = 220;
const MOBILE_VIDEO_MEDIA_RESERVED_VERTICAL_SPACE_PX = 244;
@@ -50,6 +50,14 @@ const DESKTOP_MEDIA_MAX_WIDTH_CSS = `min(${DESKTOP_MEDIA_MAX_WIDTH_PX}px, calc(1
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 compactShareHeaderJoinNowButtonSx = {
+ borderRadius: "14px",
+ fontSize: "15px",
+ lineHeight: 1.1,
+ minHeight: "42px",
+ paddingBlock: "10px",
+ paddingInline: "20px",
+};
interface SharedMemoryHeaderProps {
title: string;
@@ -138,8 +146,9 @@ export function MemoryViewer({
const isVideo = currentFile.metadata.fileType === FileType.video;
const isMobileLayout = viewport.width <= MOBILE_LAYOUT_BREAKPOINT_PX;
- const isCompactShareLayout =
- viewport.width <= SHARE_COMPACT_LAYOUT_BREAKPOINT_PX;
+ const isTabletShareLayout =
+ viewport.width > MOBILE_LAYOUT_BREAKPOINT_PX &&
+ viewport.width < SHARE_COMPACT_LAYOUT_BREAKPOINT_PX;
useEffect(() => {
setPaused(false);
@@ -510,36 +519,37 @@ export function MemoryViewer({
</MobileTopActions>
) : (
<TopControls>
- {!isCompactShareLayout && (
- <TopLeftBrandLink
- href="https://ente.io"
- target="_blank"
- rel="noreferrer"
- data-memory-control="true"
- >
- <EnteBrandTagImage
- src={ENTE_BRAND_TAG_IMAGE_PATH}
- alt="Ente Photos"
- />
- </TopLeftBrandLink>
- )}
+ <TopLeftBrandLink
+ href="https://ente.io"
+ target="_blank"
+ rel="noreferrer"
+ data-memory-control="true"
+ >
+ <EnteBrandTagImage
+ src={ENTE_BRAND_TAG_IMAGE_PATH}
+ alt="Ente Photos"
+ />
+ </TopLeftBrandLink>
{sharedHeader}
- {!isCompactShareLayout && (
- <TopRightActions>
- <JoinNowButton
- variant="contained"
- color="accent"
- disableElevation
- href="https://ente.io/get"
- target="_blank"
- rel="noreferrer"
- >
- Try Ente
- </JoinNowButton>
- </TopRightActions>
- )}
+ <TopRightActions>
+ <JoinNowButton
+ variant="contained"
+ color="accent"
+ disableElevation
+ href="https://ente.io/get"
+ target="_blank"
+ rel="noreferrer"
+ sx={
+ isTabletShareLayout
+ ? compactShareHeaderJoinNowButtonSx
+ : undefined
+ }
+ >
+ Try Ente
+ </JoinNowButton>
+ </TopRightActions>
</TopControls>
)}
@@ -574,32 +584,6 @@ export function MemoryViewer({
</PhotoContainer>
{isMobileLayout && sharedHeader}
-
- {!isMobileLayout && isCompactShareLayout && (
- <ViewerFooterBar>
- <BrandLink
- href="https://ente.io"
- target="_blank"
- rel="noreferrer"
- data-memory-control="true"
- >
- <EnteBrandTagImage
- src={ENTE_BRAND_TAG_IMAGE_PATH}
- alt="Ente Photos"
- />
- </BrandLink>
- <MobileJoinNowButton
- variant="contained"
- color="accent"
- disableElevation
- href="https://ente.io/get"
- target="_blank"
- rel="noreferrer"
- >
- Try Ente
- </MobileJoinNowButton>
- </ViewerFooterBar>
- )}
</ContentContainer>
</ViewerRoot>
);
@@ -675,6 +659,10 @@ const TopControls = styled("div")({
maxWidth: "100%",
boxSizing: "border-box",
"@media (max-width: 900px)": { minHeight: "56px" },
+ [SHARE_TABLET_MEDIA_QUERY]: {
+ minHeight: "56px",
+ paddingInline: "124px",
+ },
});
const HeaderSection = styled("div")({
@@ -686,6 +674,10 @@ const HeaderSection = styled("div")({
gap: "18px",
boxSizing: "border-box",
"@media (max-width: 900px)": { width: "min(100%, 344px)", gap: "14px" },
+ [SHARE_TABLET_MEDIA_QUERY]: {
+ width: "min(100%, 296px)",
+ gap: "12px",
+ },
[`@media (max-width: ${MOBILE_LAYOUT_BREAKPOINT_PX}px)`]: {
width: "100%",
gap: "18px",
@@ -724,6 +716,7 @@ const TopLeftBrandLink = styled(BrandLink)({
transform: "translateY(-50%)",
"& img": { width: "98px" },
"@media (max-width: 900px)": { "& img": { width: "84px" } },
+ [SHARE_TABLET_MEDIA_QUERY]: { "& img": { width: "72px" } },
});
const TopRightActions = styled("div")({
@@ -735,6 +728,7 @@ const TopRightActions = styled("div")({
alignItems: "center",
gap: "16px",
"@media (max-width: 900px)": { gap: "10px" },
+ [SHARE_TABLET_MEDIA_QUERY]: { gap: "8px" },
});
const MediaFrame = styled("div")({
diff --git a/web/apps/memories/src/components/PublicMemoryPageShell.tsx b/web/apps/memories/src/components/PublicMemoryPageShell.tsx
index 006a19f4eb..3008d3a92d 100644
--- a/web/apps/memories/src/components/PublicMemoryPageShell.tsx
+++ b/web/apps/memories/src/components/PublicMemoryPageShell.tsx
@@ -46,6 +46,18 @@ export function PublicMemoryPageShell({ children }: PropsWithChildren) {
);
}
+/**
+ * Shared loading body used before or while a viewer chunk is resolving.
+ * Used by `pages/index.tsx` and composed by `PublicMemoryLoadingState`.
+ */
+export function PublicMemoryLoadingContent() {
+ return (
+ <Stack100vhCenter sx={{ minHeight: "100dvh" }}>
+ <CircularProgress sx={{ color: "#08c225" }} size={32} />
+ </Stack100vhCenter>
+ );
+}
+
/**
* Full-screen loading state shown while `usePublicMemoryPage` is resolving the share.
* Used by `pages/index.tsx`.
@@ -53,9 +65,7 @@ export function PublicMemoryPageShell({ children }: PropsWithChildren) {
export function PublicMemoryLoadingState() {
return (
<PublicMemoryPageShell>
- <Stack100vhCenter sx={{ minHeight: "100dvh" }}>
- <CircularProgress sx={{ color: "#08c225" }} size={32} />
- </Stack100vhCenter>
+ <PublicMemoryLoadingContent />
</PublicMemoryPageShell>
);
}
diff --git a/web/apps/memories/src/pages/index.tsx b/web/apps/memories/src/pages/index.tsx
index e032be71fd..f54609a3b2 100644
--- a/web/apps/memories/src/pages/index.tsx
+++ b/web/apps/memories/src/pages/index.tsx
@@ -1,8 +1,8 @@
-import { LaneMemoryViewer } from "../components/LaneMemoryViewer";
-import { MemoryViewer } from "../components/MemoryViewer";
+import dynamic from "next/dynamic";
import {
PublicMemoryEmptyState,
PublicMemoryErrorState,
+ PublicMemoryLoadingContent,
PublicMemoryLoadingState,
PublicMemoryPageShell,
} from "../components/PublicMemoryPageShell";
@@ -12,6 +12,30 @@ import type {
} from "../components/PublicMemoryViewerShared";
import { usePublicMemoryPage } from "../hooks/usePublicMemoryPage";
+function ViewerChunkLoadingFallback() {
+ return <PublicMemoryLoadingContent />;
+}
+
+const LaneMemoryViewer = dynamic<LaneMemoryViewerProps>(
+ () =>
+ import("../components/LaneMemoryViewer").then(
+ (module) => module.LaneMemoryViewer,
+ ),
+ {
+ loading: ViewerChunkLoadingFallback,
+ },
+);
+
+const MemoryViewer = dynamic<MemoryViewerProps>(
+ () =>
+ import("../components/MemoryViewer").then(
+ (module) => module.MemoryViewer,
+ ),
+ {
+ loading: ViewerChunkLoadingFallback,
+ },
+);
+
/**
* Index page that handles both root redirect and memory share links
*