π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add inline actions to latest Space profile posts
Anand Baburajan50fa4282fcbf
diff --git a/web/apps/space/src/components/AuthenticatedFriendProfile.tsx b/web/apps/space/src/components/AuthenticatedFriendProfile.tsxindex 95c7a81ed8..3d32ff8179 100644--- a/web/apps/space/src/components/AuthenticatedFriendProfile.tsx+++ b/web/apps/space/src/components/AuthenticatedFriendProfile.tsx@@ -189,7 +189,24 @@ export const AuthenticatedFriendProfile: React.FC<replyToCurrentPost(actorSpaceId, postSpaceId, postId, text)}onSetPostLiked={async (postId, liked) => {- await setCurrentPostLiked(actorSpaceId, postId, liked);+ const previousLiked =+ posts.find((post) => post.postId == postId)+ ?.viewerLiked ?? false;+ const updateLiked = (viewerLiked: boolean) =>+ setPosts((current) =>+ current.map((post) =>+ post.postId == postId+ ? { ...post, viewerLiked }+ : post,+ ),+ );+ updateLiked(liked);+ try {+ await setCurrentPostLiked(actorSpaceId, postId, liked);+ } catch (error) {+ updateLiked(previousLiked);+ throw error;+ }void patchCachedSpaceHomePost(actorSpaceId, postId, {viewerLiked: liked,});diff --git a/web/apps/space/src/components/FileViewer.tsx b/web/apps/space/src/components/FileViewer.tsxindex bd97ac5e11..b03b530aeb 100644--- a/web/apps/space/src/components/FileViewer.tsx+++ b/web/apps/space/src/components/FileViewer.tsx@@ -2,10 +2,8 @@ import {Cancel01Icon,Delete02Icon,Edit01Icon,- FavouriteIcon,Loading03Icon,MoreHorizontalIcon,- Navigation03Icon,Tick02Icon,} from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";@@ -17,12 +15,8 @@ import {} from "components/ActionFeedback";import { SpaceAvatarImage } from "components/AvatarImage";import { ConfirmationActionSheet } from "components/ConfirmationActionSheet";-import {- spacePostLikeButtonPop,- spacePostLikeHeartPop,- spacePostLikePopDurationMs,- spacePostLikePopTiming,-} from "components/post-like-animation";+import { spacePostLikePopDurationMs } from "components/post-like-animation";+import { SpacePostReplyControls } from "components/PostReplyControls";import log from "ente-base/log";import type PhotoSwipe from "photoswipe";import React from "react";@@ -38,8 +32,6 @@ const textBase = "#F4F4F4";const textSecondary = "#A6A6A6";const textTertiary = "rgba(244, 244, 244, 0.52)";const viewerBackground = "#000000";-const controlBackground = "rgba(36, 36, 36, 0.72)";-const controlBackgroundHover = "rgba(48, 48, 48, 0.86)";const inputBackground = "rgba(58, 58, 58, 0.86)";const inputBackgroundActive = "rgba(72, 72, 72, 0.9)";const controlIcon = "#D8D8D8";@@ -227,24 +219,6 @@ const viewerSwipeStartsOnInteractiveTarget = (target: EventTarget | null) =>),);-const viewerActionButtonSx = {- alignItems: "center",- bgcolor: controlBackground,- border: 0,- borderRadius: "50%",- boxShadow: "0 10px 28px rgba(0, 0, 0, 0.36)",- color: controlIcon,- cursor: "pointer",- display: "flex",- height: 48,- justifyContent: "center",- p: 0,- width: 48,- "&:active": { bgcolor: "#3A3A3A" },- "&:focus-visible": { outline: `2px solid ${green}`, outlineOffset: 2 },- "&:hover": { bgcolor: controlBackgroundHover },-};-export const SpaceViewerPostBackdrop: React.FC<{ exiting?: boolean }> = ({exiting = false,}) => (@@ -504,8 +478,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({const isReplyMode =canReplyToPost &&(isReplyFocused || replyText.trim().length > 0 || isReplyActionRunning);- const isPhotoLikePopping =- !isReplyMode && isPhotoLiked && photoLikePopID > 0;const usePhotoSwipeViewer = !isDraftPost || isDesktopViewer;const canSendReply =canReplyToPost &&@@ -854,10 +826,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({input.setSelectionRange(input.value.length, input.value.length);}, [isCaptionEditing]);- React.useLayoutEffect(() => {- resizeCaptionInput(replyInputRef.current, replyInputMinHeight);- }, [replyText]);-React.useLayoutEffect(() => {if (!focusReplyOnOpen || !canReplyToPost) return;@@ -922,6 +890,9 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({React.useEffect(() => {setIsPhotoLiked(activePhoto.viewerLiked ?? false);+ }, [activePhoto.imageUrl, activePhoto.postId, activePhoto.viewerLiked]);++ React.useEffect(() => {setCaptionUpdateActionPhase(null);setHasCaptionUpdateError(false);setIsCaptionEditing(false);@@ -932,7 +903,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({activePhoto.imageUrl,activePhoto.postId,activePhoto.timestampMs,- activePhoto.viewerLiked,canReplyToPost,focusReplyOnOpen,]);@@ -2092,202 +2062,37 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({zIndex: 2,}}>- <Box- sx={{- alignItems: "flex-end",- display: "flex",- gap: "8px",- justifyContent: "flex-end",- width: "100%",- }}- >- {canReplyToPost && (- <Box- ref={replyInputRef}- component="textarea"- aria-label="Reply to post"- disabled={isReplyActionRunning}- onBlur={() => setIsReplyFocused(false)}- onChange={(event) => {- const nextText = clampSpaceMessageText(- event.target.value,- );- event.currentTarget.value = nextText;- setReplyText(nextText);- resizeCaptionInput(- event.currentTarget,- replyInputMinHeight,- );- }}- onFocus={() => setIsReplyFocused(true)}- onKeyDown={handleReplyKeyDown}- onPointerDown={handleReplyInputPointerDown}- placeholder="Reply..."- readOnly={canAddFriendForPostAction}- rows={1}- value={replyText}- sx={{- bgcolor: inputBackground,- border: 0,- borderRadius: "24px",- boxSizing: "border-box",- color: textBase,- flex: "1 1 auto",- fontFamily:- '"Inter Variable", Inter, sans-serif',- fontSize: 14,- fontWeight: 500,- lineHeight: "20px",- maxHeight: captionInputMaxHeight,- minHeight: replyInputMinHeight,- minWidth: 0,- outline: 0,- overflow: "hidden",- pb: `${replyInputPadding}px`,- pl: `${replyInputPaddingLeft}px`,- pr: `${replyInputPadding}px`,- pt: `${replyInputPadding}px`,- resize: "none",- "&::placeholder": { color: textSecondary },- "&:disabled": { opacity: 0.74 },- "&:focus": {- bgcolor: inputBackgroundActive,- },- }}- />- )}- <Box- sx={{ height: 48, position: "relative", width: 48 }}- >- <Box- component="button"- type="button"- aria-label={- isReplyMode- ? replyActionPhase == "busy"- ? "Sending reply"- : replyActionPhase == "done"- ? "Reply sent"- : "Send reply"- : isPhotoLiked- ? "Unlike photo"- : "Like photo"- }- aria-pressed={- isReplyMode ? undefined : isPhotoLiked- }- aria-disabled={- isReplyMode && !canSendReply- ? true- : undefined- }- onClick={- isReplyMode- ? sendReply- : handlePhotoLikeClick- }- onPointerDown={- isReplyMode- ? handleInputActionPointerDown- : undefined- }- sx={{- ...viewerActionButtonSx,- animation: isPhotoLikePopping- ? `${spacePostLikeButtonPop} ${spacePostLikePopDurationMs}ms ${spacePostLikePopTiming} both`- : undefined,- bgcolor: controlBackground,- color:- isReplyMode && canSendReply- ? textBase- : controlIcon,- cursor:- isReplyMode && !canSendReply- ? "default"- : "pointer",- touchAction: "manipulation",- userSelect: "none",- WebkitTouchCallout: "none",- WebkitUserSelect: "none",- "&:hover": {- bgcolor: isReplyMode- ? canSendReply- ? controlBackgroundHover- : controlBackground- : controlBackgroundHover,- },- "@media (prefers-reduced-motion: reduce)": {- animation: "none",- },- }}- >- {isReplyMode ? (- replyActionPhase == "busy" ? (- <Box- component="span"- sx={{- animation: `${postButtonSpin} 2.4s linear infinite`,- display: "flex",- lineHeight: 0,- }}- >- <HugeiconsIcon- icon={Loading03Icon}- size={22}- strokeWidth={1.8}- />- </Box>- ) : replyActionPhase == "done" ? (- <HugeiconsIcon- icon={Tick02Icon}- primaryColor={green}- size={22}- strokeWidth={1.8}- />- ) : (- <HugeiconsIcon- icon={Navigation03Icon}- size={24}- strokeWidth={1.8}- style={{- transform:- "translate(-1px, 1px)",- }}- />- )- ) : (- <Box- key={- isPhotoLikePopping- ? `heart-${photoLikePopID}`- : "heart"- }- component="span"- sx={{- animation: isPhotoLikePopping- ? `${spacePostLikeHeartPop} ${spacePostLikePopDurationMs}ms ${spacePostLikePopTiming} both`- : undefined,- display: "flex",- lineHeight: 0,- transformOrigin: "50% 58%",- "@media (prefers-reduced-motion: reduce)":- { animation: "none" },- }}- >- <HugeiconsIcon- fill={isPhotoLiked ? green : "none"}- icon={FavouriteIcon}- primaryColor={- isPhotoLiked ? green : undefined- }- size={26}- strokeWidth={1.8}- />- </Box>- )}- </Box>- </Box>- </Box>+ <SpacePostReplyControls+ canSendReply={canSendReply}+ isReplyMode={isReplyMode}+ liked={isPhotoLiked}+ likePopID={photoLikePopID}+ onLike={handlePhotoLikeClick}+ onSendReply={sendReply}+ replyActionPhase={replyActionPhase}+ replyInputRef={replyInputRef}+ replyInputProps={+ canReplyToPost+ ? {+ onBlur: () => setIsReplyFocused(false),+ onChange: (event) => {+ const nextText =+ clampSpaceMessageText(+ event.target.value,+ );+ event.currentTarget.value = nextText;+ setReplyText(nextText);+ },+ onFocus: () => setIsReplyFocused(true),+ onKeyDown: handleReplyKeyDown,+ onPointerDown:+ handleReplyInputPointerDown,+ readOnly: canAddFriendForPostAction,+ value: replyText,+ }+ : undefined+ }+ /></Box>)}{canDeletePost && (diff --git a/web/apps/space/src/components/PostReplyControls.tsx b/web/apps/space/src/components/PostReplyControls.tsxnew file mode 100644index 0000000000..f1fae40adf--- /dev/null+++ b/web/apps/space/src/components/PostReplyControls.tsx@@ -0,0 +1,262 @@+import {+ FavouriteIcon,+ Loading03Icon,+ Navigation03Icon,+ Tick02Icon,+} from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";+import { Box } from "@mui/material";+import { keyframes } from "@mui/material/styles";+import type { SpaceActionPhase } from "components/ActionFeedback";+import {+ spacePostLikeButtonPop,+ spacePostLikeHeartPop,+ spacePostLikePopDurationMs,+ spacePostLikePopTiming,+} from "components/post-like-animation";+import React from "react";++const green = "#08C225";+const textBase = "#F4F4F4";+const textSecondary = "#A6A6A6";+const controlBackground = "rgba(36, 36, 36, 0.72)";+const controlBackgroundHover = "rgba(48, 48, 48, 0.86)";+const inputBackground = "rgba(58, 58, 58, 0.86)";+const inputBackgroundActive = "rgba(72, 72, 72, 0.9)";+const controlIcon = "#D8D8D8";+const replyInputMinHeight = 48;+const replyInputPadding = 14;+const replyInputPaddingLeft = 18;+const captionInputMaxHeight = 112;+const postButtonSpin = keyframes`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`;++const viewerActionButtonSx = {+ alignItems: "center",+ bgcolor: controlBackground,+ border: 0,+ borderRadius: "50%",+ boxShadow: "0 10px 28px rgba(0, 0, 0, 0.36)",+ color: controlIcon,+ cursor: "pointer",+ display: "flex",+ height: 48,+ justifyContent: "center",+ p: 0,+ width: 48,+ "&:active": { bgcolor: "#3A3A3A" },+ "&:focus-visible": { outline: `2px solid ${green}`, outlineOffset: 2 },+ "&:hover": { bgcolor: controlBackgroundHover },+};++interface SpacePostReplyControlsProps {+ canSendReply: boolean;+ disabled?: boolean;+ isLikePending?: boolean;+ isReplyMode: boolean;+ liked: boolean;+ likePopID: number;+ onLike: () => void;+ onSendReply: () => void;+ replyActionPhase: SpaceActionPhase | null;+ replyInputProps?: React.TextareaHTMLAttributes<HTMLTextAreaElement>;+ replyInputRef?: React.RefObject<HTMLTextAreaElement | null>;+}++export const SpacePostReplyControls: React.FC<SpacePostReplyControlsProps> = ({+ canSendReply,+ disabled = false,+ isLikePending = false,+ isReplyMode,+ liked,+ likePopID,+ onLike,+ onSendReply,+ replyActionPhase,+ replyInputProps,+ replyInputRef: externalReplyInputRef,+}) => {+ const internalReplyInputRef = React.useRef<HTMLTextAreaElement | null>(+ null,+ );+ const replyInputRef = externalReplyInputRef ?? internalReplyInputRef;+ const isLikePopping = !isReplyMode && liked && likePopID > 0;+ const isSendActive = isReplyMode && canSendReply;+ React.useLayoutEffect(() => {+ const input = replyInputRef.current;+ if (!input) return;+ input.style.height = `${replyInputMinHeight}px`;+ input.style.height = `${Math.max(replyInputMinHeight, Math.min(input.scrollHeight, captionInputMaxHeight))}px`;+ input.style.overflowY =+ input.scrollHeight > captionInputMaxHeight ? "auto" : "hidden";+ }, [replyInputRef, replyInputProps?.value]);+ return (+ <Box+ sx={{+ alignItems: "flex-end",+ display: "flex",+ gap: "8px",+ justifyContent: "flex-end",+ width: "100%",+ }}+ >+ {replyInputProps && (+ <Box+ ref={replyInputRef}+ component="textarea"+ aria-label="Reply to post"+ disabled={disabled || replyActionPhase != null}+ placeholder="Reply..."+ rows={1}+ {...replyInputProps}+ sx={{+ bgcolor: inputBackground,+ border: 0,+ borderRadius: "24px",+ boxSizing: "border-box",+ color: textBase,+ flex: "1 1 auto",+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 14,+ fontWeight: 500,+ lineHeight: "20px",+ maxHeight: captionInputMaxHeight,+ minHeight: replyInputMinHeight,+ minWidth: 0,+ outline: 0,+ overflow: "hidden",+ pb: `${replyInputPadding}px`,+ pl: `${replyInputPaddingLeft}px`,+ pr: `${replyInputPadding}px`,+ pt: `${replyInputPadding}px`,+ resize: "none",+ "&::placeholder": { color: textSecondary },+ "&:disabled": { opacity: 0.74 },+ "&:focus": { bgcolor: inputBackgroundActive },+ }}+ />+ )}+ <Box+ sx={{+ flexShrink: 0,+ height: 48,+ position: "relative",+ width: 48,+ }}+ >+ <Box+ component="button"+ type="button"+ className={isSendActive ? "green-bg" : undefined}+ aria-label={+ isReplyMode+ ? replyActionPhase == "busy"+ ? "Sending reply"+ : replyActionPhase == "done"+ ? "Reply sent"+ : "Send reply"+ : liked+ ? "Unlike photo"+ : "Like photo"+ }+ aria-pressed={isReplyMode ? undefined : liked}+ aria-disabled={+ isReplyMode && !canSendReply ? true : undefined+ }+ disabled={disabled || (!isReplyMode && isLikePending)}+ onClick={isReplyMode ? onSendReply : onLike}+ onPointerDown={+ isReplyMode+ ? (event) => event.preventDefault()+ : undefined+ }+ sx={{+ ...viewerActionButtonSx,+ animation: isLikePopping+ ? `${spacePostLikeButtonPop} ${spacePostLikePopDurationMs}ms ${spacePostLikePopTiming} both`+ : undefined,+ bgcolor: isSendActive ? green : controlBackground,+ color: isReplyMode ? "#FFFFFF" : controlIcon,+ cursor:+ isReplyMode && !canSendReply+ ? "default"+ : "pointer",+ touchAction: "manipulation",+ userSelect: "none",+ WebkitTouchCallout: "none",+ WebkitUserSelect: "none",+ "&:hover": {+ bgcolor: isSendActive+ ? "#07AE22"+ : isReplyMode+ ? controlBackground+ : controlBackgroundHover,+ },+ "&:active": {+ bgcolor: isSendActive ? "#069B1E" : "#3A3A3A",+ },+ "@media (prefers-reduced-motion: reduce)": {+ animation: "none",+ },+ }}+ >+ {isReplyMode ? (+ replyActionPhase == "busy" ? (+ <Box+ component="span"+ sx={{+ animation: `${postButtonSpin} 2.4s linear infinite`,+ display: "flex",+ lineHeight: 0,+ }}+ >+ <HugeiconsIcon+ icon={Loading03Icon}+ size={22}+ strokeWidth={1.8}+ />+ </Box>+ ) : replyActionPhase == "done" ? (+ <HugeiconsIcon+ icon={Tick02Icon}+ primaryColor={green}+ size={22}+ strokeWidth={1.8}+ />+ ) : (+ <HugeiconsIcon+ icon={Navigation03Icon}+ size={24}+ strokeWidth={1.8}+ style={{ transform: "translate(-1px, 1px)" }}+ />+ )+ ) : (+ <Box+ key={isLikePopping ? `heart-${likePopID}` : "heart"}+ component="span"+ sx={{+ animation: isLikePopping+ ? `${spacePostLikeHeartPop} ${spacePostLikePopDurationMs}ms ${spacePostLikePopTiming} both`+ : undefined,+ display: "flex",+ lineHeight: 0,+ transformOrigin: "50% 58%",+ "@media (prefers-reduced-motion: reduce)": {+ animation: "none",+ },+ }}+ >+ <HugeiconsIcon+ fill={liked ? green : "none"}+ icon={FavouriteIcon}+ primaryColor={liked ? green : undefined}+ size={26}+ strokeWidth={1.8}+ />+ </Box>+ )}+ </Box>+ </Box>+ </Box>+ );+};diff --git a/web/apps/space/src/components/ProfileLatestPost.tsx b/web/apps/space/src/components/ProfileLatestPost.tsxnew file mode 100644index 0000000000..3d36127ec5--- /dev/null+++ b/web/apps/space/src/components/ProfileLatestPost.tsx@@ -0,0 +1,205 @@+import { Box } from "@mui/material";+import type { SpaceActionPhase } from "components/ActionFeedback";+import { spacePostLikePopDurationMs } from "components/post-like-animation";+import { SpacePostReplyControls } from "components/PostReplyControls";+import log from "ente-base/log";+import React from "react";+import { spaceTextMuted } from "styles/colors";+import { clampSpaceMessageText } from "utils/message-limits";++interface ProfileLatestPostProps {+ caption?: string;+ children: React.ReactNode;+ disabled: boolean;+ liked: boolean;+ onReply?: (text: string) => Promise<void>;+ onSetLiked?: (liked: boolean) => Promise<void>;+}++export const ProfileLatestPost: React.FC<ProfileLatestPostProps> = ({+ caption,+ children,+ disabled,+ liked,+ onReply,+ onSetLiked,+}) => {+ const [isLikePending, setIsLikePending] = React.useState(false);+ const [likePopID, setLikePopID] = React.useState(0);+ const [replyText, setReplyText] = React.useState("");+ const [isReplyFocused, setIsReplyFocused] = React.useState(false);+ const [replyActionPhase, setReplyActionPhase] =+ React.useState<SpaceActionPhase | null>(null);+ const [errorMessage, setErrorMessage] = React.useState<string>();+ const replyInputRef = React.useRef<HTMLTextAreaElement | null>(null);+ const isReplyMode = Boolean(+ onReply && (isReplyFocused || replyText.trim() || replyActionPhase),+ );+ const canSendReply = Boolean(+ onReply && replyText.trim() && !replyActionPhase && !disabled,+ );++ React.useEffect(() => {+ if (likePopID == 0) return;+ const timeoutID = window.setTimeout(+ () => setLikePopID(0),+ spacePostLikePopDurationMs,+ );+ return () => window.clearTimeout(timeoutID);+ }, [likePopID]);++ React.useEffect(() => {+ if (replyActionPhase != "done") return;+ const timeoutID = window.setTimeout(() => {+ setReplyActionPhase(null);+ setIsReplyFocused(false);+ replyInputRef.current?.blur();+ }, 1000);+ return () => window.clearTimeout(timeoutID);+ }, [replyActionPhase]);++ const toggleLike = async () => {+ if (!onSetLiked || isLikePending || disabled) return;+ setIsLikePending(true);+ setErrorMessage(undefined);+ if (!liked) setLikePopID((id) => id + 1);+ try {+ await onSetLiked(!liked);+ } catch (error) {+ log.error("Failed to update latest post like", error);+ setErrorMessage("Couldn't update like. Try again.");+ } finally {+ setIsLikePending(false);+ }+ };++ const sendReply = async () => {+ if (!onReply || !canSendReply) return;+ setReplyActionPhase("busy");+ setErrorMessage(undefined);+ try {+ await onReply(replyText.trim());+ setReplyText("");+ setReplyActionPhase("done");+ } catch (error) {+ log.error("Failed to reply to latest post", error);+ setReplyActionPhase(null);+ setErrorMessage("Couldn't send reply. Try again.");+ }+ };++ return (+ <Box+ component="article"+ aria-label="Latest post"+ sx={{ minWidth: 0, width: "100%" }}+ >+ <Box+ sx={{+ borderRadius: "16px",+ display: "flex",+ overflow: "hidden",+ position: "relative",+ }}+ >+ {children}+ {!disabled && caption?.trim() && (+ <Box+ title={caption}+ sx={{+ bottom: 20,+ color: "#FFFFFF",+ display: "-webkit-box",+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 13,+ fontWeight: 650,+ left: "50%",+ lineHeight: "19px",+ maxWidth: "78%",+ overflow: "hidden",+ overflowWrap: "anywhere",+ pointerEvents: "none",+ position: "absolute",+ textAlign: "center",+ textShadow: "0 1px 10px rgba(0, 0, 0, 0.74)",+ textWrap: "balance",+ transform: "translateX(-50%)",+ WebkitBoxOrient: "vertical",+ WebkitLineClamp: 2,+ width: "max-content",+ }}+ >+ <Box+ component="span"+ sx={{+ bgcolor: "rgba(48, 48, 48, 0.79)",+ borderRadius: "5px",+ boxDecorationBreak: "clone",+ px: "7px",+ py: "2px",+ WebkitBoxDecorationBreak: "clone",+ }}+ >+ {caption.trim()}+ </Box>+ </Box>+ )}+ </Box>+ {(onReply || onSetLiked) && (+ <Box sx={{ mt: "12px" }}>+ <SpacePostReplyControls+ canSendReply={canSendReply}+ disabled={disabled}+ isLikePending={isLikePending}+ isReplyMode={isReplyMode}+ liked={liked}+ likePopID={likePopID}+ onLike={() => void toggleLike()}+ onSendReply={() => void sendReply()}+ replyActionPhase={replyActionPhase}+ replyInputRef={replyInputRef}+ replyInputProps={+ onReply+ ? {+ onBlur: () => setIsReplyFocused(false),+ onFocus: () => setIsReplyFocused(true),+ onChange: (event) =>+ setReplyText(+ clampSpaceMessageText(+ event.target.value,+ ),+ ),+ onKeyDown: (event) => {+ if (+ event.key != "Enter" ||+ event.shiftKey ||+ event.nativeEvent.isComposing+ )+ return;+ event.preventDefault();+ void sendReply();+ },+ value: replyText,+ }+ : undefined+ }+ />+ {errorMessage && (+ <Box+ role="alert"+ sx={{+ color: spaceTextMuted,+ fontFamily:+ '"Inter Variable", Inter, sans-serif',+ fontSize: 13,+ mt: "8px",+ }}+ >+ {errorMessage}+ </Box>+ )}+ </Box>+ )}+ </Box>+ );+};diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsxindex df1375e256..8417a8e8bc 100644--- a/web/apps/space/src/screens/ProfileScreen.tsx+++ b/web/apps/space/src/screens/ProfileScreen.tsx@@ -27,6 +27,7 @@ import {type SpaceViewerPostActionMode,} from "components/FileViewer";import { SpacePostFloatingActionButton } from "components/PostFloatingActionButton";+import { ProfileLatestPost } from "components/ProfileLatestPost";import { SpaceLoadingSpinner } from "components/RouteFallback";import { SpaceShareIcon } from "components/ShareInviteButton";import log from "ente-base/log";@@ -1104,21 +1105,28 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({isSingleItemRow: boolean,) => {const imageUrl = loadedPostImageURLFor(item);- return (+ const isLatestPost = index == 0 && !isPublicProfile;+ const isUnavailable = !viewerPostIndexByID.has(item.id);+ const tile = (<ProfilePostTilekey={`${item.id}-${index}`}aspectRatio={aspectRatio}- dimensions={dimensions}+ dimensions={+ isLatestPost+ ? {+ width: dimensions.width,+ height: Math.min(+ dimensions.height,+ (dimensions.width * 4) / 3,+ ),+ }+ : dimensions+ }displayName={displayName}imageUrl={imageUrl}index={index}isSingleItemRow={isSingleItemRow}- isUnavailable={- Boolean(item.isUnavailable) ||- Boolean(- unavailablePostsByKey[profilePostImageCacheKey(item)],- )- }+ isUnavailable={isUnavailable}item={item}loadRootMargin={postImageLoadRootMargin}onLoadImage={() => loadPostImage(item)}@@ -1139,6 +1147,30 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({onRememberDimensions={rememberLoadedPhotoDimensions}/>);+ if (!isLatestPost) return tile;++ const postId = item.postId;+ const spaceId = item.spaceId;+ return (+ <ProfileLatestPost+ key={item.id}+ caption={isFriendProfile ? item.caption : undefined}+ disabled={isUnavailable}+ liked={item.viewerLiked ?? false}+ onReply={+ isFriendProfile && onReplyToPost && postId && spaceId+ ? (text) => onReplyToPost(spaceId, postId, text)+ : undefined+ }+ onSetLiked={+ isFriendProfile && onSetPostLiked && postId+ ? (liked) => onSetPostLiked(postId, liked)+ : undefined+ }+ >+ {tile}+ </ProfileLatestPost>+ );};return (@@ -1902,7 +1934,11 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({display: "flex",flexDirection: "column",gap: photoMasonryGap,- overflow: "hidden",+ overflow:+ title == "Latest" &&+ !isPublicProfile+ ? "visible"+ : "hidden",}}>{rows.map((row) => {