Skip to content

armgit / ente

Public Imported from GitHub
0

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

Polish latest post captions and metadata

Anand Baburajan972bf4222e2d
diff --git a/web/apps/space/src/components/PostReplyControls.tsx b/web/apps/space/src/components/PostReplyControls.tsx
index 252d4c51c8..1f39d63f82 100644
--- a/web/apps/space/src/components/PostReplyControls.tsx
+++ b/web/apps/space/src/components/PostReplyControls.tsx
@@ -23,7 +23,7 @@ const controlBackground = "#36363A";
const controlBackgroundHover = "#404044";
const controlBackgroundActive = "#48484D";
const controlIcon = "#D8D8D8";
-const replyInputMinHeight = 48;
+export const spacePostReplyInputMinHeight = 48;
const replyInputPadding = 14;
const replyInputPaddingLeft = 18;
const captionInputMaxHeight = 112;
@@ -82,8 +82,8 @@ export const SpacePostReplyControls: React.FC<SpacePostReplyControlsProps> = ({
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.height = `${spacePostReplyInputMinHeight}px`;
+ input.style.height = `${Math.max(spacePostReplyInputMinHeight, Math.min(input.scrollHeight, captionInputMaxHeight))}px`;
input.style.overflowY =
input.scrollHeight > captionInputMaxHeight ? "auto" : "hidden";
}, [replyInputRef, replyInputProps?.value]);
@@ -109,7 +109,7 @@ export const SpacePostReplyControls: React.FC<SpacePostReplyControlsProps> = ({
sx={{
bgcolor: controlBackground,
border: 0,
- borderRadius: "24px",
+ borderRadius: `${spacePostReplyInputMinHeight / 2}px`,
boxSizing: "border-box",
color: textBase,
flex: "1 1 auto",
@@ -118,7 +118,7 @@ export const SpacePostReplyControls: React.FC<SpacePostReplyControlsProps> = ({
fontWeight: 500,
lineHeight: "20px",
maxHeight: captionInputMaxHeight,
- minHeight: replyInputMinHeight,
+ minHeight: spacePostReplyInputMinHeight,
minWidth: 0,
outline: 0,
overflow: "hidden",
diff --git a/web/apps/space/src/components/ProfileLatestPost.tsx b/web/apps/space/src/components/ProfileLatestPost.tsx
index 18e59d3001..03e0a2fcc4 100644
--- a/web/apps/space/src/components/ProfileLatestPost.tsx
+++ b/web/apps/space/src/components/ProfileLatestPost.tsx
@@ -1,10 +1,18 @@
import { Box } from "@mui/material";
import type { SpaceActionPhase } from "components/ActionFeedback";
import { spacePostLikePopDurationMs } from "components/post-like-animation";
-import { SpacePostReplyControls } from "components/PostReplyControls";
+import {
+ SpacePostReplyControls,
+ spacePostReplyInputMinHeight,
+} from "components/PostReplyControls";
import log from "ente-base/log";
import React from "react";
import { spaceSurface, spaceTextMuted } from "styles/colors";
+import {
+ spaceProfilePostRadius,
+ spaceTileCornerStyles,
+ spaceTilePillInset,
+} from "styles/tiles";
import { clampSpaceMessageText } from "utils/message-limits";
interface ProfileLatestPostProps {
@@ -93,8 +101,8 @@ export const ProfileLatestPost: React.FC<ProfileLatestPostProps> = ({
component="article"
aria-label="Latest post"
sx={{
+ ...spaceTileCornerStyles(spaceProfilePostRadius),
bgcolor: spaceSurface,
- borderRadius: "16px",
minWidth: 0,
overflow: "hidden",
width: "100%",
@@ -102,7 +110,7 @@ export const ProfileLatestPost: React.FC<ProfileLatestPostProps> = ({
>
<Box
sx={{
- borderRadius: "16px",
+ borderRadius: "var(--space-tile-radius)",
display: "flex",
overflow: "hidden",
position: "relative",
@@ -114,6 +122,7 @@ export const ProfileLatestPost: React.FC<ProfileLatestPostProps> = ({
title={caption}
sx={{
bottom: 20,
+ clipPath: "inset(-2px -7px 0)",
color: "#FFFFFF",
display: "-webkit-box",
fontFamily: '"Inter Variable", Inter, sans-serif',
@@ -122,7 +131,6 @@ export const ProfileLatestPost: React.FC<ProfileLatestPostProps> = ({
left: "50%",
lineHeight: "19px",
maxWidth: "78%",
- overflow: "hidden",
overflowWrap: "anywhere",
pointerEvents: "none",
position: "absolute",
@@ -152,7 +160,9 @@ export const ProfileLatestPost: React.FC<ProfileLatestPostProps> = ({
)}
</Box>
{(onReply || onSetLiked) && (
- <Box sx={{ p: "12px" }}>
+ <Box
+ sx={{ p: spaceTilePillInset(spacePostReplyInputMinHeight) }}
+ >
<SpacePostReplyControls
canSendReply={canSendReply}
disabled={disabled}
diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsx
index aae0f67e51..786f8bfc2e 100644
--- a/web/apps/space/src/screens/ProfileScreen.tsx
+++ b/web/apps/space/src/screens/ProfileScreen.tsx
@@ -46,8 +46,9 @@ import {
spaceText,
spaceTextMuted,
} from "styles/colors";
+import { spaceProfilePostRadius } from "styles/tiles";
import { spaceTouchTargetSize } from "styles/touch-targets";
-import { firstNameFrom } from "utils/display";
+import { firstNameFrom, formatSpaceDate } from "utils/display";
import { createLoadedLocalPostPhoto } from "utils/local-post-photo";
import {
canPreviewSpaceImageFile,
@@ -79,7 +80,7 @@ const profileCoverHeight =
profileHeaderHeight + profileAvatarTopOffset + profileAvatarSize / 2;
const photoMasonryGap = `${profilePhotoGap}px`;
const photoMasonryPlaceholderBackground = spaceSurface;
-const photoMasonryRadius = "16px";
+const photoMasonryRadius = `${spaceProfilePostRadius}px`;
const profileCoverRadius = "12px";
const photoMasonryLoadRootMargin = "800px 0px";
const publicPhotoMasonryLoadRootMargin = "400px 0px";
@@ -1135,7 +1136,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
return (
<ProfileLatestPost
key={item.id}
- caption={isFriendProfile ? item.caption : undefined}
+ caption={item.caption}
disabled={isUnavailable}
liked={item.viewerLiked ?? false}
onReply={
@@ -1898,17 +1899,38 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
<Box
component="h2"
sx={{
+ alignItems: "baseline",
color: textSoft,
+ display: "flex",
fontFamily:
'"Inter Variable", Inter, sans-serif',
fontSize: 13,
fontWeight: 700,
+ gap: "4px",
lineHeight: "18px",
m: 0,
pb: "8px",
}}
>
{title}
+ {title == "Latest" && (
+ <Box
+ component="span"
+ sx={{
+ color: "#85858D",
+ display: "inline-flex",
+ fontSize: 12,
+ fontWeight: 500,
+ gap: "4px",
+ }}
+ >
+ <span aria-hidden>Β·</span>
+ {formatSpaceDate(
+ rows[0]!.tiles[0]!.item
+ .timestampMs,
+ )}
+ </Box>
+ )}
</Box>
<Box
sx={{
diff --git a/web/apps/space/src/styles/tiles.ts b/web/apps/space/src/styles/tiles.ts
index 78bcd2caef..39bf5e2eb7 100644
--- a/web/apps/space/src/styles/tiles.ts
+++ b/web/apps/space/src/styles/tiles.ts
@@ -1,4 +1,5 @@
export const spacePostTileRadius = 28;
+export const spaceProfilePostRadius = 16;
export const spaceTileAvatarSize = (tile: { width: number; height: number }) =>
Math.min(36, Math.min(tile.width, tile.height) * 0.22);