Skip to content

armgit / ente

Public Imported from GitHub
0

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

codemods + manual afterwords

Manav Rathib94332aaa715
diff --git a/web/packages/base/components/EnteSwitch.tsx b/web/packages/base/components/EnteSwitch.tsx
index 44f5d232e6..458825ee78 100644
--- a/web/packages/base/components/EnteSwitch.tsx
+++ b/web/packages/base/components/EnteSwitch.tsx
@@ -23,9 +23,12 @@ export const EnteSwitch: React.FC<SwitchProps> = styled((props) => (
color: "#fff",
"& + .MuiSwitch-track": {
backgroundColor:
- theme.palette.mode === "dark" ? "#2ECA45" : "#65C466",
+ "#65C466",
opacity: 1,
border: 0,
+ ...theme.applyStyles("dark", {
+ backgroundColor: "#2ECA45"
+ })
},
"&.Mui-disabled + .MuiSwitch-track": {
opacity: 0.5,
@@ -37,12 +40,16 @@ export const EnteSwitch: React.FC<SwitchProps> = styled((props) => (
},
"&.Mui-disabled .MuiSwitch-thumb": {
color:
- theme.palette.mode === "light"
- ? theme.palette.grey[100]
- : theme.palette.grey[600],
+ theme.palette.grey[600],
+ ...theme.applyStyles("light", {
+ color: theme.palette.grey[100]
+ })
},
"&.Mui-disabled + .MuiSwitch-track": {
- opacity: theme.palette.mode === "light" ? 0.7 : 0.3,
+ opacity: 0.3,
+ ...theme.applyStyles("light", {
+ opacity: 0.7
+ })
},
},
"& .MuiSwitch-thumb": {
@@ -53,12 +60,13 @@ export const EnteSwitch: React.FC<SwitchProps> = styled((props) => (
"& .MuiSwitch-track": {
borderRadius: 22 / 2,
backgroundColor:
- theme.palette.mode === "light"
- ? "#E9E9EA"
- : theme.colors.fill.muted,
+ theme.colors.fill.muted,
opacity: 1,
transition: theme.transitions.create(["background-color"], {
duration: 500,
}),
+ ...theme.applyStyles("light", {
+ backgroundColor: "#E9E9EA"
+ })
},
}));
diff --git a/web/packages/base/components/ErrorIndicator.tsx b/web/packages/base/components/ErrorIndicator.tsx
index 3cf210c815..5593a0a615 100644
--- a/web/packages/base/components/ErrorIndicator.tsx
+++ b/web/packages/base/components/ErrorIndicator.tsx
@@ -15,12 +15,11 @@ export const ActivityErrorIndicator: React.FC<React.PropsWithChildren> = ({
}) => (
<Stack sx={{ gap: 2, alignItems: "center" }}>
<ErrorOutlineIcon color="secondary" sx={{ color: "critical" }} />
- <Typography color="text.muted">
+ <Typography sx={{ color: "text.muted" }}>
{children ?? t("generic_error")}
</Typography>
</Stack>
);
-
/**
* An smaller error message indicator suitable for being shown above or below
* text fields.
@@ -34,7 +33,7 @@ export const InlineErrorIndicator: React.FC<React.PropsWithChildren> = ({
}) => (
<Box sx={{ display: "flex", gap: "5px", alignItems: "center" }}>
<ErrorOutlineIcon sx={{ fontSize: "16px", color: "critical.main" }} />
- <Typography variant="small" color="critical.main">
+ <Typography variant="small" sx={{ color: "critical.main" }}>
{children ?? t("generic_error")}
</Typography>
</Box>
diff --git a/web/packages/base/components/Menu.tsx b/web/packages/base/components/Menu.tsx
index f63ee77478..37e465af52 100644
--- a/web/packages/base/components/Menu.tsx
+++ b/web/packages/base/components/Menu.tsx
@@ -16,15 +16,15 @@ export const MenuSectionTitle: React.FC<MenuSectionTitleProps> = ({
px="8px"
py={"6px"}
gap={"8px"}
- sx={{
+ sx={(theme) => ({
"& > svg": {
fontSize: "17px",
- color: (theme) => theme.colors.stroke.muted,
+ color: theme.colors.stroke.muted,
},
- }}
+ })}
>
{icon && icon}
- <Typography variant="small" color="text.muted">
+ <Typography variant="small" sx={{ color: "text.muted" }}>
{title}
</Typography>
</VerticallyCenteredFlex>
@@ -40,12 +40,10 @@ export const MenuItemDivider: React.FC<MenuItemDividerProps> = ({
}) => {
return (
<Divider
- sx={{
- "&&&": {
- my: 0,
- ml: hasIcon ? "48px" : "16px",
- },
- }}
+ sx={[
+ { "&&&": { my: 0 } },
+ hasIcon ? { "&&&": { ml: "48px" } } : { "&&&": { ml: "16px" } },
+ ]}
/>
);
};
diff --git a/web/packages/base/components/MiniDialog.tsx b/web/packages/base/components/MiniDialog.tsx
index a5ab5385f2..46849e52eb 100644
--- a/web/packages/base/components/MiniDialog.tsx
+++ b/web/packages/base/components/MiniDialog.tsx
@@ -259,7 +259,7 @@ export const AttributedMiniDialog: React.FC<
);
return (
- <Dialog
+ (<Dialog
open={open}
fullWidth
PaperProps={{
@@ -274,19 +274,19 @@ export const AttributedMiniDialog: React.FC<
>
{(attributes.icon ?? attributes.title) ? (
<Box
- sx={{
+ sx={(theme) => ({
display: "flex",
justifyContent: "space-between",
alignItems: "center",
"& > svg": {
fontSize: "32px",
- color: (theme) => theme.colors.stroke.faint,
+ color: theme.colors.stroke.faint,
},
padding:
attributes.icon && attributes.title
? "20px 16px 0px 16px"
: "24px 16px 4px 16px",
- }}
+ })}
>
{attributes.title && (
<DialogTitle
@@ -303,7 +303,7 @@ export const AttributedMiniDialog: React.FC<
{attributes.icon}
</Box>
) : (
- <Box sx={{ height: "8px" }} /> /* Spacer */
+ (<Box sx={{ height: "8px" }} />) /* Spacer */
)}
<DialogContent>
{attributes.message && (
@@ -311,7 +311,9 @@ export const AttributedMiniDialog: React.FC<
component={
typeof attributes.message == "string" ? "p" : "div"
}
- color="text.muted"
+ sx={{
+ color: "text.muted",
+ }}
>
{attributes.message}
</Typography>
@@ -336,7 +338,7 @@ export const AttributedMiniDialog: React.FC<
)}
</Stack>
</DialogContent>
- </Dialog>
+ </Dialog>)
);
};
@@ -386,4 +388,4 @@ export const TitledMiniDialog: React.FC<
<DialogContent>{children}</DialogContent>
</Dialog>
);
-};
+};
\ No newline at end of file
diff --git a/web/packages/base/components/OverflowMenu.tsx b/web/packages/base/components/OverflowMenu.tsx
index 4ba7e72206..2b96e76854 100644
--- a/web/packages/base/components/OverflowMenu.tsx
+++ b/web/packages/base/components/OverflowMenu.tsx
@@ -126,15 +126,15 @@ export const OverflowMenuOption: React.FC<
return (
<MenuItem
onClick={handleClick}
- sx={{
+ sx={(theme) => ({
minWidth: 220,
- color: (theme) => theme.palette[color].main,
+ color: theme.palette[color].main,
// Reduce the size of the icons a bit to make it fit better with
// the text.
"& .MuiSvgIcon-root": {
fontSize: "20px",
},
- }}
+ })}
>
<Stack
direction="row"
diff --git a/web/packages/base/components/Titlebar.tsx b/web/packages/base/components/Titlebar.tsx
index 5a0edad0f6..e16a058a56 100644
--- a/web/packages/base/components/Titlebar.tsx
+++ b/web/packages/base/components/Titlebar.tsx
@@ -36,7 +36,12 @@ export const Titlebar: React.FC<TitlebarProps> = ({
>
{backIsClose ? <CloseIcon /> : <ArrowBackIcon />}
</IconButton>
- <Box display={"flex"} gap="4px">
+ <Box
+ sx={{
+ display: "flex",
+ gap: "4px",
+ }}
+ >
{actionButton && actionButton}
{!backIsClose && (
<IconButton onClick={onRootClose} color={"secondary"}>
@@ -45,14 +50,27 @@ export const Titlebar: React.FC<TitlebarProps> = ({
)}
</Box>
</FlexWrapper>
- <Box py={0.5} px={2}>
- <Typography variant="h3" fontWeight={"bold"}>
+ <Box
+ sx={{
+ py: 0.5,
+ px: 2,
+ }}
+ >
+ <Typography
+ variant="h3"
+ sx={{
+ fontWeight: "bold",
+ }}
+ >
{title}
</Typography>
<Typography
variant="small"
- color="text.muted"
- sx={{ wordBreak: "break-all", minHeight: "17px" }}
+ sx={{
+ color: "text.muted",
+ wordBreak: "break-all",
+ minHeight: "17px",
+ }}
>
{caption}
</Typography>
diff --git a/web/packages/base/components/mui/ActivityIndicator.tsx b/web/packages/base/components/mui/ActivityIndicator.tsx
index b7ae7c9008..5bf351842b 100644
--- a/web/packages/base/components/mui/ActivityIndicator.tsx
+++ b/web/packages/base/components/mui/ActivityIndicator.tsx
@@ -24,12 +24,17 @@ export const ActivityIndicator: React.FC<
children ? (
<Stack sx={{ gap: 2, alignItems: "center" }}>
<CircularProgress color="accent" size={24} {...rest} />
- <Typography color="text.muted">{children}</Typography>
+ <Typography
+ sx={{
+ color: "text.muted",
+ }}
+ >
+ {children}
+ </Typography>
</Stack>
) : (
<CircularProgress color="accent" size={32} {...rest} />
);
-
/**
* An error message indicator, styled to complement {@link ActivityIndicator}.
*
@@ -42,7 +47,11 @@ export const ErrorIndicator: React.FC<React.PropsWithChildren> = ({
}) => (
<Stack sx={{ gap: 2, alignItems: "center" }}>
<ErrorOutlineIcon color="secondary" sx={{ color: "critical" }} />
- <Typography color="text.muted">
+ <Typography
+ sx={{
+ color: "text.muted",
+ }}
+ >
{children ?? t("generic_error")}
</Typography>
</Stack>
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index fdfabd813f..4b2e34cd9f 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -118,7 +118,12 @@ export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
<IconButton onClick={onClose} color={"primary"}>
<ArrowBackIcon />
</IconButton>
- <Box display={"flex"} gap="4px">
+ <Box
+ sx={{
+ display: "flex",
+ gap: "4px",
+ }}
+ >
{actionButton && actionButton}
<IconButton onClick={onRootClose} color={"secondary"}>
<CloseIcon />
@@ -126,13 +131,21 @@ export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
</Box>
</SpaceBetweenFlex>
<Box sx={{ px: "16px", py: "4px" }}>
- <Typography variant="h3" fontWeight={"bold"}>
+ <Typography
+ variant="h3"
+ sx={{
+ fontWeight: "bold",
+ }}
+ >
{title}
</Typography>
<Typography
variant="small"
- color="text.muted"
- sx={{ wordBreak: "break-all", minHeight: "17px" }}
+ sx={{
+ color: "text.muted",
+ wordBreak: "break-all",
+ minHeight: "17px",
+ }}
>
{caption}
</Typography>