Skip to content

armgit / ente

Public Imported from GitHub
0

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

update(locker):menu-styles-updated

Aswin Asok647e4448458b
diff --git a/web/packages/contacts/legacy/components/ActionButton.tsx b/web/packages/contacts/legacy/components/ActionButton.tsx
index 3477369cc4..b517ab6115 100644
--- a/web/packages/contacts/legacy/components/ActionButton.tsx
+++ b/web/packages/contacts/legacy/components/ActionButton.tsx
@@ -17,7 +17,7 @@ interface ActionButtonProps extends Omit<ButtonProps, "color" | "variant"> {
const pillSx = {
minHeight: 52,
- borderRadius: "999px",
+ borderRadius: "20px",
px: 3,
py: 1.5,
fontWeight: 600,
@@ -83,17 +83,8 @@ const typeSx = {
fontWeight: 600,
textTransform: "none",
color: "accent.main",
- textDecoration: "underline",
- textDecorationColor: "accent.main",
- "&:hover": {
- backgroundColor: "transparent",
- color: "accent.main",
- textDecorationColor: "accent.main",
- },
- "&.Mui-disabled": {
- color: "text.muted",
- textDecorationColor: "text.muted",
- },
+ "&:hover": { backgroundColor: "transparent", color: "accent.main" },
+ "&.Mui-disabled": { color: "text.muted" },
},
} satisfies Record<ActionButtonType, ButtonProps["sx"]>;
diff --git a/web/packages/contacts/legacy/components/LegacyActionSheet.tsx b/web/packages/contacts/legacy/components/LegacyActionSheet.tsx
index 97e2cd607b..86a9a6391f 100644
--- a/web/packages/contacts/legacy/components/LegacyActionSheet.tsx
+++ b/web/packages/contacts/legacy/components/LegacyActionSheet.tsx
@@ -34,48 +34,72 @@ export const LegacyActionSheet: React.FC<LegacyActionSheetProps> = ({
fullWidth
maxWidth={false}
slotProps={{
- backdrop: { sx: { backgroundColor: "rgba(0, 0, 0, 0.48)" } },
+ backdrop: { sx: { backgroundColor: "rgba(0, 0, 0, 0.55)" } },
+ container: {
+ sx: { alignItems: { xs: "flex-end", sm: "center" } },
+ },
paper: {
- sx: {
+ sx: (theme) => ({
m: 0,
- position: "fixed",
- left: "50%",
- top: "50%",
- transform: "translate(-50%, -50%)",
- width: "min(100%, 375px)",
+ width: "min(100%, 440px)",
maxHeight: "calc(100vh - 48px)",
borderRadius: "24px",
- backgroundColor: "background.paper",
- px: 2,
- pt: 2,
- pb: 2,
+ backgroundColor: "background.default",
+ padding: "20px",
overflowY: "auto",
- },
+ [theme.breakpoints.down("sm")]: {
+ width: "100%",
+ maxWidth: "100%",
+ borderRadius: "20px 20px 0 0",
+ paddingBottom: "34px",
+ m: 0,
+ },
+ }),
},
}}
>
<Stack sx={{ gap: 2.5 }}>
- <Stack direction="row" sx={{ justifyContent: "flex-end" }}>
- <IconButton onClick={onClose} color="secondary">
- <CloseIcon />
- </IconButton>
- </Stack>
- <Stack sx={{ gap: 2 }}>
- <Typography variant="h4" sx={{ wordBreak: "break-word" }}>
+ <Stack
+ direction="row"
+ sx={{ alignItems: "center", gap: 1.5, height: 38 }}
+ >
+ <Typography
+ variant="h6"
+ sx={{
+ wordBreak: "break-word",
+ flex: 1,
+ lineHeight: "24px",
+ }}
+ >
{title}
</Typography>
- {subtitle && (
- <Typography
- variant="body"
- sx={{
- color: "text.muted",
- wordBreak: "break-word",
- }}
- >
- {subtitle}
- </Typography>
- )}
+ <IconButton
+ onClick={onClose}
+ sx={{
+ width: 36,
+ height: 36,
+ p: 0,
+ borderRadius: "50%",
+ bgcolor: "background.paper",
+ flexShrink: 0,
+ "&:hover": { bgcolor: "fill.faintHover" },
+ }}
+ >
+ <CloseIcon sx={{ fontSize: 18 }} />
+ </IconButton>
</Stack>
+ {subtitle && (
+ <Typography
+ variant="small"
+ sx={{
+ color: "text.muted",
+ wordBreak: "break-word",
+ lineHeight: "20px",
+ }}
+ >
+ {subtitle}
+ </Typography>
+ )}
{children}
</Stack>
</Dialog>
diff --git a/web/packages/contacts/legacy/components/LegacyAddContactContent.tsx b/web/packages/contacts/legacy/components/LegacyAddContactContent.tsx
index d29be3faa4..cd4d4a68e3 100644
--- a/web/packages/contacts/legacy/components/LegacyAddContactContent.tsx
+++ b/web/packages/contacts/legacy/components/LegacyAddContactContent.tsx
@@ -1,3 +1,4 @@
+import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import SearchIcon from "@mui/icons-material/Search";
import {
Box,
@@ -176,10 +177,27 @@ export const LegacyAddContactContent: React.FC<
showMiniDialog({
title: "Add trusted contact?",
- message: `Ente will wait ${selectedRecoveryDays} days before ${normalizedEmail} can recover your account.`,
+ message: (
+ <Stack sx={{ gap: 2 }}>
+ <LegacyIdentityRow email={normalizedEmail} />
+ <Typography
+ variant="small"
+ sx={{ color: "text.muted", lineHeight: "20px" }}
+ >
+ Ente will wait{" "}
+ <Box
+ component="span"
+ sx={{ color: "text.base", fontWeight: 600 }}
+ >
+ {selectedRecoveryDays} days
+ </Box>{" "}
+ before {normalizedEmail} can recover your
+ account.
+ </Typography>
+ </Stack>
+ ),
continue: {
text: "Add trusted contact",
- color: "primary",
action: async () => {
try {
await legacyAddContact(
@@ -215,11 +233,14 @@ export const LegacyAddContactContent: React.FC<
const isSheet = variant === "sheet";
return (
- <Stack sx={{ gap: 2, ...(isSheet ? {} : { px: 2, pb: 2 }) }}>
+ <Stack sx={{ gap: 3, ...(isSheet ? {} : { px: 2, pb: 2 }) }}>
{!isSheet && (
<Stack sx={{ gap: 1 }}>
<Typography variant="h4">Add trusted contact</Typography>
- <Typography variant="small" sx={{ color: "text.muted" }}>
+ <Typography
+ variant="small"
+ sx={{ color: "text.muted", lineHeight: "20px" }}
+ >
Search an email, verify the identity if needed, and
choose how long recovery should wait.
</Typography>
@@ -228,7 +249,7 @@ export const LegacyAddContactContent: React.FC<
<Stack
sx={{
- gap: 2,
+ gap: 3,
...(isSheet
? {}
: {
@@ -238,40 +259,83 @@ export const LegacyAddContactContent: React.FC<
}),
}}
>
- <TextField
- autoFocus
- size="small"
- type="email"
- value={email}
- onChange={(event) => setEmail(event.target.value)}
- placeholder="Enter email"
- slotProps={{
- input: {
- startAdornment: (
- <InputAdornment position="start">
- <SearchIcon fontSize="small" />
- </InputAdornment>
- ),
- },
- }}
- />
+ <Stack sx={{ gap: 1 }}>
+ <Typography
+ component="label"
+ htmlFor="legacy-add-contact-email"
+ variant="small"
+ sx={{ lineHeight: "20px", width: "fit-content" }}
+ >
+ Email
+ </Typography>
+ <TextField
+ autoFocus
+ fullWidth
+ variant="outlined"
+ margin="none"
+ size="small"
+ type="email"
+ value={email}
+ onChange={(event) => setEmail(event.target.value)}
+ placeholder="Enter email"
+ sx={{
+ "& .MuiOutlinedInput-root": {
+ height: 52,
+ px: 2,
+ borderRadius: "16px",
+ backgroundColor: "background.paper",
+ fontSize: 14,
+ lineHeight: "20px",
+ fontWeight: 500,
+ },
+ "& .MuiOutlinedInput-input": {
+ p: 0,
+ height: "100%",
+ },
+ "& .MuiOutlinedInput-notchedOutline": {
+ borderColor: "stroke.fainter",
+ },
+ "& .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline":
+ { borderColor: "stroke.fainter" },
+ "& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":
+ { borderWidth: 1, borderColor: "stroke.muted" },
+ "& .MuiInputBase-input::placeholder": {
+ color: "text.faint",
+ opacity: 1,
+ },
+ }}
+ slotProps={{
+ htmlInput: { id: "legacy-add-contact-email" },
+ input: {
+ startAdornment: (
+ <InputAdornment position="start">
+ <SearchIcon
+ sx={{
+ color: "accent.main",
+ fontSize: 20,
+ }}
+ />
+ </InputAdornment>
+ ),
+ },
+ }}
+ />
+ </Stack>
{!!filteredSuggestions.length && (
<Stack sx={{ gap: 1 }}>
<Typography
- variant="small"
- sx={{ color: "text.muted" }}
+ variant="body"
+ sx={{ fontWeight: 600, px: 1, py: 0.75 }}
>
Choose from an existing contact
</Typography>
<Stack
sx={{
- gap: 0.5,
- p: 0.75,
- borderRadius: "18px",
- backgroundColor: "fill.faint",
+ gap: 1,
maxHeight: 260,
overflowY: "auto",
+ scrollbarWidth: "thin",
}}
>
{filteredSuggestions.map((user) => (
@@ -284,6 +348,7 @@ export const LegacyAddContactContent: React.FC<
user.email.trim().toLowerCase()
}
onClick={() => setEmail(user.email)}
+ sx={{ bgcolor: "background.paper" }}
/>
))}
</Stack>
@@ -294,8 +359,12 @@ export const LegacyAddContactContent: React.FC<
!filteredSuggestions.length &&
EMAIL_PATTERN.test(normalizedEmail) && (
<Typography
- variant="small"
- sx={{ color: "text.muted" }}
+ variant="mini"
+ sx={{
+ color: "text.muted",
+ lineHeight: "16px",
+ px: 1,
+ }}
>
No existing contact matched. You can still add this
email directly.
@@ -303,32 +372,43 @@ export const LegacyAddContactContent: React.FC<
)}
<Stack sx={{ gap: 1 }}>
- <Typography variant="small" sx={{ color: "text.muted" }}>
+ <Typography
+ variant="body"
+ sx={{ fontWeight: 600, px: 1, py: 0.75 }}
+ >
Choose a recovery time
</Typography>
<LegacyRecoveryDayPicker
selectedDays={selectedRecoveryDays}
onChange={setSelectedRecoveryDays}
+ sx={{
+ "& .MuiToggleButton-root": {
+ backgroundColor: "background.paper",
+ },
+ }}
/>
</Stack>
- <ActionButton
- fullWidth
- buttonType="primary"
- onClick={handleAdd}
- disabled={!email.trim()}
- >
- Add trusted contact
- </ActionButton>
+ <Stack>
+ <ActionButton
+ fullWidth
+ buttonType="primary"
+ onClick={handleAdd}
+ disabled={!email.trim()}
+ >
+ Add trusted contact
+ </ActionButton>
- <ActionButton
- buttonType="link"
- onClick={() => void handleVerify()}
- disabled={!email.trim()}
- sx={{ alignSelf: "center" }}
- >
- Verify
- </ActionButton>
+ <ActionButton
+ buttonType="link"
+ onClick={() => void handleVerify()}
+ disabled={!email.trim()}
+ sx={{ alignSelf: "center", p: "12px 8px" }}
+ endIcon={<ChevronRightIcon sx={{ fontSize: 16 }} />}
+ >
+ Verify
+ </ActionButton>
+ </Stack>
</Stack>
</Stack>
);
diff --git a/web/packages/contacts/legacy/components/LegacyDrawerContent.tsx b/web/packages/contacts/legacy/components/LegacyDrawerContent.tsx
index fe35e75ef9..fbb2a9a1de 100644
--- a/web/packages/contacts/legacy/components/LegacyDrawerContent.tsx
+++ b/web/packages/contacts/legacy/components/LegacyDrawerContent.tsx
@@ -752,6 +752,7 @@ export const LegacyDrawerContent: React.FC<LegacyDrawerContentProps> = ({
<LegacyActionSheet
open={isAddSheetOpen}
title="Add trusted contact"
+ subtitle="Search an email, verify the identity if needed, and choose how long recovery should wait."
onClose={() => setActiveSheet(undefined)}
>
<LegacyAddContactContent
diff --git a/web/packages/contacts/legacy/components/LegacyIdentityRow.tsx b/web/packages/contacts/legacy/components/LegacyIdentityRow.tsx
index 55cf2755c8..d9551fee3e 100644
--- a/web/packages/contacts/legacy/components/LegacyIdentityRow.tsx
+++ b/web/packages/contacts/legacy/components/LegacyIdentityRow.tsx
@@ -2,7 +2,6 @@ import CheckIcon from "@mui/icons-material/Check";
import {
Avatar,
Box,
- IconButton,
Stack,
Typography,
type SxProps,
@@ -61,6 +60,8 @@ export const LegacyIdentityRow: React.FC<LegacyIdentityRowProps> = ({
p: "9px 12px",
bgcolor: "fill.faint",
borderRadius: "20px",
+ border: "1.5px solid",
+ borderColor: selected ? "stroke.muted" : "transparent",
transition: "background-color 160ms ease",
cursor: onClick ? "pointer" : "default",
"&:hover": onClick
@@ -88,8 +89,12 @@ export const LegacyIdentityRow: React.FC<LegacyIdentityRowProps> = ({
sx={{ alignItems: "center", gap: 0.75, minWidth: 0 }}
>
<Typography
- variant="body"
- sx={{ fontWeight: 500, color: primaryColor }}
+ variant="small"
+ sx={{
+ fontWeight: 500,
+ color: primaryColor,
+ lineHeight: "20px",
+ }}
noWrap
>
{label}
@@ -99,7 +104,11 @@ export const LegacyIdentityRow: React.FC<LegacyIdentityRowProps> = ({
{subtext && (
<Typography
variant="mini"
- sx={{ color: "text.muted", mt: 0.25 }}
+ sx={{
+ color: "text.muted",
+ mt: 0.25,
+ lineHeight: "16px",
+ }}
noWrap
>
{subtext}
@@ -107,16 +116,20 @@ export const LegacyIdentityRow: React.FC<LegacyIdentityRowProps> = ({
)}
</Box>
{selected ? (
- <IconButton
- size="small"
- disableRipple
+ <Box
sx={{
- color: "accent.main",
- "&:hover": { backgroundColor: "transparent" },
+ width: 18,
+ height: 18,
+ borderRadius: "50%",
+ bgcolor: "accent.main",
+ color: "accent.contrastText",
+ display: "grid",
+ placeItems: "center",
+ flexShrink: 0,
}}
>
- <CheckIcon fontSize="small" />
- </IconButton>
+ <CheckIcon sx={{ fontSize: 12 }} />
+ </Box>
) : action ? (
<Box
sx={{
diff --git a/web/packages/contacts/legacy/components/LegacyRecoveryDayPicker.tsx b/web/packages/contacts/legacy/components/LegacyRecoveryDayPicker.tsx
index e371e06300..63d58072c8 100644
--- a/web/packages/contacts/legacy/components/LegacyRecoveryDayPicker.tsx
+++ b/web/packages/contacts/legacy/components/LegacyRecoveryDayPicker.tsx
@@ -1,4 +1,11 @@
-import { Stack, ToggleButton, ToggleButtonGroup } from "@mui/material";
+import {
+ Stack,
+ ToggleButton,
+ ToggleButtonGroup,
+ type SxProps,
+ type Theme,
+} from "@mui/material";
+import { isSxArray } from "ente-base/components/utils/sx";
import React from "react";
export const legacyRecoveryDayOptions = [7, 14, 30] as const;
@@ -6,38 +13,45 @@ export const legacyRecoveryDayOptions = [7, 14, 30] as const;
interface LegacyRecoveryDayPickerProps {
selectedDays: number;
onChange: (days: number) => void;
+ sx?: SxProps<Theme>;
}
export const LegacyRecoveryDayPicker: React.FC<
LegacyRecoveryDayPickerProps
-> = ({ selectedDays, onChange }) => (
+> = ({ selectedDays, onChange, sx }) => (
<ToggleButtonGroup
exclusive
value={selectedDays}
onChange={(_, value: number | null) => value && onChange(value)}
fullWidth
- sx={{
- gap: 1,
- "& .MuiToggleButton-root": {
- flex: 1,
- px: 1.5,
- py: 1.25,
- border: 0,
- borderRadius: "14px !important",
- textTransform: "none",
- fontWeight: 600,
- color: "text.base",
- backgroundColor: "fill.faint",
+ sx={[
+ {
+ gap: 1,
+ "& .MuiToggleButton-root": {
+ flex: 1,
+ px: 1.5,
+ py: 1.25,
+ border: 0,
+ borderRadius: "16px !important",
+ minHeight: 44,
+ textTransform: "none",
+ fontWeight: 600,
+ color: "text.muted",
+ backgroundColor: "fill.faint",
+ },
+ "& .MuiToggleButton-root.Mui-selected": {
+ color: "accent.contrastText",
+ backgroundColor: "accent.main",
+ },
+ "& .MuiToggleButton-root:hover": {
+ backgroundColor: "fill.muted",
+ },
+ "& .MuiToggleButton-root.Mui-selected:hover": {
+ backgroundColor: "accent.main",
+ },
},
- "& .MuiToggleButton-root.Mui-selected": {
- color: "#FFFFFF",
- backgroundColor: "accent.main",
- },
- "& .MuiToggleButton-root:hover": { backgroundColor: "fill.muted" },
- "& .MuiToggleButton-root.Mui-selected:hover": {
- backgroundColor: "accent.main",
- },
- }}
+ ...(sx ? (isSxArray(sx) ? sx : [sx]) : []),
+ ]}
>
{legacyRecoveryDayOptions.map((days) => (
<ToggleButton key={days} value={days}>