Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix profile photo sizing and message reaction scrolling

Anand Baburajand3c5e9682b61
diff --git a/web/apps/space/src/screens/MessagesScreen.tsx b/web/apps/space/src/screens/MessagesScreen.tsx
index e0cab345cd..d0bb0d7c6a 100644
--- a/web/apps/space/src/screens/MessagesScreen.tsx
+++ b/web/apps/space/src/screens/MessagesScreen.tsx
@@ -1786,9 +1786,9 @@ const MessageBubble: React.FC<{
borderRadius: "12px",
fontFamily:
'"Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif',
- fontSize: 14,
- minHeight: 24,
- minWidth: 28,
+ fontSize: 15,
+ minHeight: 25,
+ minWidth: 29,
pt: "2px",
px: "3px",
color: green,
@@ -2211,10 +2211,10 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
React.useLayoutEffect(() => {
resizeComposer(composerRef.current);
- if (!selectedFriend || !stickToThreadBottomRef.current) return;
+ if (!selectedThreadID || !stickToThreadBottomRef.current) return;
if (smoothNextMessageScrollRef.current) return;
scrollThreadToBottom();
- }, [messageText, replyingTo, scrollThreadToBottom, selectedFriend]);
+ }, [messageText, replyingTo, scrollThreadToBottom, selectedThreadID]);
React.useEffect(() => {
setReplyingTo(null);
@@ -2224,7 +2224,7 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
setMessageText("");
stickToThreadBottomRef.current = true;
smoothNextMessageScrollRef.current = false;
- }, [selectedFriend]);
+ }, [selectedThreadID]);
React.useEffect(() => {
if (!messageContextMenu?.open) return;
@@ -2253,7 +2253,7 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
}, [isThreadReadOnly]);
React.useLayoutEffect(() => {
- if (!selectedFriend || isThreadLoading) return;
+ if (!selectedThreadID || isThreadBusy) return;
if (!stickToThreadBottomRef.current) return;
if (smoothNextMessageScrollRef.current) {
smoothNextMessageScrollRef.current = false;
@@ -2262,10 +2262,10 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
}
scrollThreadToBottom();
}, [
- isThreadLoading,
+ isThreadBusy,
scheduleThreadBottomScroll,
scrollThreadToBottom,
- selectedFriend,
+ selectedThreadID,
visibleMessages.length,
]);
diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsx
index 084038cf78..b0c085b5dc 100644
--- a/web/apps/space/src/screens/ProfileScreen.tsx
+++ b/web/apps/space/src/screens/ProfileScreen.tsx
@@ -388,7 +388,7 @@ const ProfilePostTile: React.FC<ProfilePostTileProps> = ({
display: "block",
height: "100%",
inset: 0,
- objectFit: "contain",
+ objectFit: "cover",
objectPosition: "center",
opacity:
isCurrentImageReady || !thumbHashDataURL ? 1 : 0,
diff --git a/web/apps/space/src/utils/profile-photo-layout.ts b/web/apps/space/src/utils/profile-photo-layout.ts
index c64686a82e..f2c38a4c07 100644
--- a/web/apps/space/src/utils/profile-photo-layout.ts
+++ b/web/apps/space/src/utils/profile-photo-layout.ts
@@ -1,3 +1,5 @@
+import { minimumPostPhotoFrameAspectRatio } from "../styles/tiles";
+
export const profilePhotoGap = 6;
const profilePhotoMinRowHeight = 100;
@@ -47,13 +49,16 @@ export const profilePhotoRows = <Tile extends { aspectRatio: number }>(
0,
);
const gaps = (rowSize - 1) * profilePhotoGap;
- // Keep sparse sections compact without cropping their photos. Shorter
- // rows keep their natural width and align with the section heading.
- const height = Math.min((width - gaps) / aspectRatio, width * 0.75);
+ const height = Math.min(
+ (width - gaps) / aspectRatio,
+ tiles.length == 1
+ ? width / minimumPostPhotoFrameAspectRatio
+ : width * 0.75,
+ );
rows.push({
aspectRatio,
height,
- width: height * aspectRatio + gaps,
+ width: tiles.length == 1 ? width : height * aspectRatio + gaps,
tiles: rowTiles,
});
index += rowSize;
diff --git a/web/apps/space/tests/profile-photo-layout.test.ts b/web/apps/space/tests/profile-photo-layout.test.ts
index 11959add02..b6775d2874 100644
--- a/web/apps/space/tests/profile-photo-layout.test.ts
+++ b/web/apps/space/tests/profile-photo-layout.test.ts
@@ -52,10 +52,10 @@ test("a landscape can share a row with two portraits to avoid a lone portrait",
]);
});
-test("a standalone portrait stays compact and keeps its original proportions", () => {
+test("a single-post section fills the width with the feed's portrait height cap", () => {
const tiles = photos([9 / 16]);
- expect(profilePhotoRows(tiles, 328)).toEqual([
- { aspectRatio: 9 / 16, height: 246, width: 246 * (9 / 16), tiles },
+ expect(profilePhotoRows(tiles, 324)).toEqual([
+ { aspectRatio: 9 / 16, height: 432, width: 324, tiles },
]);
});