π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refine Space navigation, captions, and viewer controls
Anand Baburajan18fce344c720
diff --git a/web/apps/space/src/components/AppNavigation.tsx b/web/apps/space/src/components/AppNavigation.tsxindex 3d2412fecb..6307c035a6 100644--- a/web/apps/space/src/components/AppNavigation.tsx+++ b/web/apps/space/src/components/AppNavigation.tsx@@ -107,25 +107,25 @@ export const SpaceAppLayout = ({ children }: { children: React.ReactNode }) => {}, [showNavigation]);const destinations = [- { label: "Home", href: spaceRoutes.home, icon: Home01Icon, size: 25 },+ { label: "Home", href: spaceRoutes.home, icon: Home01Icon, size: 23 },{label: "Messages",href: spaceRoutes.messages,icon: BubbleChatIcon,- size: 25,+ size: 23,},{ label: "Post", icon: PlusSignSquareIcon, href: undefined, size: 25 },{label: "Friends",href: spaceRoutes.friends,icon: UserMultiple02Icon,- size: 23,+ size: 22,},{label: "Profile",href: spaceRoutes.profile,icon: UserCircleIcon,- size: 24,+ size: 22,},];@@ -256,9 +256,8 @@ export const SpaceAppLayout = ({ children }: { children: React.ReactNode }) => {<HugeiconsIconicon={icon}size={size}- strokeWidth={- selected ? 2.2 : 1.8- }+ strokeWidth={1.8}+ absoluteStrokeWidth/>{label == "Messages" &&unreadStatus.messagesUnread && (@@ -266,14 +265,14 @@ export const SpaceAppLayout = ({ children }: { children: React.ReactNode }) => {aria-hiddensx={{bgcolor: "#F63A3A",- border: `2px solid ${spaceAppBackgroundColor}`,+ border: `2.5px solid ${spaceAppBackgroundColor}`,borderRadius: "50%",- height: 11,+ height: 11.5,position:"absolute",- right: 0,- top: 0,- width: 11,+ right: "-0.75px",+ top: "-0.75px",+ width: 11.5,}}/>)}diff --git a/web/apps/space/src/components/CaptionText.tsx b/web/apps/space/src/components/CaptionText.tsxindex c460b9b382..0c3f47d3a3 100644--- a/web/apps/space/src/components/CaptionText.tsx+++ b/web/apps/space/src/components/CaptionText.tsx@@ -19,7 +19,8 @@ const captionSegmenter =export const SpaceCaptionText: React.FC<{caption: string;lineClamp?: number;-}> = ({ caption, lineClamp }) => {+ onTruncationChange?: (isTruncated: boolean) => void;+}> = ({ caption, lineClamp, onTruncationChange }) => {const measureRef = React.useRef<HTMLSpanElement>(null);const [clampedCaption, setClampedCaption] = React.useState(caption);@@ -34,6 +35,7 @@ export const SpaceCaptionText: React.FC<{text.textContent = caption;if (measure.getBoundingClientRect().height <= maxHeight) {setClampedCaption(caption);+ onTruncationChange?.(false);return;}@@ -58,6 +60,7 @@ export const SpaceCaptionText: React.FC<{}text.textContent = caption;setClampedCaption(truncated(start));+ onTruncationChange?.(true);};updateCaption();@@ -68,7 +71,7 @@ export const SpaceCaptionText: React.FC<{observer.disconnect();document.fonts.removeEventListener("loadingdone", updateCaption);};- }, [caption, lineClamp]);+ }, [caption, lineClamp, onTruncationChange]);const displayCaption = lineClamp ? clampedCaption : caption;const layerSx = {diff --git a/web/apps/space/src/components/FileViewer.tsx b/web/apps/space/src/components/FileViewer.tsxindex e8148dfbf9..ee23d8dbdd 100644--- a/web/apps/space/src/components/FileViewer.tsx+++ b/web/apps/space/src/components/FileViewer.tsx@@ -11,7 +11,7 @@ import {Tick02Icon,} from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";-import { Box, Menu, MenuItem } from "@mui/material";+import { Box, Fade, Menu, MenuItem, Modal } from "@mui/material";import { keyframes } from "@mui/material/styles";import { visuallyHidden } from "@mui/utils";import {@@ -19,6 +19,7 @@ import {type SpaceActionPhase,} from "components/ActionFeedback";import { SpaceAvatarImage } from "components/AvatarImage";+import { SpaceBottomSheetTransition } from "components/BottomSheetTransition";import { SpaceCaptionText } from "components/CaptionText";import { ConfirmationActionSheet } from "components/ConfirmationActionSheet";import { spacePostLikePopDurationMs } from "components/post-like-animation";@@ -71,6 +72,7 @@ const viewerHeaderAvatarSize = 32;const draftPostExitDurationMs = 320;const keyboardInsetThresholdPx = 80;const keyboardDismissMaxDurationMs = 500;+const postTransitionDurationMs = 300;interface ViewerViewportSize {x: number;@@ -156,6 +158,7 @@ interface SpaceFileViewerProps {onLoadPhoto?: SpacePostAssetURLLoader;isDraftPostPreviewPending?: boolean;onClose: () => void;+ onNavigatePost?: (direction: -1 | 1) => boolean;onAddDraftPhoto?: () => void;onEditDraftPhoto?: () => void;onDeletePost?: () => Promise<void> | void;@@ -295,105 +298,65 @@ const viewerCaptionTextSx = {const SpaceViewerPhotoOverlay: React.FC<{caption: string;+ onOpenCaption: () => void;photoIndex: number;photoCount: number;-}> = ({ caption, photoIndex, photoCount }) => {- const bubbleRef = React.useRef<HTMLParagraphElement | null>(null);- const [isLongCaption, setIsLongCaption] = React.useState(false);-- React.useLayoutEffect(() => {- const bubble = bubbleRef.current;- if (!bubble) return;-- const updateLayout = () => {- const lineHeight = parseFloat(getComputedStyle(bubble).lineHeight);- setIsLongCaption(- bubble.getBoundingClientRect().height > lineHeight * 4,- );- };- updateLayout();- const observer = new ResizeObserver(updateLayout);- observer.observe(bubble);- return () => observer.disconnect();- }, [caption]);+}> = ({ caption, onOpenCaption, photoIndex, photoCount }) => {+ const [isCaptionTruncated, setIsCaptionTruncated] = React.useState(false);return (- <>- <Box- aria-hidden={isLongCaption || undefined}- data-space-viewer-chrome="true"- sx={{- alignItems: "center",- bottom: "14%",- display: "flex",- flexDirection: "column",- gap: "16px",- left: "50%",- pointerEvents: "none",- position: "fixed",- transform: "translateX(-50%)",- visibility: isLongCaption ? "hidden" : "visible",- width: "78vw",- zIndex: 2,- }}- >- <SpacePostPhotosDots index={photoIndex} count={photoCount} />+ <Box+ data-space-viewer-chrome="true"+ sx={{+ alignItems: "center",+ bottom: "14%",+ display: "flex",+ flexDirection: "column",+ gap: "16px",+ left: "50%",+ pointerEvents: "none",+ position: "fixed",+ transform: "translateX(-50%)",+ width: "78vw",+ zIndex: 2,+ }}+ >+ <SpacePostPhotosDots index={photoIndex} count={photoCount} />+ {caption && (<Box- ref={bubbleRef}- component="p"- title={caption}+ component={isCaptionTruncated ? "button" : "div"}+ type={isCaptionTruncated ? "button" : undefined}+ aria-label={+ isCaptionTruncated ? "Read full caption" : undefined+ }+ aria-haspopup={isCaptionTruncated ? "dialog" : undefined}+ onClick={isCaptionTruncated ? onOpenCaption : undefined}sx={{...viewerCaptionTextSx,- display: caption ? "block" : "none",+ appearance: "none",+ bgcolor: "transparent",+ border: 0,+ cursor: isCaptionTruncated ? "pointer" : undefined,m: 0,minWidth: 0,overflowWrap: "break-word",+ p: 0,+ pointerEvents: isCaptionTruncated ? "auto" : "none",width: "100%",+ "&:focus-visible": {+ outline: `2px solid ${green}`,+ outlineOffset: 4,+ },}}>- <SpaceCaptionText caption={caption} />- </Box>- </Box>- {isLongCaption && (- <Box- sx={{- display: "flex",- flexDirection: "column",- gap: "16px",- }}- >- <SpacePostPhotosDots- index={photoIndex}- count={photoCount}+ <SpaceCaptionText+ caption={caption}+ lineClamp={4}+ onTruncationChange={setIsCaptionTruncated}/>- <Box- role="region"- aria-label="Caption"- tabIndex={0}- sx={{- ...viewerCaptionTextSx,- bgcolor: "rgba(32, 32, 32, 0.85)",- borderRadius: "16px",- boxSizing: "border-box",- maxHeight: "33svh",- overflowWrap: "anywhere",- overflowY: "auto",- overscrollBehaviorY: "contain",- p: "14px 16px",- scrollbarWidth: "thin",- textAlign: "left",- textWrap: "wrap",- "&:focus-visible": {- outline: `2px solid ${green}`,- outlineOffset: 2,- },- }}- >- {caption}- </Box></Box>)}- </>+ </Box>);};@@ -404,6 +367,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({focusReplyOnOpen = false,isDraftPostPreviewPending = false,onClose,+ onNavigatePost,onAddDraftPhoto,onEditDraftPhoto,onDeletePost,@@ -494,10 +458,17 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({videoLoaderRef.current = onLoadPhoto;const viewerPhotosRef = React.useRef(viewerPhotos);const onCloseRef = React.useRef(onClose);+ const onNavigatePostRef = React.useRef(onNavigatePost);+ const postAnimationsRef = React.useRef<Animation[]>([]);+ const postSnapshotRef = React.useRef<HTMLElement | undefined>(undefined);+ const postNavigationRef = React.useRef<+ { offset: number; direction: -1 | 1 } | undefined+ >(undefined);const onPhotoIndexChangeRef = React.useRef(onPhotoIndexChange);const initialPhotoIndexRef = React.useRef(activePhotoIndex);const fallbackPhotoRef = React.useRef(activePhoto);const pswpRef = React.useRef<PhotoSwipe | undefined>(undefined);+ const isSyncingPhotosRef = React.useRef(false);const videoContentsRef = React.useRef(new Map<object, ReturnType<typeof createSpaceVideoContent>>(),);@@ -505,6 +476,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({closeOnSwipePastEndRef.current = closeOnSwipePastEnd;viewerPhotosRef.current = viewerPhotos;onCloseRef.current = onClose;+ onNavigatePostRef.current = onNavigatePost;onPhotoIndexChangeRef.current = onPhotoIndexChange;fallbackPhotoRef.current = activePhoto;const viewerPhotosContentKey = viewerPhotos@@ -521,6 +493,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({activePhoto.caption ?? "",);const [isCaptionEditing, setIsCaptionEditing] = React.useState(false);+ const [isCaptionDialogOpen, setIsCaptionDialogOpen] = React.useState(false);const [captionUpdateActionPhase, setCaptionUpdateActionPhase] =React.useState<SpaceActionPhase | null>(null);const [hasCaptionUpdateError, setHasCaptionUpdateError] =@@ -562,6 +535,9 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({const dateLabel = formatSpaceDate(activePhoto.timestampMs);const displayCaption = isDraftPost ? "" : caption.trim();const hasDisplayCaption = displayCaption.length > 0;+ const CaptionTransition = isDesktopViewer+ ? Fade+ : SpaceBottomSheetTransition;const viewerRootRef = React.useRef<HTMLDivElement | null>(null);const stableViewportSizeRef = React.useRef<ViewerViewportSize>(currentViewerViewportSize(null),@@ -618,6 +594,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({isDeleteExit ||isDraftPostExit ||isCaptionEditing ||+ isCaptionDialogOpen ||isReplyActionRunning ||isDraftPostActionRunning;const isDismissBlockedRef = React.useRef(false);@@ -639,6 +616,25 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({return nextSize;}, []);+ const animatePostOffset = React.useCallback((from: number, to: number) => {+ const root = viewerRootRef.current!;+ const options = {+ duration: window.matchMedia("(prefers-reduced-motion: reduce)")+ .matches+ ? 0+ : postTransitionDurationMs,+ easing: "cubic-bezier(0.22, 1, 0.36, 1)",+ };+ root.style.setProperty("--space-viewer-post-offset", `${to}px`);+ postAnimationsRef.current = [+ pswpRef.current!.element!.animate(+ [{ translate: `0 ${from}px` }, { translate: `0 ${to}px` }],+ options,+ ),+ ];+ return options;+ }, []);+const requestAddFriendForPostAction = (intent: SpaceInviteIntent) => {if (!onAddFriendForPostAction) return;setAddFriendIntent(intent);@@ -990,6 +986,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({setCaptionUpdateActionPhase(null);setHasCaptionUpdateError(false);setIsCaptionEditing(false);+ setIsCaptionDialogOpen(false);}, [activePostKey]);React.useLayoutEffect(() => {@@ -1062,10 +1059,12 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({return () => window.clearTimeout(timer);}, [photoRetryAt]);- React.useEffect(() => {+ React.useLayoutEffect(() => {const pswp = pswpRef.current;if (!pswp) return;+ isSyncingPhotosRef.current = true;+ if (pswp.currIndex != activePhotoIndex) pswp.goTo(activePhotoIndex);pswp.options.allowPanToNext = viewerPhotosRef.current.length > 1;const contentKeys = viewerPhotosRef.current.map(viewerPhotoContentKey);const previousKeys = displayedContentKeysRef.current;@@ -1075,13 +1074,33 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({pswp.refreshSlideContent(index);}});- }, [viewerPhotosContentKey]);+ isSyncingPhotosRef.current = false;+ }, [activePhotoIndex, viewerPhotosContentKey]);- React.useEffect(() => {- const pswp = pswpRef.current;- if (pswp && pswp.currIndex != activePhotoIndex)- pswp.goTo(activePhotoIndex);- }, [activePhotoIndex]);+ React.useLayoutEffect(() => {+ const navigation = postNavigationRef.current;+ const snapshot = postSnapshotRef.current;+ if (!navigation || !snapshot) return;+ postNavigationRef.current = undefined;+ const height = viewerViewportSize().y;+ const options = animatePostOffset(+ navigation.direction * height + navigation.offset,+ 0,+ );+ const animation = snapshot.animate(+ [+ { translate: `0 ${navigation.offset}px` },+ { translate: `0 ${-navigation.direction * height}px` },+ ],+ options,+ );+ postAnimationsRef.current.push(animation);+ animation.onfinish = () => {+ snapshot.remove();+ postSnapshotRef.current = undefined;+ postAnimationsRef.current = [];+ };+ }, [activePostKey, animatePostOffset, viewerViewportSize]);React.useEffect(() => {pswpRef.current?.updateSize(true);@@ -1168,7 +1187,16 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({let disposed = false;let closedByReact = false;let pswp: PhotoSwipe | undefined;- let edgeSwipeStart: { x: number; y: number } | undefined;+ let swipeStart:+ | { x: number; y: number; photoIndex: number }+ | undefined;+ let postDragOffset = 0;++ const resetPostDrag = () => {+ if (!postDragOffset) return;+ animatePostOffset(postDragOffset, 0);+ postDragOffset = 0;+ };void import("photoswipe").then(({ default: PhotoSwipeClass }) => {if (disposed || !viewerRootRef.current) return;@@ -1283,7 +1311,18 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({if (!closedByReact) onCloseRef.current();});pswp.on("verticalDrag", (event) => {- if (isDismissBlockedRef.current) event.preventDefault();+ if (isDismissBlockedRef.current) {+ event.preventDefault();+ return;+ }+ if (!onNavigatePostRef.current) return;+ event.preventDefault();+ if (!swipeStart) return;+ postDragOffset = pswp!.gestures.p1.y - pswp!.gestures.startP1.y;+ root.style.setProperty(+ "--space-viewer-post-offset",+ `${postDragOffset}px`,+ );});pswp.on("zoomPanUpdate", () => {root.style.setProperty(@@ -1295,7 +1334,8 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({const nextIndex = pswp?.currIndex;if (nextIndex != undefined) {setLocalPhotoIndex(nextIndex);- onPhotoIndexChangeRef.current?.(nextIndex);+ if (!isSyncingPhotosRef.current)+ onPhotoIndexChangeRef.current?.(nextIndex);}});pswp.on("keydown", (event) => {@@ -1307,41 +1347,93 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({}});pswp.on("pointerDown", (event) => {- if (isSwipeBlockedRef.current) {+ if (+ isSwipeBlockedRef.current ||+ postAnimationsRef.current.some(+ (animation) => animation.playState == "running",+ )+ ) {event.preventDefault();return;}- if (edgeSwipeStart) {- edgeSwipeStart = undefined;+ if (swipeStart) {+ swipeStart = undefined;+ resetPostDrag();return;}if (- !closeOnSwipePastEndRef.current ||+ (!closeOnSwipePastEndRef.current &&+ !onNavigatePostRef.current) ||isDismissBlockedRef.current ||- pswp!.currIndex != viewerPhotosRef.current.length - 1 ||+ viewerSwipeStartsOnInteractiveTarget(+ event.originalEvent.target,+ ) ||pswp!.currSlide?.isPannable())return;- edgeSwipeStart = viewerTouchPoint(event.originalEvent);+ const point = viewerTouchPoint(event.originalEvent);+ if (point)+ swipeStart = { ...point, photoIndex: pswp!.currIndex };});pswp.on("pointerUp", ({ originalEvent }) => {- const start = edgeSwipeStart;- edgeSwipeStart = undefined;+ const start = swipeStart;+ swipeStart = undefined;if (!start ||originalEvent.type.endsWith("cancel") ||isDismissBlockedRef.current ||pswp!.gestures.isMultitouch ||pswp!.currSlide?.isPannable()- )+ ) {+ resetPostDrag();return;+ }const end = viewerTouchPoint(originalEvent);if (!end) return;const dx = end.x - start.x;const dy = end.y - start.y;- if (dx < -72 && Math.abs(dx) > Math.abs(dy) * 1.5) {+ if (+ onNavigatePostRef.current &&+ Math.abs(dy) > 72 &&+ Math.abs(dy) > Math.abs(dx) * 1.5+ ) {+ const direction = dy < 0 ? 1 : -1;+ const snapshot = pswp!.element!.cloneNode(+ true,+ ) as HTMLElement;+ snapshot.setAttribute("aria-hidden", "true");+ snapshot.setAttribute(+ "data-space-viewer-post-snapshot",+ "true",+ );+ snapshot.inert = true;+ snapshot.style.pointerEvents = "none";+ snapshot.style.zIndex = "1";+ root.append(snapshot);+ postSnapshotRef.current = snapshot;+ postNavigationRef.current = {+ offset: postDragOffset,+ direction,+ };+ if (onNavigatePostRef.current(direction)) {+ postDragOffset = 0;+ return;+ }+ snapshot.remove();+ postSnapshotRef.current = undefined;+ postNavigationRef.current = undefined;+ } else if (+ closeOnSwipePastEndRef.current &&+ Math.abs(dx) > 72 &&+ Math.abs(dx) > Math.abs(dy) * 1.5 &&+ ((dx < 0 &&+ start.photoIndex ==+ viewerPhotosRef.current.length - 1) ||+ (dx > 0 && start.photoIndex == 0))+ ) {onCloseRef.current();}+ resetPostDrag();});pswp.init();});@@ -1351,9 +1443,14 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({closedByReact = true;pswpRef.current = undefined;pswp?.destroy();+ postAnimationsRef.current.forEach((animation) =>+ animation.cancel(),+ );+ postSnapshotRef.current?.remove();root.style.removeProperty("--space-viewer-bg-opacity");+ root.style.removeProperty("--space-viewer-post-offset");};- }, [isDraftPost, viewerViewportSize]);+ }, [animatePostOffset, isDraftPost, viewerViewportSize]);React.useEffect(() => {if (typeof document == "undefined") return;@@ -1370,6 +1467,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({if (addFriendSheetOpen ||deleteSheetOpen ||+ isCaptionDialogOpen ||isDraftPostExit ||isDraftPostActionRunning)@@ -1392,6 +1490,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({deleteSheetOpen,isDraftPostExit,isCaptionEditing,+ isCaptionDialogOpen,isCaptionUpdateActionRunning,]);@@ -1429,6 +1528,11 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({transition: `opacity ${draftPostExitDurationMs}ms cubic-bezier(0.22, 1, 0.36, 1)`,width: "100%",zIndex: 1300,+ "& > .pswp:not([data-space-viewer-post-snapshot])": {+ translate: onNavigatePost+ ? "0 var(--space-viewer-post-offset, 0px)"+ : undefined,+ },"& .space-photo-placeholder": {alignItems: "center",color: spaceTextMuted,@@ -1471,7 +1575,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({minHeight: viewerHeaderHeight,position: "relative",pl: "16px",- pr: "8px",+ pr: "4px",width: "100%",zIndex: 2,}}@@ -1624,23 +1728,13 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({onClick={(event) =>setActionsAnchor(event.currentTarget)}- sx={draftHeaderButtonSx}+ sx={{ ...draftHeaderButtonSx, color: "#C0C0C0" }}>- <Box- component="span"- sx={{- ...draftHeaderButtonContentSx,- width: 32,- p: 0,- justifyContent: "center",- }}- >- <HugeiconsIcon- icon={MoreHorizontalIcon}- size={20}- strokeWidth={1.8}- />- </Box>+ <HugeiconsIcon+ icon={MoreHorizontalIcon}+ size={20}+ strokeWidth={1.8}+ /></Box>)}{isDraftPost && onAddDraftPhoto && (@@ -1683,7 +1777,10 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({);onEditDraftPhoto();}}- sx={draftHeaderButtonSx}+ sx={[+ draftHeaderButtonSx,+ { "&:disabled": { opacity: 1 } },+ ]}><Boxcomponent="span"@@ -1708,23 +1805,13 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({}disabled={isDraftPostActionRunning}onClick={closeViewer}- sx={draftHeaderButtonSx}+ sx={{ ...draftHeaderButtonSx, color: "#C0C0C0" }}>- <Box- component="span"- sx={{- ...draftHeaderButtonContentSx,- width: 32,- p: 0,- justifyContent: "center",- }}- >- <HugeiconsIcon- icon={Cancel01Icon}- size={20}- strokeWidth={1.8}- />- </Box>+ <HugeiconsIcon+ icon={Cancel01Icon}+ size={20}+ strokeWidth={1.8}+ /></Box></Box>{canManagePost && (@@ -2348,6 +2435,9 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({<SpaceViewerPhotoOverlaykey={activePostKey}caption={displayCaption}+ onOpenCaption={() =>+ setIsCaptionDialogOpen(true)+ }photoIndex={postPhotoIndex}photoCount={postPhotoCount}/>@@ -2395,6 +2485,71 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({)}</Box>)}+ <Modal+ open={isCaptionDialogOpen}+ onClose={() => setIsCaptionDialogOpen(false)}+ closeAfterTransition+ disableAutoFocus+ sx={{+ alignItems: "center",+ boxSizing: "border-box",+ display: "flex",+ flexDirection: "column",+ overflowY: "auto",+ overscrollBehaviorY: "contain",+ pt: "max(24px, env(safe-area-inset-top))",+ zIndex: 1500,+ "@media (min-width: 600px)": { p: "24px" },+ }}+ slotProps={{+ backdrop: { sx: { bgcolor: "rgba(0, 0, 0, 0.64)" } },+ }}+ >+ <CaptionTransition+ in={isCaptionDialogOpen}+ onEntered={(node) => node.focus({ preventScroll: true })}+ >+ <Box+ role="dialog"+ aria-label="Full caption"+ aria-modal="true"+ tabIndex={-1}+ sx={{+ bgcolor: viewerBackground,+ border: "1px solid rgba(255, 255, 255, 0.1)",+ borderBottom: 0,+ borderRadius: "24px 24px 0 0",+ boxShadow: "0 16px 48px rgba(0, 0, 0, 0.28)",+ boxSizing: "border-box",+ flexShrink: 0,+ mt: "auto",+ outline: "none",+ p: "24px 24px max(24px, env(safe-area-inset-bottom))",+ width: "100%",+ "@media (min-width: 600px)": {+ borderBottom:+ "1px solid rgba(255, 255, 255, 0.1)",+ borderRadius: "18px",+ maxWidth: 480,+ mb: "auto",+ p: "24px",+ },+ }}+ >+ <Box+ sx={{+ ...viewerCaptionTextSx,+ color: "#D0D0D0",+ overflowWrap: "anywhere",+ textAlign: "left",+ textWrap: "wrap",+ }}+ >+ {displayCaption}+ </Box>+ </Box>+ </CaptionTransition>+ </Modal>{canDeletePost && (<ConfirmationActionSheetopen={deleteSheetOpen}diff --git a/web/apps/space/src/components/HomeHeader.tsx b/web/apps/space/src/components/HomeHeader.tsxindex 2e43a19ff9..5147a8e51f 100644--- a/web/apps/space/src/components/HomeHeader.tsx+++ b/web/apps/space/src/components/HomeHeader.tsx@@ -81,7 +81,12 @@ export const SpaceHomeHeader: React.FC = () => {onClick={() => void router.push(spaceRoutes.settings)}sx={{ ...actionSx, justifyContent: "flex-start" }}>- <HugeiconsIcon icon={Menu01Icon} size={22} strokeWidth={2.4} />+ <HugeiconsIcon+ icon={Menu01Icon}+ size={23}+ strokeWidth={1.8}+ absoluteStrokeWidth+ /></Box><Boxcomponent="img"@@ -109,28 +114,29 @@ export const SpaceHomeHeader: React.FC = () => {component="span"sx={{display: "flex",- height: 25,+ height: 23,position: "relative",- width: 25,+ width: 23,}}><HugeiconsIconicon={Notification01Icon}- size={25}+ size={23}strokeWidth={1.8}+ absoluteStrokeWidth/>{notificationsUnread && (<Boxaria-hiddensx={{bgcolor: "#F63A3A",- border: `2px solid ${spaceAppBackgroundColor}`,+ border: `2.5px solid ${spaceAppBackgroundColor}`,borderRadius: "50%",- height: 11,+ height: 11.5,position: "absolute",- right: 0,- top: 0,- width: 11,+ right: "-0.75px",+ top: "-0.75px",+ width: 11.5,}}/>)}diff --git a/web/apps/space/src/components/PostPhotoEditor.tsx b/web/apps/space/src/components/PostPhotoEditor.tsxindex 4cd4a0122f..e725d7ce82 100644--- a/web/apps/space/src/components/PostPhotoEditor.tsx+++ b/web/apps/space/src/components/PostPhotoEditor.tsx@@ -16,7 +16,6 @@ import log from "ente-base/log";import { useBrowserBackClose } from "hooks/use-browser-back-close";import React from "react";import {- spaceControlBackground,spaceControlBackgroundHover,spaceSurface,spaceText,@@ -258,31 +257,18 @@ export const SpacePostPhotoEditor: React.FC<{onClick={onClose}sx={{...buttonSx,+ color: "#C0C0C0",justifySelf: "start",width: 44,- ml: "-8px",+ ml: "-12px",p: 0,}}>- <Box- component="span"- sx={{- alignItems: "center",- bgcolor: spaceControlBackground,- borderRadius: "50%",- color: "#E4E4E4",- display: "flex",- height: 32,- justifyContent: "center",- width: 32,- }}- >- <HugeiconsIcon- icon={Cancel01Icon}- size={20}- strokeWidth={1.8}- />- </Box>+ <HugeiconsIcon+ icon={Cancel01Icon}+ size={20}+ strokeWidth={1.8}+ /></Box><Boxid="space-photo-editor-title"diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsxindex b8e8cb80a7..93ef5e3684 100644--- a/web/apps/space/src/screens/HomeScreen.tsx+++ b/web/apps/space/src/screens/HomeScreen.tsx@@ -1897,6 +1897,20 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({);const hasFeedItems =latestFeedEntries.length > 0 || gridFeedItems.length > 0;+ const viewerPosts = [+ ...latestFeedEntries.flatMap((entry) =>+ entry.kind == "remote"+ ? [entry.item]+ : entry.item.status == "posted" || entry.item.status == "ready"+ ? [entry.item.post]+ : [],+ ),+ ...gridFeedItems,+ ].filter(+ (item) =>+ !item.isUnavailable &&+ !unavailableFeedPostsByKey[feedPostImageCacheKey(item)],+ );const isEmptyFeedLoading = !hasFeedItems && isFeedLoading;const showFeedCards = hasFeedItems;const isInstallPromptEnabled =@@ -2037,6 +2051,42 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({},[loadedFeedAvatarURLFor, onLoadPostAvatar],);+ const navigatePost = (direction: -1 | 1) => {+ const postIndex = viewerPosts.findIndex(+ (post) => post.postId == selectedViewer?.photo.postId,+ );+ const post = viewerPosts[postIndex + direction];+ if (!post) return false;+ const photo = viewerPhotosFromPost({+ ...post,+ avatarUrl: loadedFeedAvatarURLFor(post),+ })[0]!;+ openFeedPhoto(post, {+ ...photo,+ imageUrl:+ loadedFeedImageURLFor({+ ...spacePostPhotos(post)[0]!,+ postId: post.postId,+ spaceId: post.spaceId,+ }) ?? "",+ });+ setFeedPhotoIndices((current) => ({ ...current, [post.postId]: 0 }));+ void loadFeedPostAvatar(post).then((avatarUrl) => {+ setSelectedViewer((current) =>+ current?.photo.postId == post.postId+ ? {+ ...current,+ photo: { ...current.photo, avatarUrl },+ photos: current.photos.map((photo) => ({+ ...photo,+ avatarUrl,+ })),+ }+ : current,+ );+ });+ return true;+ };const feedItemFor = (item: SpacePost,key: React.Key,@@ -2583,6 +2633,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({onLoadPhoto={onLoadPostImage}postActionMode={selectedViewer.postActionMode}onClose={closeSelectedPhoto}+ onNavigatePost={navigatePost}onOpenProfile={selectedPhotoIsOwn && onOpenProfile? () => {diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsxindex e247626ad3..21aced2fb1 100644--- a/web/apps/space/src/screens/ProfileScreen.tsx+++ b/web/apps/space/src/screens/ProfileScreen.tsx@@ -521,7 +521,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({[loadedPhotoDimensionsByID],);- const profileViewerPhotos = viewerPostItems.flatMap((item) =>+ const profileViewerPhotos = viewerPostItems.map((item) =>viewerPhotosFromPost({...item,...dimensionsForPost(item),@@ -530,13 +530,29 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({name: displayName,}),);+ const selectedPostIndex = selectedPost+ ? viewerPostIndexByID.get(selectedPost.id)+ : undefined;+ const selectedPostPhotos =+ selectedPostIndex == undefined+ ? undefined+ : profileViewerPhotos[selectedPostIndex];const handleSelectedPostIndexChange = (photoIndex: number) => {- const photo = profileViewerPhotos[photoIndex];- if (!photo) return;- const item = viewerPostItems.find(- (item) => item.postId == photo.postId,- );- if (item) setSelectedPost({ id: item.id, photo, photoIndex });+ const photo = selectedPostPhotos?.[photoIndex];+ if (photo && selectedPost)+ setSelectedPost({ ...selectedPost, photo, photoIndex });+ };+ const navigatePost = (direction: -1 | 1) => {+ if (selectedPostIndex == undefined) return false;+ const postIndex = selectedPostIndex + direction;+ const item = viewerPostItems[postIndex];+ if (!item) return false;+ setSelectedPost({+ id: item.id,+ photo: profileViewerPhotos[postIndex]![0]!,+ photoIndex: 0,+ });+ return true;};const shareInvite = async () => {@@ -593,14 +609,11 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({onOpen={(openedImageUrl) => {const postIndex = viewerPostIndexByID.get(item.id);if (postIndex == undefined) return;- const photoIndex = profileViewerPhotos.findIndex(- (photo) => photo.postId == item.postId,- );setSelectedPost({id: item.id,- photoIndex,+ photoIndex: 0,photo: {- ...profileViewerPhotos[photoIndex]!,+ ...profileViewerPhotos[postIndex]![0]!,imageUrl: openedImageUrl,},});@@ -1497,13 +1510,15 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({</Box>{selectedPost && (<SpaceFileViewer+ closeOnSwipePastEndphoto={selectedPost.photo}- photos={profileViewerPhotos}+ photos={selectedPostPhotos}photoIndex={selectedPost.photoIndex}onPhotoIndexChange={handleSelectedPostIndexChange}onLoadPhoto={onLoadPostImage}postActionMode={selectedPostActionMode}onClose={closeSelectedPost}+ onNavigatePost={navigatePost}onAddFriendForPostAction={isPublicProfile? onAddFriendForPostActiondiff --git a/web/apps/space/src/screens/SettingsScreen.tsx b/web/apps/space/src/screens/SettingsScreen.tsxindex c250a8f146..5102c02178 100644--- a/web/apps/space/src/screens/SettingsScreen.tsx+++ b/web/apps/space/src/screens/SettingsScreen.tsx@@ -46,38 +46,6 @@ const dangerColor = "#F63A3A";const iconMuted = spaceTextMuted;const textLight = spaceTextMuted;const supportMailURL = "mailto:[email protected]";-const spaceLinks = [- {- label: "Discord",- src: "/images/discord.svg",- url: "https://ente.com/discord",- },- {- label: "YouTube",- src: "/images/youtube.svg",- url: "https://www.youtube.com/@entestudio",- },- {- label: "GitHub",- src: "/images/github.svg",- url: "https://github.com/ente-io/ente",- },- {- label: "X",- src: "/images/new-twitter.svg",- url: "https://twitter.com/enteio",- },- {- label: "Mastodon",- src: "/images/mastodon.svg",- url: "https://fosstodon.org/@ente",- },- {- label: "Reddit",- src: "/images/reddit.svg",- url: "https://reddit.com/r/enteio",- },-] as const;interface SettingsScreenProps {onLogout: () => Promise<void>;@@ -97,12 +65,6 @@ interface SettingsRowProps {toggleState?: boolean | null;}-interface SpaceIconProps {- label: string;- src: string;- url: string;-}-interface ChangeNameSettingsScreenProps {errorMessage?: string;initialName: string;@@ -289,44 +251,6 @@ const SettingsRow: React.FC<SettingsRowProps> = ({);};-const SpaceIcon: React.FC<SpaceIconProps> = ({ label, src, url }) => (- <Box- aria-label={label}- component="a"- href={url}- rel="noopener noreferrer"- target="_blank"- sx={{- alignItems: "center",- bgcolor: "transparent",- border: 0,- borderRadius: "10px",- cursor: "pointer",- display: "flex",- height: spaceTouchTargetSize,- justifyContent: "center",- p: 0,- textDecoration: "none",- transition: "background-color 120ms ease",- width: spaceTouchTargetSize,- "&:active": { bgcolor: spaceSurfaceHover },- "&:focus-visible": {- outline: `2px solid ${green}`,- outlineOffset: 2,- },- "&:hover": { bgcolor: spaceSurfaceHover },- }}- >- <Box- component="img"- aria-hidden- alt=""- src={src}- sx={{ display: "block", maxHeight: 24, maxWidth: 24 }}- />- </Box>-);-const SettingsEyebrow: React.FC<{ children: React.ReactNode }> = ({children,}) => (@@ -574,27 +498,6 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({onClick={() => setLogoutSheetOpen(true)}/></Box>-- <Box sx={{ flex: 1, minHeight: 72 }} />-- <Box- sx={{- alignItems: "center",- display: "flex",- gap: "8px",- justifyContent: "center",- pb: "18px",- }}- >- {spaceLinks.map((link) => (- <SpaceIcon- key={link.label}- label={link.label}- src={link.src}- url={link.url}- />- ))}- </Box></Box><ConfirmationActionSheetopen={logoutSheetOpen}