Skip to content

armgit / ente

Public Imported from GitHub
0

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

feat(photos):revamp-free-up-space-settings

Aswin Asok912d6b327784
diff --git a/web/apps/photos/src/components/sidebar/FreeUpSpace.tsx b/web/apps/photos/src/components/sidebar/FreeUpSpace.tsx
index 0d33e16298..1ae52d39e9 100644
--- a/web/apps/photos/src/components/sidebar/FreeUpSpace.tsx
+++ b/web/apps/photos/src/components/sidebar/FreeUpSpace.tsx
@@ -1,9 +1,5 @@
import { Stack } from "@mui/material";
-import {
- RowButton,
- RowButtonDivider,
- RowButtonGroup,
-} from "ente-base/components/RowButton";
+import { RowCard } from "ente-base/components/RowButton";
import {
TitledNestedSidebarDrawer,
type NestedSidebarDrawerVisibilityProps,
@@ -71,19 +67,21 @@ export const FreeUpSpace: React.FC<FreeUpSpaceProps> = ({
{...{ open, onClose }}
onRootClose={handleRootClose}
title={t("free_up_space")}
+ caption="Review large files and duplicates to reclaim storage."
+ contentInset="0.5rem"
+ titleFontSize="22px"
>
- <Stack sx={{ px: 2, py: 1, gap: 3 }}>
- <RowButtonGroup>
- <RowButton
- label={t("deduplicate_files")}
- onClick={handleDeduplicate}
- />
- <RowButtonDivider />
- <RowButton
- label={t("large_files_title")}
- onClick={handleLargeFiles}
- />
- </RowButtonGroup>
+ <Stack sx={{ px: 2, py: 1, gap: 1 }}>
+ <RowCard
+ title="Duplicates"
+ subtitle="Remove exact duplicates"
+ onClick={handleDeduplicate}
+ />
+ <RowCard
+ title={t("large_files_title")}
+ subtitle="Identify items using the most space"
+ onClick={handleLargeFiles}
+ />
</Stack>
</TitledNestedSidebarDrawer>
);
diff --git a/web/packages/base/components/RowButton.tsx b/web/packages/base/components/RowButton.tsx
index 83f2882890..415d583021 100644
--- a/web/packages/base/components/RowButton.tsx
+++ b/web/packages/base/components/RowButton.tsx
@@ -1,3 +1,4 @@
+import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import {
Box,
Divider,
@@ -151,6 +152,63 @@ export const RowButton: React.FC<RowButtonProps> = ({
</RowButtonRoot>
);
+interface RowCardProps {
+ title: string;
+ subtitle: string;
+ onClick: () => void;
+}
+
+/**
+ * A tappable summary card with a title, subtitle, and trailing chevron.
+ * Its background appears on hover.
+ */
+export const RowCard: React.FC<RowCardProps> = ({
+ title,
+ subtitle,
+ onClick,
+}) => (
+ <FocusVisibleButton
+ fullWidth
+ onClick={onClick}
+ sx={[
+ {
+ p: "14px 8px 14px 0.5rem",
+ gap: 1,
+ justifyContent: "space-between",
+ alignItems: "center",
+ textAlign: "left",
+ borderRadius: "10px",
+ color: "text.base",
+ bgcolor: "transparent",
+ "&:hover": { bgcolor: "fill.faintHover" },
+ "& .MuiSvgIcon-root": { fontSize: "20px", color: "text.muted" },
+ },
+ (theme) =>
+ theme.applyStyles("dark", {
+ "&:hover": { bgcolor: "backdrop.muted" },
+ }),
+ ]}
+ >
+ <Stack sx={{ minWidth: 0 }}>
+ <Typography noWrap sx={{ fontWeight: "medium" }}>
+ {title}
+ </Typography>
+ <Typography
+ noWrap
+ variant="small"
+ sx={{
+ color: "text.muted",
+ lineHeight: "20px",
+ fontWeight: 400,
+ }}
+ >
+ {subtitle}
+ </Typography>
+ </Stack>
+ <ChevronRightIcon />
+ </FocusVisibleButton>
+);
+
type RowButtonRootProps = ButtonProps & {
rbVariant: RowButtonProps["variant"];
};
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index bcb3b2aa50..8e0e344834 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -88,6 +88,8 @@ type SidebarDrawerTitlebarProps = Pick<
> & {
title: string;
caption?: string;
+ contentInset?: string;
+ titleFontSize?: string;
actionButton?: React.ReactNode;
showRootCloseButton?: boolean;
};
@@ -95,6 +97,8 @@ type SidebarDrawerTitlebarProps = Pick<
export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
title,
caption,
+ contentInset,
+ titleFontSize,
onClose,
onRootClose,
actionButton,
@@ -102,7 +106,11 @@ export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
}) => (
<Stack sx={{ gap: "4px" }}>
<Stack direction="row" sx={{ justifyContent: "space-between" }}>
- <IconButton onClick={onClose} color="primary">
+ <IconButton
+ onClick={onClose}
+ color="primary"
+ sx={{ ml: contentInset }}
+ >
<ArrowBackIcon />
</IconButton>
<Stack direction="row" sx={{ gap: "4px" }}>
@@ -114,14 +122,22 @@ export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
)}
</Stack>
</Stack>
- <Stack sx={{ px: "16px", gap: "4px" }}>
- <Typography variant="h3">{title}</Typography>
+ <Stack
+ sx={{
+ pl: contentInset ? `calc(16px + ${contentInset})` : "16px",
+ pr: "16px",
+ gap: "4px",
+ }}
+ >
+ <Typography variant="h3" sx={{ fontSize: titleFontSize }}>
+ {title}
+ </Typography>
<Typography
variant="small"
sx={{
color: "text.muted",
wordBreak: "break-all",
- px: "1px",
+ px: contentInset ? 0 : "1px",
minHeight: "17px",
}}
>