π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refine space post like messages
Anand Baburajan204ff6b24790
diff --git a/web/apps/space/src/screens/MessagesScreen.tsx b/web/apps/space/src/screens/MessagesScreen.tsxindex 7c4e2a706e..524444cad5 100644--- a/web/apps/space/src/screens/MessagesScreen.tsx+++ b/web/apps/space/src/screens/MessagesScreen.tsx@@ -864,106 +864,158 @@ const QuotePreview: React.FC<{);};+const PostLikeHeartBadge: React.FC<{ isOwn: boolean }> = ({ isOwn }) => (+ <Box+ aria-hidden+ sx={{+ alignItems: "center",+ bgcolor: isOwn ? outgoingMessageText : green,+ borderRadius: "50%",+ color: isOwn ? green : outgoingMessageText,+ display: "flex",+ height: 22,+ justifyContent: "center",+ width: 22,+ }}+ >+ <Box+ component="svg"+ viewBox="0 0 24 24"+ sx={{ display: "block", height: 12, width: 12 }}+ >+ <path+ d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"+ fill="currentColor"+ />+ </Box>+ </Box>+);+const PostLikeContent: React.FC<{isOwn: boolean;message: SpaceMessage;onOpenQuotePost: (quote: SpaceMessageQuote) => void;-}> = ({ isOwn, message, onOpenQuotePost }) => {+ profile: SetupProfile;+}> = ({ isOwn, message, onOpenQuotePost, profile }) => {const quote = message.quote;- const imageUrl = quote && !quote.isUnavailable ? quote.imageUrl : undefined;- const canOpen = Boolean(quote && imageUrl);- const label = isOwn- ? "You liked a post"- : `${actorName(message.sender)} liked your post`;+ const isUnavailable = !quote || quote.isUnavailable || !quote.imageUrl;+ const canOpen = Boolean(quote && !isUnavailable);+ const title = quoteOwnerName(message, profile);return (- <Box- component={canOpen ? "button" : "div"}- type={canOpen ? "button" : undefined}- aria-label={canOpen ? "Open liked post" : undefined}- onClick={(event: React.MouseEvent) => {- if (!quote || !canOpen) return;- event.stopPropagation();- onOpenQuotePost(quote);- }}- sx={{- appearance: "none",- alignItems: "center",- bgcolor: "transparent",- border: 0,- color: "inherit",- cursor: canOpen ? "pointer" : "default",- display: "grid",- gap: "10px",- gridTemplateColumns: canOpen- ? "24px minmax(0, 1fr) 42px"- : "24px minmax(0, 1fr)",- font: "inherit",- minWidth: 0,- p: 0,- textAlign: "left",- width: "100%",- "&:focus-visible": {- outline: `2px solid ${isOwn ? outgoingMessageText : green}`,- outlineOffset: 2,- },- }}- >+ <><Box- aria-hiddensx={{- alignItems: "center",- bgcolor: isOwn ? outgoingMessageText : green,- borderRadius: "50%",- color: isOwn ? green : outgoingMessageText,+ alignItems: "stretch",display: "flex",- height: 24,- justifyContent: "center",- width: 24,- }}- >- <Box- component="svg"- viewBox="0 0 24 24"- sx={{ display: "block", height: 13, width: 13 }}- >- <path- d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"- fill="currentColor"- />- </Box>- </Box>- <Box- sx={{- color: isOwn ? outgoingMessageText : incomingMessageText,- fontFamily: '"Inter Variable", Inter, sans-serif',- fontSize: 14,- fontWeight: 500,- lineHeight: "18px",+ gap: "8px",+ mb: "10px",+ maxWidth: "100%",minWidth: 0,- overflow: "hidden",- textOverflow: "ellipsis",- whiteSpace: "nowrap",}}>- {label}- </Box>- {canOpen && (<Box- component="img"- alt=""- src={imageUrl}+ aria-hiddensx={{- borderRadius: "6px",- display: "block",- height: 42,- objectFit: "cover",- objectPosition: "center",- width: 42,+ alignSelf: "stretch",+ bgcolor: isOwn ? quoteRuleOnGreen : quoteRuleOnLight,+ borderRadius: "999px",+ flexShrink: 0,+ width: 3,}}/>- )}- </Box>+ <Box+ component={canOpen ? "button" : "div"}+ type={canOpen ? "button" : undefined}+ aria-label={canOpen ? "Open liked post" : undefined}+ onClick={(event: React.MouseEvent) => {+ if (!quote || !canOpen) return;+ event.stopPropagation();+ onOpenQuotePost(quote);+ }}+ sx={{+ appearance: "none",+ alignItems: "center",+ bgcolor: "transparent",+ border: 0,+ borderRadius: "8px",+ color: "inherit",+ cursor: canOpen ? "pointer" : "default",+ display: "grid",+ font: "inherit",+ gap: "8px",+ gridTemplateColumns: isUnavailable+ ? "minmax(0, 1fr)"+ : "minmax(0, 1fr) 44px",+ minWidth: 0,+ p: 0,+ textAlign: "left",+ width: "100%",+ "&:focus-visible": {+ outline: `2px solid ${green}`,+ outlineOffset: 2,+ },+ }}+ >+ <Box sx={{ minWidth: 0 }}>+ <Box+ sx={{+ color: isOwn+ ? outgoingMessageText+ : incomingMessageText,+ fontFamily:+ '"Inter Variable", Inter, sans-serif',+ fontSize: 12,+ fontWeight: 750,+ lineHeight: "18px",+ overflow: "hidden",+ textOverflow: "ellipsis",+ whiteSpace: "nowrap",+ }}+ >+ {title}+ </Box>+ <Box+ sx={{+ color: isOwn+ ? outgoingMessageSecondary+ : incomingMessageSecondary,+ fontFamily:+ '"Inter Variable", Inter, sans-serif',+ fontSize: 12,+ fontWeight: 500,+ lineHeight: "17px",+ overflow: "hidden",+ textOverflow: "ellipsis",+ whiteSpace: "nowrap",+ }}+ >+ {isUnavailable+ ? "Deleted"+ : quote.caption || "Post"}+ </Box>+ </Box>+ {!isUnavailable && (+ <Box+ component="img"+ alt=""+ src={quote.imageUrl}+ sx={{+ borderRadius: "6px",+ display: "block",+ height: 44,+ objectFit: "cover",+ objectPosition: "center",+ width: 44,+ }}+ />+ )}+ </Box>+ </Box>+ <Box sx={{ pb: "2px", pt: "2px" }}>+ <PostLikeHeartBadge isOwn={isOwn} />+ </Box>+ </>);};@@ -1259,12 +1311,9 @@ const MessageBubble: React.FC<{ml: 0,overflow: "visible",position: "relative",- px: isSyntheticPostLike ? "12px" : "16px",- py: isSyntheticPostLike- ? "10px"- : hasInlinePreview- ? "16px"- : "14px",+ px: "16px",+ pt: hasInlinePreview ? "16px" : "14px",+ pb: hasInlinePreview ? "12px" : "14px",textAlign: "left",touchAction: "pan-y",userSelect: "none",@@ -1286,6 +1335,7 @@ const MessageBubble: React.FC<{isOwn={isOwn}message={message}onOpenQuotePost={onOpenQuotePost}+ profile={profile}/>) : (<>