Skip to content

armgit / ente

Public Imported from GitHub
0

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

Nomen

Manav Rathi7b8ca828c929
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
index 0b2bc87a06..86f3c61070 100644
--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
@@ -1,5 +1,5 @@
import { assertionFailed } from "@/base/assert";
-import { SpaceBetweenFlex } from "@/base/components/containers";
+import { SpacedRow } from "@/base/components/containers";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import {
OverflowMenu,
@@ -103,14 +103,14 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = (props) => {
return (
<GalleryItemsHeaderAdapter>
- <SpaceBetweenFlex>
+ <SpacedRow>
<GalleryItemsSummary
name={name}
fileCount={fileCount}
endIcon={<EndIcon type={type} />}
/>
{shouldShowOptions(type) && <CollectionOptions {...props} />}
- </SpaceBetweenFlex>
+ </SpacedRow>
</GalleryItemsHeaderAdapter>
);
};
diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx
index c47507d2b3..89006ab32b 100644
--- a/web/apps/photos/src/components/Sidebar/index.tsx
+++ b/web/apps/photos/src/components/Sidebar/index.tsx
@@ -4,7 +4,7 @@ import { isDesktop } from "@/base/app";
import { EnteLogo } from "@/base/components/EnteLogo";
import { LinkButton } from "@/base/components/LinkButton";
import { RowButton } from "@/base/components/RowButton";
-import { SpaceBetweenFlex } from "@/base/components/containers";
+import { SpacedRow } from "@/base/components/containers";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { SidebarDrawer } from "@/base/components/mui/SidebarDrawer";
import { useIsSmallWidth } from "@/base/components/utils/hooks";
@@ -133,9 +133,7 @@ interface HeaderSectionProps {
const HeaderSection: React.FC<HeaderSectionProps> = ({ closeSidebar }) => {
return (
- <SpaceBetweenFlex
- sx={{ marginBlock: "4px 4px", paddingInlineStart: "12px" }}
- >
+ <SpacedRow sx={{ my: "4px 4px", pl: "12px" }}>
<EnteLogo />
<IconButton
aria-label={t("close")}
@@ -144,7 +142,7 @@ const HeaderSection: React.FC<HeaderSectionProps> = ({ closeSidebar }) => {
>
<CloseIcon fontSize="small" />
</IconButton>
- </SpaceBetweenFlex>
+ </SpacedRow>
);
};
@@ -345,7 +343,7 @@ function MemberSubscriptionManage({ open, userDetails, onClose }) {
return (
<Dialog {...{ open, onClose, fullScreen }} maxWidth="xs" fullWidth>
- <SpaceBetweenFlex sx={{ p: "20px 8px 12px 16px" }}>
+ <SpacedRow sx={{ p: "20px 8px 12px 16px" }}>
<Stack>
<Typography variant="h3">{t("subscription")}</Typography>
<Typography sx={{ color: "text.muted" }}>
@@ -353,7 +351,7 @@ function MemberSubscriptionManage({ open, userDetails, onClose }) {
</Typography>
</Stack>
<DialogCloseIconButton {...{ onClose }} />
- </SpaceBetweenFlex>
+ </SpacedRow>
<DialogContent>
<VerticallyCentered>
<Box sx={{ mb: 4 }}>
diff --git a/web/apps/photos/src/components/Upload/UploadTypeSelector.tsx b/web/apps/photos/src/components/Upload/UploadTypeSelector.tsx
index ec27a27ad5..065cea33b0 100644
--- a/web/apps/photos/src/components/Upload/UploadTypeSelector.tsx
+++ b/web/apps/photos/src/components/Upload/UploadTypeSelector.tsx
@@ -1,4 +1,4 @@
-import { SpaceBetweenFlex } from "@/base/components/containers";
+import { SpacedRow } from "@/base/components/containers";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import { RowButton } from "@/base/components/RowButton";
import { useIsTouchscreen } from "@/base/components/utils/hooks";
@@ -165,7 +165,7 @@ const DefaultOptions: React.FC<OptionsProps> = ({
}) => {
return (
<>
- <SpaceBetweenFlex>
+ <SpacedRow>
<DialogTitle variant="h5">
{intent == "collect"
? t("select_photos")
@@ -174,7 +174,7 @@ const DefaultOptions: React.FC<OptionsProps> = ({
: t("upload")}
</DialogTitle>
<DialogCloseIconButton {...{ onClose }} />
- </SpaceBetweenFlex>
+ </SpacedRow>
<Box sx={{ p: "12px", pt: "16px" }}>
<Stack sx={{ gap: 0.5 }}>
{intent != "import" && (
@@ -221,10 +221,10 @@ const TakeoutOptions: React.FC<Omit<OptionsProps, "intent">> = ({
}) => {
return (
<>
- <SpaceBetweenFlex>
+ <SpacedRow>
<DialogTitle variant="h5">{t("google_takeout")}</DialogTitle>
<DialogCloseIconButton {...{ onClose }} />
- </SpaceBetweenFlex>
+ </SpacedRow>
<Stack sx={{ padding: "18px 12px 20px 12px", gap: "16px" }}>
<Stack sx={{ gap: "8px" }}>
<FocusVisibleButton
diff --git a/web/apps/photos/src/components/WatchFolder.tsx b/web/apps/photos/src/components/WatchFolder.tsx
index 1ab106082a..985cf61224 100644
--- a/web/apps/photos/src/components/WatchFolder.tsx
+++ b/web/apps/photos/src/components/WatchFolder.tsx
@@ -1,4 +1,4 @@
-import { CenteredFlex, SpaceBetweenFlex } from "@/base/components/containers";
+import { CenteredFill, SpacedRow } from "@/base/components/containers";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import {
OverflowMenu,
@@ -122,12 +122,12 @@ export const WatchFolder: React.FC<ModalVisibilityProps> = ({
paper: { sx: { height: "448px", maxWidth: "444px" } },
}}
>
- <SpaceBetweenFlex sx={{ p: "16px 8px 0px 8px" }}>
+ <SpacedRow sx={{ p: "16px 8px 0px 8px" }}>
<DialogTitle variant="h3">
{t("watched_folders")}
</DialogTitle>
<DialogCloseIconButton {...{ onClose }} />
- </SpaceBetweenFlex>
+ </SpacedRow>
<DialogContent sx={{ flex: 1 }}>
<Stack sx={{ gap: 1, p: 1.5, height: "100%" }}>
<WatchList {...{ watches, removeWatch }} />
@@ -170,30 +170,28 @@ const WatchList: React.FC<WatchList> = ({ watches, removeWatch }) =>
</Stack>
);
-const NoWatches: React.FC = () => {
- return (
- <CenteredFlex sx={{ flex: 1, mb: 4 }}>
- <Stack sx={{ gap: 1.5 }}>
- <Typography variant="h6">{t("no_folders_added")}</Typography>
- <Typography variant="small" sx={{ py: 1, color: "text.muted" }}>
- {t("watch_folders_hint_1")}
- </Typography>
- <Typography variant="small" sx={{ color: "text.muted" }}>
- <Stack direction="row" sx={{ gap: 1 }}>
- <Check />
- {t("watch_folders_hint_2")}
- </Stack>
- </Typography>
- <Typography variant="small" sx={{ color: "text.muted" }}>
- <Stack direction="row" sx={{ gap: 1 }}>
- <Check />
- {t("watch_folders_hint_3")}
- </Stack>
- </Typography>
- </Stack>
- </CenteredFlex>
- );
-};
+const NoWatches: React.FC = () => (
+ <CenteredFill sx={{ mb: 4 }}>
+ <Stack sx={{ gap: 1.5 }}>
+ <Typography variant="h6">{t("no_folders_added")}</Typography>
+ <Typography variant="small" sx={{ py: 1, color: "text.muted" }}>
+ {t("watch_folders_hint_1")}
+ </Typography>
+ <Typography variant="small" sx={{ color: "text.muted" }}>
+ <Stack direction="row" sx={{ gap: 1 }}>
+ <Check />
+ {t("watch_folders_hint_2")}
+ </Stack>
+ </Typography>
+ <Typography variant="small" sx={{ color: "text.muted" }}>
+ <Stack direction="row" sx={{ gap: 1 }}>
+ <Check />
+ {t("watch_folders_hint_3")}
+ </Stack>
+ </Typography>
+ </Stack>
+ </CenteredFill>
+);
const Check: React.FC = () => (
<CheckIcon
@@ -222,7 +220,7 @@ const WatchEntry: React.FC<WatchEntryProps> = ({ watch, removeWatch }) => {
};
return (
- <SpaceBetweenFlex sx={{ overflow: "hidden", flexShrink: 0 }}>
+ <SpacedRow sx={{ overflow: "hidden", flexShrink: 0 }}>
<Stack direction="row" sx={{ overflow: "hidden", gap: 1.5 }}>
{watch.collectionMapping === "root" ? (
<Tooltip title={t("uploaded_to_single_collection")}>
@@ -239,7 +237,7 @@ const WatchEntry: React.FC<WatchEntryProps> = ({ watch, removeWatch }) => {
</Stack>
</Stack>
<EntryOptions {...{ confirmStopWatching }} />
- </SpaceBetweenFlex>
+ </SpacedRow>
);
};
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index 6c168a0588..0a9c9357dc 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -4,7 +4,7 @@ import {
staticAppTitle,
wipDesktopCustomTitlebar,
} from "@/base/app";
-import { CenteredFlex } from "@/base/components/containers";
+import { CenteredRow } from "@/base/components/containers";
import { CustomHead } from "@/base/components/Head";
import {
LoadingIndicator,
@@ -226,10 +226,9 @@ const WindowTitlebar: React.FC<React.PropsWithChildren> = ({ children }) => (
);
// See: [Note: Customize the desktop title bar]
-const WindowTitlebarArea = styled(CenteredFlex)`
+const WindowTitlebarArea = styled(CenteredRow)`
width: 100%;
height: env(titlebar-area-height, 30px /* fallback */);
- display: flex;
/* Allow using the titlebar to drag the window */
app-region: drag;
`;
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index 5888827b9e..695fdec9d6 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -1,6 +1,6 @@
import { LoginContents } from "@/accounts/components/LoginContents";
import { SignUpContents } from "@/accounts/components/SignUpContents";
-import { CenteredFill, CenteredFlex } from "@/base/components/containers";
+import { CenteredFill, CenteredRow } from "@/base/components/containers";
import { EnteLogo } from "@/base/components/EnteLogo";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
@@ -300,7 +300,7 @@ const MobileBoxFooter: React.FC<MobileBoxFooterProps> = ({ host }) => {
);
};
-const DesktopBox = styled(CenteredFlex)`
+const DesktopBox = styled(CenteredRow)`
flex-shrink: 0;
flex-grow: 2;
flex-basis: auto;
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 8b4f36a8a5..ab7c1f1bbe 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -2,10 +2,7 @@ import {
AccountsPageContents,
AccountsPageTitle,
} from "@/accounts/components/layouts/centered-paper";
-import {
- SpaceBetweenFlex,
- Stack100vhCenter,
-} from "@/base/components/containers";
+import { SpacedRow, Stack100vhCenter } from "@/base/components/containers";
import { EnteLogo } from "@/base/components/EnteLogo";
import {
LoadingIndicator,
@@ -588,7 +585,7 @@ const SharedAlbumNavbar: React.FC<SharedAlbumNavbarProps> = ({
"@media (width < 720px)": { px: "4px" },
}}
>
- <SpaceBetweenFlex sx={{ flex: 1 }}>
+ <SpacedRow sx={{ flex: 1 }}>
<EnteLogoLink href="https://ente.io">
<EnteLogo height={15} />
</EnteLogoLink>
@@ -597,7 +594,7 @@ const SharedAlbumNavbar: React.FC<SharedAlbumNavbarProps> = ({
) : (
<GoToEnte />
)}
- </SpaceBetweenFlex>
+ </SpacedRow>
</NavbarBaseNormalFlow>
);
@@ -724,7 +721,7 @@ const ListHeader: React.FC<ListHeaderProps> = ({
return (
<GalleryItemsHeaderAdapter>
- <SpaceBetweenFlex>
+ <SpacedRow>
<GalleryItemsSummary
name={publicCollection.name}
fileCount={publicFiles.length}
@@ -739,7 +736,7 @@ const ListHeader: React.FC<ListHeaderProps> = ({
</OverflowMenuOption>
</OverflowMenu>
)}
- </SpaceBetweenFlex>
+ </SpacedRow>
</GalleryItemsHeaderAdapter>
);
};
diff --git a/web/packages/accounts/components/CodeBlock.tsx b/web/packages/accounts/components/CodeBlock.tsx
index 2340ef0626..955312b964 100644
--- a/web/packages/accounts/components/CodeBlock.tsx
+++ b/web/packages/accounts/components/CodeBlock.tsx
@@ -1,4 +1,4 @@
-import { CenteredFlex } from "@/base/components/containers";
+import { CenteredRow } from "@/base/components/containers";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
import DoneIcon from "@mui/icons-material/Done";
@@ -22,9 +22,9 @@ interface CodeBlockProps {
export const CodeBlock: React.FC<CodeBlockProps> = ({ code }) => {
if (!code) {
return (
- <CenteredFlex sx={{ minHeight: "80px" }}>
+ <CenteredRow sx={{ minHeight: "80px" }}>
<ActivityIndicator />
- </CenteredFlex>
+ </CenteredRow>
);
}
diff --git a/web/packages/accounts/components/RecoveryKey.tsx b/web/packages/accounts/components/RecoveryKey.tsx
index 82d441d3cc..67f69f1675 100644
--- a/web/packages/accounts/components/RecoveryKey.tsx
+++ b/web/packages/accounts/components/RecoveryKey.tsx
@@ -1,5 +1,5 @@
import { type MiniDialogAttributes } from "@/base/components/MiniDialog";
-import { SpaceBetweenFlex } from "@/base/components/containers";
+import { SpacedRow } from "@/base/components/containers";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import { errorDialogAttributes } from "@/base/components/utils/dialog";
import { useIsSmallWidth } from "@/base/components/utils/hooks";
@@ -74,10 +74,10 @@ export const RecoveryKey: React.FC<RecoveryKeyProps> = ({
maxWidth="xs"
fullWidth
>
- <SpaceBetweenFlex sx={{ p: "8px 4px 8px 0" }}>
+ <SpacedRow sx={{ p: "8px 4px 8px 0" }}>
<DialogTitle variant="h3">{t("recovery_key")}</DialogTitle>
<DialogCloseIconButton {...{ onClose }} />
- </SpaceBetweenFlex>
+ </SpacedRow>
<DialogContent>
<Typography sx={{ mb: 3 }}>
{t("recovery_key_description")}
diff --git a/web/packages/base/components/containers.tsx b/web/packages/base/components/containers.tsx
index d3aaa0558c..d2ae57d3ad 100644
--- a/web/packages/base/components/containers.tsx
+++ b/web/packages/base/components/containers.tsx
@@ -11,32 +11,33 @@ export const Stack100vhCenter = styled(Stack)`
`;
/**
- * A flexbox with justify content set to space-between and center alignment.
+ * A flexbox with justify content set to space-between and item alignment set to
+ * center.
*
* 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 SpaceBetweenFlex = styled("div")`
+export const SpacedRow = styled("div")`
display: flex;
justify-content: space-between;
align-items: center;
`;
/**
- * A flex child that shows its children after centering them both vertically and
+ * A flexbox that shows its children after centering them both vertically and
* horizontally.
*/
-export const CenteredFlex = styled("div")`
+export const CenteredRow = styled("div")`
display: flex;
justify-content: center;
align-items: center;
`;
/**
- * A flex child that fills the entire flex direction, and shows its children
- * after centering them both vertically and horizontally.
+ * A flexbox that fills the entire flex direction, and shows its children after
+ * centering them both vertically and horizontally.
*/
export const CenteredFill = styled("div")`
flex: 1;
diff --git a/web/packages/new/photos/components/CollectionMappingChoice.tsx b/web/packages/new/photos/components/CollectionMappingChoice.tsx
index c18c8e1f75..fdcda398c1 100644
--- a/web/packages/new/photos/components/CollectionMappingChoice.tsx
+++ b/web/packages/new/photos/components/CollectionMappingChoice.tsx
@@ -1,4 +1,4 @@
-import { SpaceBetweenFlex } from "@/base/components/containers";
+import { SpacedRow } from "@/base/components/containers";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import type { ModalVisibilityProps } from "@/base/components/utils/modal";
import type { CollectionMapping } from "@/base/types/ipc";
@@ -36,10 +36,10 @@ export const CollectionMappingChoice: React.FC<
fullWidth
slotProps={{ paper: { sx: { maxWidth: "360px", padding: "12px" } } }}
>
- <SpaceBetweenFlex sx={{ paddingInlineEnd: "4px" }}>
+ <SpacedRow sx={{ pr: "4px" }}>
<DialogTitle>{t("multi_folder_upload")}</DialogTitle>
<DialogCloseIconButton {...{ onClose }} />
- </SpaceBetweenFlex>
+ </SpacedRow>
<DialogContent
sx={{
diff --git a/web/packages/new/photos/components/CollectionSelector.tsx b/web/packages/new/photos/components/CollectionSelector.tsx
index ed0eb489a0..af8b0b13fd 100644
--- a/web/packages/new/photos/components/CollectionSelector.tsx
+++ b/web/packages/new/photos/components/CollectionSelector.tsx
@@ -1,4 +1,4 @@
-import { SpaceBetweenFlex } from "@/base/components/containers";
+import { SpacedRow } from "@/base/components/containers";
import type { ModalVisibilityProps } from "@/base/components/utils/modal";
import type { Collection } from "@/media/collection";
import {
@@ -166,10 +166,10 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = ({
fullScreen={isFullScreen}
slotProps={{ paper: { sx: { maxWidth: "490px" } } }}
>
- <SpaceBetweenFlex sx={{ padding: "10px 8px 6px 0" }}>
+ <SpacedRow sx={{ padding: "10px 8px 6px 0" }}>
<DialogTitle variant="h3">{titleForAction(action)}</DialogTitle>
<DialogCloseIconButton onClose={handleClose} />
- </SpaceBetweenFlex>
+ </SpacedRow>
<DialogContent_>
<LargeTileCreateNewButton onClick={onCreateCollection}>
diff --git a/web/packages/new/photos/components/PlanSelector.tsx b/web/packages/new/photos/components/PlanSelector.tsx
index e8342bd6c7..de5224e883 100644
--- a/web/packages/new/photos/components/PlanSelector.tsx
+++ b/web/packages/new/photos/components/PlanSelector.tsx
@@ -1,4 +1,4 @@
-import { SpaceBetweenFlex } from "@/base/components/containers";
+import { SpacedRow } from "@/base/components/containers";
import type { ButtonishProps } from "@/base/components/mui";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import {
@@ -641,7 +641,7 @@ const FreePlanRow: React.FC<FreePlanRowProps> = ({ onClose, storage }) => (
</FreePlanRow_>
);
-const FreePlanRow_ = styled(SpaceBetweenFlex)(({ theme }) => ({
+const FreePlanRow_ = styled(SpacedRow)(({ theme }) => ({
gap: theme.spacing(1.5),
padding: theme.spacing(1.5, 1),
cursor: "pointer",
diff --git a/web/packages/new/photos/components/gallery/PeopleHeader.tsx b/web/packages/new/photos/components/gallery/PeopleHeader.tsx
index 8e4e19fda8..48acc3f488 100644
--- a/web/packages/new/photos/components/gallery/PeopleHeader.tsx
+++ b/web/packages/new/photos/components/gallery/PeopleHeader.tsx
@@ -1,4 +1,4 @@
-import { CenteredFill, SpaceBetweenFlex } from "@/base/components/containers";
+import { CenteredFill, SpacedRow } from "@/base/components/containers";
import { ActivityErrorIndicator } from "@/base/components/ErrorIndicator";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
@@ -85,7 +85,7 @@ export const PeopleHeader: React.FC<PeopleHeaderProps> = ({
}) => {
return (
<GalleryItemsHeaderAdapter>
- <SpaceBetweenFlex>
+ <SpacedRow>
{person.type == "cgroup" ? (
person.isHidden ? (
<IgnoredPersonHeader person={person} />
@@ -98,7 +98,7 @@ export const PeopleHeader: React.FC<PeopleHeaderProps> = ({
{...{ people, onSelectPerson }}
/>
)}
- </SpaceBetweenFlex>
+ </SpacedRow>
</GalleryItemsHeaderAdapter>
);
};
@@ -351,10 +351,10 @@ const AddPersonDialog: React.FC<AddPersonDialogProps> = ({
fullScreen={isFullScreen}
slotProps={{ paper: { sx: { maxWidth: "490px" } } }}
>
- <SpaceBetweenFlex sx={{ padding: "10px 8px 6px 0" }}>
+ <SpacedRow sx={{ padding: "10px 8px 6px 0" }}>
<DialogTitle variant="h3">{t("add_name")}</DialogTitle>
<DialogCloseIconButton {...{ onClose }} />
- </SpaceBetweenFlex>
+ </SpacedRow>
<DialogContent_>
<LargeTileCreateNewButton onClick={handleAddPerson}>
{t("new_person")}
@@ -626,7 +626,7 @@ const SuggestionsDialog: React.FC<SuggestionsDialogProps> = ({
fullScreen={isSmallWidth}
slotProps={{ paper: { sx: { minHeight: "80svh" } } }}
>
- <SpaceBetweenFlex
+ <SpacedRow
sx={[
{ padding: "20px 16px 16px 16px" },
state.showChoices
@@ -662,7 +662,7 @@ const SuggestionsDialog: React.FC<SuggestionsDialogProps> = ({
<RestoreIcon />
</IconButton>
)}
- </SpaceBetweenFlex>
+ </SpacedRow>
<DialogContent
/* Reset scroll position on switching view */
key={`${state.showChoices}`}