Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor(photos):match-ml-drawer-to-sidebar-styles

Aswin Asok7156b2039bc4
diff --git a/web/apps/photos/src/components/sidebar/preferences/MLSettings.tsx b/web/apps/photos/src/components/sidebar/preferences/MLSettings.tsx
index 23889daa21..39b410ba1f 100644
--- a/web/apps/photos/src/components/sidebar/preferences/MLSettings.tsx
+++ b/web/apps/photos/src/components/sidebar/preferences/MLSettings.tsx
@@ -3,20 +3,20 @@ import {
Box,
Button,
Checkbox,
- Divider,
FormControlLabel,
FormGroup,
Link,
Stack,
Typography,
} from "@mui/material";
-import { RowButtonGroup, RowSwitch } from "ente-base/components/RowButton";
+import { EnteSwitch } from "ente-base/components/EnteSwitch";
import { ActivityIndicator } from "ente-base/components/mui/ActivityIndicator";
import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
import {
TitledNestedSidebarDrawer,
type NestedSidebarDrawerVisibilityProps,
} from "ente-base/components/mui/SidebarDrawer";
+import { RowCard } from "ente-base/components/v2/RowCard";
import { useBaseContext } from "ente-base/context";
import { useMLStatusSnapshot } from "ente-new/photos/components/utils/use-snapshot";
import {
@@ -104,8 +104,8 @@ export const EnableML: React.FC<EnableMLProps> = ({
openURL("https://ente.com/help/photos/features/machine-learning");
return (
- <Stack sx={{ gap: "32px", py: "20px", px: 2 }}>
- <Typography sx={{ color: "text.muted" }}>
+ <Stack sx={{ gap: 3, py: 1, px: 2 }}>
+ <Typography sx={{ color: "text.muted", px: 1 }}>
{t("ml_search_description")}
</Typography>
<Stack sx={{ gap: "8px" }}>
@@ -117,7 +117,7 @@ export const EnableML: React.FC<EnableMLProps> = ({
</Button>
</Stack>
{showMagicSearchHint && (
- <Typography variant="small" sx={{ color: "text.faint" }}>
+ <Typography variant="small" sx={{ color: "text.faint", px: 1 }}>
{t("ml_search_footnote")}
</Typography>
)}
@@ -176,7 +176,7 @@ export const FaceConsent: React.FC<FaceConsentProps> = ({
);
return (
- <Stack sx={{ gap: "32px", py: "20px", px: "8px" }}>
+ <Stack sx={{ gap: 3, py: 1, px: 2 }}>
<Typography component="div" sx={{ color: "text.muted", px: "8px" }}>
<Trans
i18nKey={"ml_consent_description"}
@@ -185,7 +185,7 @@ export const FaceConsent: React.FC<FaceConsentProps> = ({
</Typography>
<FormGroup sx={{ width: "100%" }}>
<FormControlLabel
- sx={{ color: "text.muted", ml: 0, mt: 2 }}
+ sx={{ color: "text.muted", ml: 0 }}
control={
<Checkbox
size="small"
@@ -196,7 +196,7 @@ export const FaceConsent: React.FC<FaceConsentProps> = ({
label={t("ml_consent_confirmation")}
/>
</FormGroup>
- <Stack sx={{ gap: "8px", px: "8px" }}>
+ <Stack sx={{ gap: 1 }}>
<FocusVisibleButton
fullWidth
color="accent"
@@ -260,52 +260,47 @@ const ManageML: React.FC<ManageMLProps> = ({ mlStatus, onDisableML }) => {
});
return (
- <Stack sx={{ px: "16px", py: "20px", gap: 4 }}>
- <Stack sx={{ gap: 3 }}>
- <RowButtonGroup>
- <RowSwitch
- label={t("enabled")}
- checked={true}
- onClick={confirmDisableML}
+ <Stack sx={{ px: 2, py: 1, gap: 1 }}>
+ <RowCard
+ title={t("enabled")}
+ endIcon={
+ <EnteSwitch
+ checked
+ onChange={confirmDisableML}
+ slotProps={{ input: { "aria-label": t("enabled") } }}
/>
- </RowButtonGroup>
- </Stack>
-
- <Stack>
- <Stack
- direction="row"
- sx={{
- gap: 2,
- px: 2,
- pt: 1,
- pb: 2,
- justifyContent: "space-between",
- }}
- >
- <Typography sx={{ color: "text.faint" }}>
+ }
+ />
+ <RowCard
+ title={
+ <Typography
+ component="span"
+ sx={{ color: "text.faint", pl: 1 }}
+ >
{t("indexing")}
</Typography>
- <Typography>{status}</Typography>
- </Stack>
- <Divider sx={{ mx: 1.5 }} />
- <Stack
- direction="row"
- sx={{
- gap: 2,
- px: 2,
- pt: 2,
- pb: 1,
- justifyContent: "space-between",
- }}
- >
- <Typography sx={{ color: "text.faint" }}>
+ }
+ endIcon={
+ <Typography sx={{ textAlign: "right" }}>
+ {status}
+ </Typography>
+ }
+ />
+ <RowCard
+ title={
+ <Typography
+ component="span"
+ sx={{ color: "text.faint", pl: 1 }}
+ >
{t("processed")}
</Typography>
+ }
+ endIcon={
<Typography sx={{ textAlign: "right" }}>
{processed}
</Typography>
- </Stack>
- </Stack>
+ }
+ />
</Stack>
);
};