Skip to content

armgit / ente

Public Imported from GitHub
0

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

Align staff exports with web style

Manav Rathi6275f2c37643
diff --git a/infra/staff/src/App.tsx b/infra/staff/src/App.tsx
index ec6bbac44c..1caaea3c69 100644
--- a/infra/staff/src/App.tsx
+++ b/infra/staff/src/App.tsx
@@ -7,10 +7,10 @@ import TextField from "@mui/material/TextField";
import * as React from "react";
import { useCallback, useEffect, useState } from "react";
import "./App.css";
-import FamilyTableComponent from "./components/FamilyComponentTable";
-import StorageBonusTableComponent from "./components/StorageBonusTableComponent";
-import TokensTableComponent from "./components/TokenTableComponent";
-import UserComponent from "./components/UserComponent";
+import { FamilyTableComponent } from "./components/FamilyComponentTable";
+import { StorageBonusTableComponent } from "./components/StorageBonusTableComponent";
+import { TokensTableComponent } from "./components/TokenTableComponent";
+import { UserComponent } from "./components/UserComponent";
import duckieimage from "./components/duckie.png";
import { getEmail, getToken, setEmail, setToken } from "./services/session";
import { apiOrigin } from "./services/support";
@@ -36,7 +36,7 @@ const formatStorage = (bytes: number | undefined, noneWhenZero = false) => {
return `${(bytes / 1024 ** 2).toFixed(2)} MB`;
};
-const App: React.FC = () => {
+export const App: React.FC = () => {
const [localEmail, setLocalEmail] = useState<string>("");
const [localToken, setLocalToken] = useState<string>("");
const [loading, setLoading] = useState<boolean>(false);
@@ -330,5 +330,3 @@ const App: React.FC = () => {
</div>
);
};
-
-export default App;
diff --git a/infra/staff/src/components/AddOtt.tsx b/infra/staff/src/components/AddOtt.tsx
index ca8b1ede40..61d2bd74d3 100644
--- a/infra/staff/src/components/AddOtt.tsx
+++ b/infra/staff/src/components/AddOtt.tsx
@@ -39,7 +39,7 @@ interface AddOttProps {
userEmail: string;
}
-const AddOtt = ({ open, onClose, userEmail }: AddOttProps) => {
+export const AddOtt = ({ open, onClose, userEmail }: AddOttProps) => {
const [selectedApp, setSelectedApp] = useState<AppOption>("photos");
const [submitting, setSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -202,5 +202,3 @@ const AddOtt = ({ open, onClose, userEmail }: AddOttProps) => {
</Dialog>
);
};
-
-export default AddOtt;
diff --git a/infra/staff/src/components/ChangeEmail.tsx b/infra/staff/src/components/ChangeEmail.tsx
index 16cff99a6d..271926d950 100644
--- a/infra/staff/src/components/ChangeEmail.tsx
+++ b/infra/staff/src/components/ChangeEmail.tsx
@@ -21,7 +21,7 @@ interface ChangeEmailProps {
onClose: () => void;
}
-const ChangeEmail: React.FC<ChangeEmailProps> = ({ open, onClose }) => {
+export const ChangeEmail: React.FC<ChangeEmailProps> = ({ open, onClose }) => {
const [newEmail, setNewEmail] = useState<string>("");
const [userID, setUserID] = useState<string>("");
@@ -155,5 +155,3 @@ const ChangeEmail: React.FC<ChangeEmailProps> = ({ open, onClose }) => {
</Dialog>
);
};
-
-export default ChangeEmail;
diff --git a/infra/staff/src/components/CloseFamily.tsx b/infra/staff/src/components/CloseFamily.tsx
index dd12fd4d07..737a6ccd9e 100644
--- a/infra/staff/src/components/CloseFamily.tsx
+++ b/infra/staff/src/components/CloseFamily.tsx
@@ -20,7 +20,7 @@ interface CloseFamilyProps {
handleCloseFamily: () => void; // Callback to handle closing family
}
-const CloseFamily: React.FC<CloseFamilyProps> = ({
+export const CloseFamily: React.FC<CloseFamilyProps> = ({
open,
handleClose,
handleCloseFamily,
@@ -126,5 +126,3 @@ const CloseFamily: React.FC<CloseFamilyProps> = ({
</div>
);
};
-
-export default CloseFamily;
diff --git a/infra/staff/src/components/DeleteAccont.tsx b/infra/staff/src/components/DeleteAccont.tsx
index 457953f186..210029c50e 100644
--- a/infra/staff/src/components/DeleteAccont.tsx
+++ b/infra/staff/src/components/DeleteAccont.tsx
@@ -16,7 +16,10 @@ interface DeleteAccountProps {
handleClose: () => void;
}
-const DeleteAccount: React.FC<DeleteAccountProps> = ({ open, handleClose }) => {
+export const DeleteAccount: React.FC<DeleteAccountProps> = ({
+ open,
+ handleClose,
+}) => {
const handleDelete = async () => {
try {
const email = getEmail();
@@ -104,5 +107,3 @@ const DeleteAccount: React.FC<DeleteAccountProps> = ({ open, handleClose }) => {
</div>
);
};
-
-export default DeleteAccount;
diff --git a/infra/staff/src/components/Disable2FA.tsx b/infra/staff/src/components/Disable2FA.tsx
index ecc37d5fcf..1f6bc8973a 100644
--- a/infra/staff/src/components/Disable2FA.tsx
+++ b/infra/staff/src/components/Disable2FA.tsx
@@ -20,7 +20,7 @@ interface Disable2FAProps {
handleDisable2FA: () => void; // Callback to handle 2FA disablement
}
-const Disable2FA: React.FC<Disable2FAProps> = ({
+export const Disable2FA: React.FC<Disable2FAProps> = ({
open,
handleClose,
handleDisable2FA,
@@ -124,5 +124,3 @@ const Disable2FA: React.FC<Disable2FAProps> = ({
</div>
);
};
-
-export default Disable2FA;
diff --git a/infra/staff/src/components/DisablePasskeys.tsx b/infra/staff/src/components/DisablePasskeys.tsx
index 4d5232b792..37e0a636b4 100644
--- a/infra/staff/src/components/DisablePasskeys.tsx
+++ b/infra/staff/src/components/DisablePasskeys.tsx
@@ -15,7 +15,7 @@ import {
} from "../services/support";
import type { DisablePasskeysProps } from "../types";
-const DisablePasskeys: React.FC<DisablePasskeysProps> = ({
+export const DisablePasskeys: React.FC<DisablePasskeysProps> = ({
open,
handleClose,
handleDisablePasskeys,
@@ -121,5 +121,3 @@ const DisablePasskeys: React.FC<DisablePasskeysProps> = ({
</div>
);
};
-
-export default DisablePasskeys;
diff --git a/infra/staff/src/components/FamilyComponentTable.tsx b/infra/staff/src/components/FamilyComponentTable.tsx
index 9c3082561f..2fe8d88dcc 100644
--- a/infra/staff/src/components/FamilyComponentTable.tsx
+++ b/infra/staff/src/components/FamilyComponentTable.tsx
@@ -14,9 +14,9 @@ import { useEffect, useState } from "react";
import { getCurrentAdminUser } from "../services/support";
import type { FamilyMember } from "../types";
import { formatUsageToGB } from "../utils/";
-import CloseFamily from "./CloseFamily";
+import { CloseFamily } from "./CloseFamily";
-const FamilyTableComponent: React.FC = () => {
+export const FamilyTableComponent: React.FC = () => {
const [familyMembers, setFamilyMembers] = useState<FamilyMember[]>([]);
const [closeFamilyOpen, setCloseFamilyOpen] = useState(false);
const [loading, setLoading] = useState<boolean>(true);
@@ -152,5 +152,3 @@ const FamilyTableComponent: React.FC = () => {
</>
);
};
-
-export default FamilyTableComponent;
diff --git a/infra/staff/src/components/StorageBonusTableComponent.tsx b/infra/staff/src/components/StorageBonusTableComponent.tsx
index 893f81e034..98740ee95c 100644
--- a/infra/staff/src/components/StorageBonusTableComponent.tsx
+++ b/infra/staff/src/components/StorageBonusTableComponent.tsx
@@ -19,7 +19,7 @@ interface BonusData {
isRevoked: boolean;
}
-const StorageBonusTableComponent: React.FC = () => {
+export const StorageBonusTableComponent: React.FC = () => {
const [storageBonuses, setStorageBonuses] = useState<BonusData[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
@@ -140,5 +140,3 @@ const StorageBonusTableComponent: React.FC = () => {
</div>
);
};
-
-export default StorageBonusTableComponent;
diff --git a/infra/staff/src/components/ToggleEmailMFA.tsx b/infra/staff/src/components/ToggleEmailMFA.tsx
index 36457d9a97..03dca92d44 100644
--- a/infra/staff/src/components/ToggleEmailMFA.tsx
+++ b/infra/staff/src/components/ToggleEmailMFA.tsx
@@ -20,7 +20,7 @@ interface ToggleEmailMFAProps {
handleToggleEmailMFA: (status: boolean) => void; // Callback to handle toggling Email MFA
}
-const ToggleEmailMFA: React.FC<ToggleEmailMFAProps> = ({
+export const ToggleEmailMFA: React.FC<ToggleEmailMFAProps> = ({
open,
handleClose,
handleToggleEmailMFA,
@@ -141,5 +141,3 @@ const ToggleEmailMFA: React.FC<ToggleEmailMFAProps> = ({
</div>
);
};
-
-export default ToggleEmailMFA;
diff --git a/infra/staff/src/components/TokenTableComponent.tsx b/infra/staff/src/components/TokenTableComponent.tsx
index 04a3a16b54..95617e5a58 100644
--- a/infra/staff/src/components/TokenTableComponent.tsx
+++ b/infra/staff/src/components/TokenTableComponent.tsx
@@ -20,7 +20,7 @@ interface TokenData {
app: string;
}
-const TokensTableComponent: React.FC = () => {
+export const TokensTableComponent: React.FC = () => {
const [tokens, setTokens] = useState<TokenData[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
@@ -176,5 +176,3 @@ const TokensTableComponent: React.FC = () => {
</div>
);
};
-
-export default TokensTableComponent;
diff --git a/infra/staff/src/components/UpdateSubscription.tsx b/infra/staff/src/components/UpdateSubscription.tsx
index 798c015ae7..fb7a62ffc6 100644
--- a/infra/staff/src/components/UpdateSubscription.tsx
+++ b/infra/staff/src/components/UpdateSubscription.tsx
@@ -47,7 +47,7 @@ interface FormValues {
attributes: { customerID: string; stripeAccountCountry: string };
}
-const UpdateSubscription: React.FC<UpdateSubscriptionProps> = ({
+export const UpdateSubscription: React.FC<UpdateSubscriptionProps> = ({
open,
onClose,
}) => {
@@ -377,5 +377,3 @@ const UpdateSubscription: React.FC<UpdateSubscriptionProps> = ({
</Dialog>
);
};
-
-export default UpdateSubscription;
diff --git a/infra/staff/src/components/UserComponent.tsx b/infra/staff/src/components/UserComponent.tsx
index bf9b66b647..f4f9acc3e8 100644
--- a/infra/staff/src/components/UserComponent.tsx
+++ b/infra/staff/src/components/UserComponent.tsx
@@ -14,15 +14,15 @@ import TableRow from "@mui/material/TableRow";
import Typography from "@mui/material/Typography";
import { useEffect, useState } from "react";
import type { UserComponentProps } from "../types";
-import AddOtt from "./AddOtt";
-import ChangeEmail from "./ChangeEmail";
-import DeleteAccount from "./DeleteAccont";
-import Disable2FA from "./Disable2FA";
-import DisablePasskeys from "./DisablePasskeys";
-import ToggleEmailMFA from "./ToggleEmailMFA";
-import UpdateSubscription from "./UpdateSubscription";
+import { AddOtt } from "./AddOtt";
+import { ChangeEmail } from "./ChangeEmail";
+import { DeleteAccount } from "./DeleteAccont";
+import { Disable2FA } from "./Disable2FA";
+import { DisablePasskeys } from "./DisablePasskeys";
+import { ToggleEmailMFA } from "./ToggleEmailMFA";
+import { UpdateSubscription } from "./UpdateSubscription";
-const UserComponent = ({ userData }: UserComponentProps) => {
+export const UserComponent = ({ userData }: UserComponentProps) => {
const [deleteAccountOpen, setDeleteAccountOpen] = useState(false);
const [email2FAEnabled, setEmail2FAEnabled] = useState(false);
const [email2FAOpen, setEmail2FAToggleOpen] = useState(false);
@@ -409,5 +409,3 @@ const renderTableCellContent = (
return <Typography>{value}</Typography>;
}
};
-
-export default UserComponent;
diff --git a/infra/staff/src/main.tsx b/infra/staff/src/main.tsx
index 162cfad3cf..528729a238 100644
--- a/infra/staff/src/main.tsx
+++ b/infra/staff/src/main.tsx
@@ -1,6 +1,6 @@
import React from "react";
import ReactDOM from "react-dom/client";
-import App from "./App";
+import { App } from "./App";
import "./styles/globals.css";
const root = document.getElementById("root");
diff --git a/infra/staff/src/utils/index.ts b/infra/staff/src/utils/index.ts
index 46a4bc3fcf..0e9497d434 100644
--- a/infra/staff/src/utils/index.ts
+++ b/infra/staff/src/utils/index.ts
@@ -1,5 +1,4 @@
-// Common utilities
-export function formatUsageToGB(usage: number): string {
+export const formatUsageToGB = (usage: number): string => {
const usageInGB = (usage / (1024 * 1024 * 1024)).toFixed(2);
return `${usageInGB} GB`;
-}
+};