Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

Adjust Space feed aspect ratios and editor actions

Anand Baburajan63a4fc738202
diff --git a/web/apps/space/src/components/PostPhotoEditor.tsx b/web/apps/space/src/components/PostPhotoEditor.tsx
index 16990fbbb1..2c25628027 100644
--- a/web/apps/space/src/components/PostPhotoEditor.tsx
+++ b/web/apps/space/src/components/PostPhotoEditor.tsx
@@ -245,26 +245,34 @@ export const SpacePostPhotoEditor: React.FC<{
<Box
component="button"
type="button"
- disabled={
- isSaving || isPreparing || Boolean(preparationError)
- }
- aria-busy={isSaving}
- onClick={() => void save()}
- sx={{ ...buttonSx, justifySelf: "start", p: 0 }}
+ aria-label="Cancel edits"
+ onClick={onClose}
+ sx={{
+ ...buttonSx,
+ justifySelf: "start",
+ width: 44,
+ ml: "-8px",
+ p: 0,
+ }}
>
<Box
component="span"
sx={{
alignItems: "center",
- bgcolor: "#FFFFFF",
- borderRadius: "999px",
- color: "#171717",
- display: "inline-flex",
+ bgcolor: "#242424",
+ borderRadius: "50%",
+ color: "#E4E4E4",
+ display: "flex",
height: 32,
- px: "16px",
+ justifyContent: "center",
+ width: 32,
}}
>
- {isSaving ? "Saving…" : "Done"}
+ <HugeiconsIcon
+ icon={Cancel01Icon}
+ size={20}
+ strokeWidth={1.8}
+ />
</Box>
</Box>
<Box
@@ -276,34 +284,26 @@ export const SpacePostPhotoEditor: React.FC<{
<Box
component="button"
type="button"
- aria-label="Cancel edits"
- onClick={onClose}
- sx={{
- ...buttonSx,
- justifySelf: "end",
- width: 44,
- mr: "-8px",
- p: 0,
- }}
+ disabled={
+ isSaving || isPreparing || Boolean(preparationError)
+ }
+ aria-busy={isSaving}
+ onClick={() => void save()}
+ sx={{ ...buttonSx, justifySelf: "end", p: 0 }}
>
<Box
component="span"
sx={{
alignItems: "center",
- bgcolor: "#242424",
- borderRadius: "50%",
- color: "#E4E4E4",
- display: "flex",
+ bgcolor: "#FFFFFF",
+ borderRadius: "999px",
+ color: "#171717",
+ display: "inline-flex",
height: 32,
- justifyContent: "center",
- width: 32,
+ px: "16px",
}}
>
- <HugeiconsIcon
- icon={Cancel01Icon}
- size={20}
- strokeWidth={1.8}
- />
+ {isSaving ? "Saving…" : "Done"}
</Box>
</Box>
</Box>
diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsx
index 6e0b6a59b9..968a62b2fa 100644
--- a/web/apps/space/src/screens/HomeScreen.tsx
+++ b/web/apps/space/src/screens/HomeScreen.tsx
@@ -1069,12 +1069,22 @@ const FeedItem: React.FC<FeedItemProps> = ({
firstPhoto.width && firstPhoto.height
? firstPhoto.width / firstPhoto.height
: aspectRatio;
- const frameAspectRatio = Math.max(
- minimumPostPhotoFrameAspectRatio,
- feedPhotos.length > 1
- ? firstPhotoAspectRatio
- : photoDimensions.width / photoDimensions.height,
+ const hasMatchingAspectRatios = feedPhotos.every(
+ (photo) =>
+ photo.width &&
+ photo.height &&
+ Math.abs(photo.width / photo.height / firstPhotoAspectRatio - 1) <
+ 0.01,
);
+ const frameAspectRatio =
+ feedPhotos.length > 1
+ ? hasMatchingAspectRatios
+ ? firstPhotoAspectRatio
+ : 1
+ : Math.max(
+ minimumPostPhotoFrameAspectRatio,
+ photoDimensions.width / photoDimensions.height,
+ );
const isPhotoReady = Boolean(displayImageUrl) && decodedPhoto.ready;
const showSoundControl =
!isPostUnavailable && shouldPreloadVideo && Boolean(activePhoto.video);