Skip to content

armgit / ente

Public Imported from GitHub
0

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

new

Manav Rathi34edc9b2e8bc
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
index f3adf25f9b..b9f3c459c4 100644
--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
@@ -6,14 +6,12 @@ import {
GalleryItemsHeaderAdapter,
GalleryItemsSummary,
} from "@/new/photos/components/Gallery/ListHeader";
+import { SpaceBetweenBox } from "@/new/photos/components/mui-custom";
import type {
CollectionSummary,
CollectionSummaryType,
} from "@/new/photos/types/collection";
-import {
- HorizontalFlex,
- SpaceBetweenFlex,
-} from "@ente/shared/components/Container";
+import { HorizontalFlex } from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import OverflowMenu, {
StyledMenu,
@@ -77,7 +75,7 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = ({
...rest
}) => {
if (!collectionSummary) {
- assertionFailed("CollectionListHeader without a collection");
+ assertionFailed("Gallery/CollectionHeader without a collection");
return <></>;
}
@@ -103,7 +101,7 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = ({
return (
<GalleryItemsHeaderAdapter>
- <SpaceBetweenFlex>
+ <SpaceBetweenBox>
<GalleryItemsSummary
name={name}
fileCount={fileCount}
@@ -112,7 +110,7 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = ({
{shouldShowOptions(type) && (
<CollectionOptions collectionSummaryType={type} {...rest} />
)}
- </SpaceBetweenFlex>
+ </SpaceBetweenBox>
</GalleryItemsHeaderAdapter>
);
};
diff --git a/web/apps/photos/src/components/Collections/index.tsx b/web/apps/photos/src/components/Collections/index.tsx
index 93e0529c7f..8152d061e4 100644
--- a/web/apps/photos/src/components/Collections/index.tsx
+++ b/web/apps/photos/src/components/Collections/index.tsx
@@ -58,6 +58,13 @@ type CollectionsProps = Omit<
setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator;
};
+/**
+ * The horizontally scrollable bar shown at the top of the gallery.
+ *
+ * This component includes both the actual bar, and also the surrounding chrome
+ * and state for any associated dialogs that might be triggered by actions on
+ * the bar.
+ */
// TODO-Cluster Rename me to GalleryBar and subsume GalleryBarImpl
export const Collections: React.FC<CollectionsProps> = ({
shouldHide,
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 177a3f5446..1baa2146b6 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -7,13 +7,13 @@ import {
GalleryItemsHeaderAdapter,
GalleryItemsSummary,
} from "@/new/photos/components/Gallery/ListHeader";
+import { SpaceBetweenBox } from "@/new/photos/components/mui-custom";
import downloadManager from "@/new/photos/services/download";
import { EnteFile } from "@/new/photos/types/file";
import { mergeMetadata } from "@/new/photos/utils/file";
import {
CenteredFlex,
FluidContainer,
- SpaceBetweenFlex,
VerticallyCentered,
} from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
@@ -307,12 +307,12 @@ export default function PublicCollectionGallery() {
setPhotoListHeader({
item: (
<GalleryItemsHeaderAdapter>
- <SpaceBetweenFlex>
+ <SpaceBetweenBox>
<GalleryItemsSummary
name={publicCollection.name}
fileCount={publicFiles.length}
/>
- {downloadEnabled ? (
+ {downloadEnabled && (
<OverflowMenu
ariaControls={"collection-options"}
triggerButtonIcon={<MoreHoriz />}
@@ -324,10 +324,8 @@ export default function PublicCollectionGallery() {
{t("download_album")}
</OverflowMenuOption>
</OverflowMenu>
- ) : (
- <div />
)}
- </SpaceBetweenFlex>
+ </SpaceBetweenBox>
</GalleryItemsHeaderAdapter>
),
itemType: ITEM_TYPE.HEADER,
diff --git a/web/packages/new/photos/components/mui-custom.tsx b/web/packages/new/photos/components/mui-custom.tsx
index 9250226bb2..ce378f198a 100644
--- a/web/packages/new/photos/components/mui-custom.tsx
+++ b/web/packages/new/photos/components/mui-custom.tsx
@@ -1,4 +1,4 @@
-import { IconButton, styled } from "@mui/material";
+import { Box, IconButton, styled } from "@mui/material";
/**
* A MUI {@link IconButton} filled in with at faint background.
@@ -31,3 +31,17 @@ export const UnstyledButton = styled("button")`
/* The button default is to show an flipped arrow. Show a hand instead. */
cursor: pointer;
`;
+
+/**
+ * A flexbox with justify content set to space-between and center alignment.
+ *
+ * There is also another SpaceBetweenFlex in the old shared package, but that
+ * one also sets width: 100%. As such, that one should be considered deprecated
+ * and its uses moved to this one when possible (so that we can then see where
+ * the width: 100% is essential).
+ */
+export const SpaceBetweenBox = styled(Box)`
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+`;