Skip to content

armgit / ente

Public Imported from GitHub
0

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

Inline

Manav Rathi4bef94aac056
diff --git a/web/apps/photos/src/components/CheckboxInput.tsx b/web/apps/photos/src/components/CheckboxInput.tsx
index df139fd2e3..e69de29bb2 100644
--- a/web/apps/photos/src/components/CheckboxInput.tsx
+++ b/web/apps/photos/src/components/CheckboxInput.tsx
@@ -1,43 +0,0 @@
-import {
- Checkbox,
- FormControlLabel,
- FormGroup,
- Typography,
- type TypographyProps,
-} from "@mui/material";
-
-interface Iprops {
- disabled?: boolean;
- checked: boolean;
- onChange: (value: boolean) => void;
- label: string;
- labelProps?: TypographyProps;
-}
-export function CheckboxInput({
- disabled,
- checked,
- onChange,
- label,
- labelProps,
-}: Iprops) {
- return (
- <FormGroup sx={{ width: "100%" }}>
- <FormControlLabel
- control={
- <Checkbox
- size="small"
- disabled={disabled}
- checked={checked}
- onChange={(e) => onChange(e.target.checked)}
- color="accent"
- />
- }
- label={
- <Typography color="text.secondary" {...labelProps}>
- {label}
- </Typography>
- }
- />
- </FormGroup>
- );
-}
diff --git a/web/apps/photos/src/components/DeleteAccountModal.tsx b/web/apps/photos/src/components/DeleteAccountModal.tsx
index ab59981b52..31a6b753f8 100644
--- a/web/apps/photos/src/components/DeleteAccountModal.tsx
+++ b/web/apps/photos/src/components/DeleteAccountModal.tsx
@@ -3,7 +3,16 @@ import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import { LoadingButton } from "@/base/components/mui/LoadingButton";
import { AppContext } from "@/new/photos/types/context";
import { initiateEmail } from "@/new/photos/utils/web";
-import { Link, Stack } from "@mui/material";
+import {
+ Checkbox,
+ FormControlLabel,
+ FormGroup,
+ Link,
+ Stack,
+ TextField,
+ Typography,
+ type TypographyProps,
+} from "@mui/material";
import { Formik, type FormikHelpers } from "formik";
import { t } from "i18next";
import { GalleryContext } from "pages/gallery";
@@ -12,9 +21,7 @@ import { Trans } from "react-i18next";
import { deleteAccount, getAccountDeleteChallenge } from "services/userService";
import { decryptDeleteAccountChallenge } from "utils/crypto";
import * as Yup from "yup";
-import { CheckboxInput } from "./CheckboxInput";
import DropdownInput, { DropdownOption } from "./DropdownInput";
-import MultilineInput from "./MultilineInput";
interface Iprops {
onClose: () => void;
@@ -213,3 +220,95 @@ const deleteReasonOptions = (): DropdownOption<DeleteReason>[] =>
label: t(`delete_reason.${reason}`),
value: reason,
}));
+
+interface MultilineInputProps {
+ label: string;
+ labelProps?: TypographyProps;
+ message?: string;
+ messageProps?: TypographyProps;
+ placeholder?: string;
+ value: string;
+ rowCount: number;
+ onChange: (value: string) => void;
+}
+
+function MultilineInput({
+ label,
+ labelProps,
+ message,
+ messageProps,
+ placeholder,
+ value,
+ rowCount,
+ onChange,
+}: MultilineInputProps) {
+ return (
+ <Stack spacing={"4px"}>
+ <Typography {...labelProps}>{label}</Typography>
+ <TextField
+ variant="standard"
+ multiline
+ rows={rowCount}
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder={placeholder}
+ sx={(theme) => ({
+ border: "1px solid",
+ borderColor: theme.colors.stroke.faint,
+ borderRadius: "8px",
+ padding: "12px",
+ ".MuiInputBase-formControl": {
+ "::before, ::after": {
+ borderBottom: "none !important",
+ },
+ },
+ })}
+ />
+ <Typography
+ px={"8px"}
+ variant="small"
+ color="text.secondary"
+ {...messageProps}
+ >
+ {message}
+ </Typography>
+ </Stack>
+ );
+}
+
+interface CheckboxInputProps {
+ disabled?: boolean;
+ checked: boolean;
+ onChange: (value: boolean) => void;
+ label: string;
+ labelProps?: TypographyProps;
+}
+
+function CheckboxInput({
+ disabled,
+ checked,
+ onChange,
+ label,
+ labelProps,
+}: CheckboxInputProps) {
+ return (
+ <FormGroup sx={{ width: "100%" }}>
+ <FormControlLabel
+ control={
+ <Checkbox
+ size="small"
+ disabled={disabled}
+ checked={checked}
+ onChange={(e) => onChange(e.target.checked)}
+ color="accent"
+ />
+ }
+ label={
+ <Typography color="text.secondary" {...labelProps}>
+ {label}
+ </Typography>
+ }
+ />
+ </FormGroup>
+ );
+}
diff --git a/web/apps/photos/src/components/MultilineInput.tsx b/web/apps/photos/src/components/MultilineInput.tsx
index acf657e37e..e69de29bb2 100644
--- a/web/apps/photos/src/components/MultilineInput.tsx
+++ b/web/apps/photos/src/components/MultilineInput.tsx
@@ -1,56 +0,0 @@
-import { Stack, TextField, Typography, TypographyProps } from "@mui/material";
-
-interface Iprops {
- label: string;
- labelProps?: TypographyProps;
- message?: string;
- messageProps?: TypographyProps;
- placeholder?: string;
- value: string;
- rowCount: number;
- onChange: (value: string) => void;
-}
-
-export default function MultilineInput({
- label,
- labelProps,
- message,
- messageProps,
- placeholder,
- value,
- rowCount,
- onChange,
-}: Iprops) {
- return (
- <Stack spacing={"4px"}>
- <Typography {...labelProps}>{label}</Typography>
- <TextField
- variant="standard"
- multiline
- rows={rowCount}
- value={value}
- onChange={(e) => onChange(e.target.value)}
- placeholder={placeholder}
- sx={(theme) => ({
- border: "1px solid",
- borderColor: theme.colors.stroke.faint,
- borderRadius: "8px",
- padding: "12px",
- ".MuiInputBase-formControl": {
- "::before, ::after": {
- borderBottom: "none !important",
- },
- },
- })}
- />
- <Typography
- px={"8px"}
- variant="small"
- color="text.secondary"
- {...messageProps}
- >
- {message}
- </Typography>
- </Stack>
- );
-}