Skip to content

armgit / ente

Public Imported from GitHub
0

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

Align staff code style

Manav Rathicff34246bdac
diff --git a/infra/staff/src/App.css b/infra/staff/src/App.css
index 941cbee923..4b86d5d7c8 100644
--- a/infra/staff/src/App.css
+++ b/infra/staff/src/App.css
@@ -1,60 +1,14 @@
.container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: flex-start;
max-width: 1200px;
+ min-height: 100vh;
height: auto;
- align-items: center;
margin: 0 auto;
}
-.center-table {
- display: table;
-}
-
-.fetch-button-container button {
- background-color: #00b33c;
- color: white;
- border: none;
- width: 199px;
- height: 56px;
-}
-
-.fetch-button-container button:hover {
- background-color: #007c6c;
-}
-
-.link-text {
- display: flex;
- align-items: center;
- text-decoration: none; /* Remove underline */
- color: inherit; /* Inherit color from parent */
- font-weight: bold; /* Make the text bold */
- font-size: 40px;
-}
-
-.duckie-container {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
-}
-.center-content {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100vh; /* Adjust as necessary */
- position: relative;
-}
-
-.error-message {
- color: red;
- font-size: 1.5em;
-}
-
-.duckie-container {
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
.input-form {
display: flex;
flex-direction: column;
@@ -66,144 +20,44 @@
.horizontal-group {
display: flex;
align-items: center;
- background-color: #fcfcfc;
- padding: 20px; /* Add padding around content */
- border-radius: 10px;
- margin-top: 90px;
- width: 1200px;
justify-content: space-around;
+ width: 1200px;
+ margin-top: 90px;
+ padding: 20px;
+ border-radius: 10px;
+ background-color: #fcfcfc;
}
-.text-fields {
+.link-text {
display: flex;
- justify-content: row;
- gap: 20px;
-}
-.fetch-button-container button {
- background-color: #00b33c;
- color: white;
- border: none;
- width: 199px;
- height: 56px;
-}
-
-.fetch-button-container button:hover {
- background-color: #007c6c;
+ align-items: center;
+ color: inherit;
+ font-size: 40px;
+ font-weight: bold;
+ text-decoration: none;
}
-.center-content {
+.text-fields {
display: flex;
- justify-content: center;
- align-items: center;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
+ gap: 20px;
}
-.duckie-container {
- display: flex;
- justify-content: center;
- align-items: center;
+.fetch-button-container {
+ margin: 0 10px;
}
.fetch-button-container button {
- background-color: #00b33c;
- color: white;
- border: none;
width: 150px;
height: 56px;
+ border: none;
+ color: white;
+ background-color: #00b33c;
}
.fetch-button-container button:hover {
background-color: #007c6c;
}
-.center-content {
- display: flex;
- justify-content: center;
- align-items: center;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
-}
-
-.duckie-container {
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-.dialog-popup-container {
- /* Styles for the overlay/background */
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black */
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.dialog-popup {
- background-color: white;
- padding: 20px;
- border-radius: 5px;
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
-}
-
-.dialog-popup-header h2 {
- margin-bottom: 20px; /* Add space between heading and fields */
-}
-
-.dialog-popup-field {
- margin-bottom: 15px;
-}
-
-.dialog-popup-field label {
- display: block;
- margin-bottom: 5px;
- font-weight: bold;
-}
-
-.dialog-popup-field input {
- width: 100%;
- padding: 8px;
- border: 1px solid #ccc;
- border-radius: 3px;
-}
-
-.submit-button {
- background-color: #4caf50; /* Green */
- color: white;
- padding: 10px 15px;
- border: none;
- border-radius: 3px;
- cursor: pointer;
-}
-
-/* Specific styles for each field to match the image */
-.name-field input,
-.shortname-field input,
-.code-field input {
- width: calc(100% - 100px); /* Adjust as needed */
-}
-
-.active-field input {
- width: 50px;
-}
-/* Add to App.css or your CSS file */
-.container {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: flex-start;
- min-height: 100vh;
-}
-
.content-container {
display: flex;
flex-direction: column;
@@ -212,57 +66,35 @@
width: 100%;
}
-.fetch-button-container {
- margin-right: 10px;
- margin-left: 10px;
-}
-
.error-message {
+ margin-top: 16px;
color: red;
+ font-size: 1.5em;
font-weight: bold;
- margin-top: 16px;
}
-/* MUi Component Custom CSS */
-css-1t8l2tu-MuiInputBase-input-MuiOutlinedInput-input {
- padding: none;
- margin: none;
-}
-
-/* Mobile */
@media screen and (max-width: 475px) {
.link-text {
font-size: 30px;
text-align: center;
}
+
.input-form {
max-width: 400px;
+ flex-direction: row;
align-items: center;
gap: 20px;
- flex-direction: row;
}
+
.horizontal-group {
width: 500px;
flex-direction: column;
gap: 25px;
}
+
.text-fields {
width: fit-content;
flex-direction: column;
- gap: 20px;
justify-content: center;
}
- .text-fields label {
- padding: 0;
- margin: none;
- }
-}
-
-@media screen and (max-width: 576px) {
-}
-
-@media screen and (max-width: 900px) {
-}
-
-@media screen and (max-width: 1200px) {
}
diff --git a/infra/staff/src/App.tsx b/infra/staff/src/App.tsx
index 1caaea3c69..d042f45c96 100644
--- a/infra/staff/src/App.tsx
+++ b/infra/staff/src/App.tsx
@@ -1,48 +1,49 @@
-import Box from "@mui/material/Box";
-import Button from "@mui/material/Button";
-import CircularProgress from "@mui/material/CircularProgress";
-import Tab from "@mui/material/Tab";
-import Tabs from "@mui/material/Tabs";
-import TextField from "@mui/material/TextField";
-import * as React from "react";
-import { useCallback, useEffect, useState } from "react";
+import {
+ Box,
+ Button,
+ CircularProgress,
+ Tab,
+ Tabs,
+ TextField,
+} from "@mui/material";
+import React, { 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 { UserComponent, type UserData } from "./components/UserComponent";
import duckieimage from "./components/duckie.png";
import { getEmail, getToken, setEmail, setToken } from "./services/session";
import { apiOrigin } from "./services/support";
-import type { UserData, UserResponse } from "./types";
-const isNumericUserId = (value: string): boolean => /^\d+$/.test(value);
-
-const buildUserSearchUrl = (input: string): string => {
- const trimmedInput = input.trim();
- if (isNumericUserId(trimmedInput)) {
- return `${apiOrigin}/admin/user?id=${encodeURIComponent(trimmedInput)}`;
- }
- return `${apiOrigin}/admin/user?email=${encodeURIComponent(trimmedInput)}`;
-};
-
-const formatStorage = (bytes: number | undefined, noneWhenZero = false) => {
- if (bytes === undefined || (noneWhenZero && bytes === 0)) {
- return "None";
- }
- if (bytes >= 1024 ** 3) {
- return `${(bytes / 1024 ** 3).toFixed(2)} GB`;
- }
- return `${(bytes / 1024 ** 2).toFixed(2)} MB`;
-};
+interface UserResponse {
+ user: { ID: string; email: string; creationTime: number };
+ subscription: {
+ productID: string;
+ paymentProvider: string;
+ expiryTime: number;
+ storage: number;
+ };
+ authCodes?: number;
+ details?: {
+ usage?: number;
+ storageBonus?: number;
+ profileData: {
+ isEmailMFAEnabled: boolean;
+ isTwoFactorEnabled: boolean;
+ passkeyCount: number;
+ canDisableEmailMFA: boolean;
+ };
+ };
+}
export const App: React.FC = () => {
- const [localEmail, setLocalEmail] = useState<string>("");
- const [localToken, setLocalToken] = useState<string>("");
- const [loading, setLoading] = useState<boolean>(false);
- const [error, setError] = useState<string>("");
- const [fetchSuccess, setFetchSuccess] = useState<boolean>(false);
- const [tabValue, setTabValue] = useState<number>(0);
+ const [localEmail, setLocalEmail] = useState("");
+ const [localToken, setLocalToken] = useState("");
+ const [loading, setLoading] = useState(false);
+ const [error, setError] = useState("");
+ const [fetchSuccess, setFetchSuccess] = useState(false);
+ const [tabValue, setTabValue] = useState(0);
const [userData, setUserData] = useState<UserData | null>(null);
useEffect(() => {
@@ -330,3 +331,23 @@ export const App: React.FC = () => {
</div>
);
};
+
+const buildUserSearchUrl = (input: string): string => {
+ const trimmedInput = input.trim();
+ if (isNumericUserId(trimmedInput)) {
+ return `${apiOrigin}/admin/user?id=${encodeURIComponent(trimmedInput)}`;
+ }
+ return `${apiOrigin}/admin/user?email=${encodeURIComponent(trimmedInput)}`;
+};
+
+const isNumericUserId = (value: string): boolean => /^\d+$/.test(value);
+
+const formatStorage = (bytes: number | undefined, noneWhenZero = false) => {
+ if (bytes === undefined || (noneWhenZero && bytes === 0)) {
+ return "None";
+ }
+ if (bytes >= 1024 ** 3) {
+ return `${(bytes / 1024 ** 3).toFixed(2)} GB`;
+ }
+ return `${(bytes / 1024 ** 2).toFixed(2)} MB`;
+};
diff --git a/infra/staff/src/components/AddOtt.tsx b/infra/staff/src/components/AddOtt.tsx
index 61d2bd74d3..32f9389622 100644
--- a/infra/staff/src/components/AddOtt.tsx
+++ b/infra/staff/src/components/AddOtt.tsx
@@ -11,10 +11,10 @@ import {
MenuItem,
Paper,
Select,
+ type SelectChangeEvent,
Typography,
} from "@mui/material";
-import type { SelectChangeEvent } from "@mui/material/Select";
-import { useEffect, useState } from "react";
+import React, { useEffect, useState } from "react";
import { apiOrigin, requireToken } from "../services/support";
const APP_OPTIONS = [
@@ -25,26 +25,18 @@ const APP_OPTIONS = [
type AppOption = (typeof APP_OPTIONS)[number]["value"];
-const computeExpiryTimeMicros = () =>
- Date.now() * 1000 + 7 * 24 * 60 * 60 * 1_000_000;
-
-const generateOtp = () =>
- Math.floor(Math.random() * 1_000_000)
- .toString()
- .padStart(6, "0");
-
interface AddOttProps {
open: boolean;
onClose: () => void;
userEmail: string;
}
-export const AddOtt = ({ open, onClose, userEmail }: AddOttProps) => {
+export const AddOtt: React.FC<AddOttProps> = ({ open, onClose, userEmail }) => {
const [selectedApp, setSelectedApp] = useState<AppOption>("photos");
const [submitting, setSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
const [createdOtp, setCreatedOtp] = useState<string | null>(null);
- const [expiryPreview, setExpiryPreview] = useState<number>(() =>
+ const [expiryPreview, setExpiryPreview] = useState(() =>
computeExpiryTimeMicros(),
);
@@ -202,3 +194,11 @@ export const AddOtt = ({ open, onClose, userEmail }: AddOttProps) => {
</Dialog>
);
};
+
+const computeExpiryTimeMicros = () =>
+ Date.now() * 1000 + 7 * 24 * 60 * 60 * 1_000_000;
+
+const generateOtp = () =>
+ Math.floor(Math.random() * 1_000_000)
+ .toString()
+ .padStart(6, "0");
diff --git a/infra/staff/src/components/ChangeEmail.tsx b/infra/staff/src/components/ChangeEmail.tsx
index 271926d950..b39c4cc1ba 100644
--- a/infra/staff/src/components/ChangeEmail.tsx
+++ b/infra/staff/src/components/ChangeEmail.tsx
@@ -14,7 +14,10 @@ import {
getCurrentAdminUserId,
requireToken,
} from "../services/support";
-import type { ErrorResponse } from "../types";
+
+interface ErrorResponse {
+ message: string;
+}
interface ChangeEmailProps {
open: boolean;
@@ -22,8 +25,8 @@ interface ChangeEmailProps {
}
export const ChangeEmail: React.FC<ChangeEmailProps> = ({ open, onClose }) => {
- const [newEmail, setNewEmail] = useState<string>("");
- const [userID, setUserID] = useState<string>("");
+ const [newEmail, setNewEmail] = useState("");
+ const [userID, setUserID] = useState("");
useEffect(() => {
const fetchUserID = async () => {
diff --git a/infra/staff/src/components/CloseFamily.tsx b/infra/staff/src/components/CloseFamily.tsx
index 737a6ccd9e..0f4db70cfb 100644
--- a/infra/staff/src/components/CloseFamily.tsx
+++ b/infra/staff/src/components/CloseFamily.tsx
@@ -17,7 +17,7 @@ import {
interface CloseFamilyProps {
open: boolean;
handleClose: () => void;
- handleCloseFamily: () => void; // Callback to handle closing family
+ handleCloseFamily: () => void;
}
export const CloseFamily: React.FC<CloseFamilyProps> = ({
diff --git a/infra/staff/src/components/Container.tsx b/infra/staff/src/components/Container.tsx
deleted file mode 100644
index bf8c57b5dc..0000000000
--- a/infra/staff/src/components/Container.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import React from "react";
-
-export const Container: React.FC<React.PropsWithChildren> = ({ children }) => (
- <div className="container">{children}</div>
-);
diff --git a/infra/staff/src/components/DeleteAccont.tsx b/infra/staff/src/components/DeleteAccount.tsx
similarity index 100%
rename from infra/staff/src/components/DeleteAccont.tsx
rename to infra/staff/src/components/DeleteAccount.tsx
diff --git a/infra/staff/src/components/Disable2FA.tsx b/infra/staff/src/components/Disable2FA.tsx
index 1f6bc8973a..bbe9b9b1e1 100644
--- a/infra/staff/src/components/Disable2FA.tsx
+++ b/infra/staff/src/components/Disable2FA.tsx
@@ -17,7 +17,7 @@ import {
interface Disable2FAProps {
open: boolean;
handleClose: () => void;
- handleDisable2FA: () => void; // Callback to handle 2FA disablement
+ handleDisable2FA: () => void;
}
export const Disable2FA: React.FC<Disable2FAProps> = ({
diff --git a/infra/staff/src/components/DisablePasskeys.tsx b/infra/staff/src/components/DisablePasskeys.tsx
index 37e0a636b4..65f5be3261 100644
--- a/infra/staff/src/components/DisablePasskeys.tsx
+++ b/infra/staff/src/components/DisablePasskeys.tsx
@@ -13,7 +13,12 @@ import {
getCurrentAdminUserId,
requireToken,
} from "../services/support";
-import type { DisablePasskeysProps } from "../types";
+
+interface DisablePasskeysProps {
+ open: boolean;
+ handleClose: () => void;
+ handleDisablePasskeys: () => void;
+}
export const DisablePasskeys: React.FC<DisablePasskeysProps> = ({
open,
diff --git a/infra/staff/src/components/FamilyComponentTable.tsx b/infra/staff/src/components/FamilyComponentTable.tsx
index 2fe8d88dcc..4a010f3403 100644
--- a/infra/staff/src/components/FamilyComponentTable.tsx
+++ b/infra/staff/src/components/FamilyComponentTable.tsx
@@ -9,17 +9,22 @@ import {
TableHead,
TableRow,
} from "@mui/material";
-import * as React from "react";
-import { useEffect, useState } from "react";
+import React, { useEffect, useState } from "react";
import { getCurrentAdminUser } from "../services/support";
-import type { FamilyMember } from "../types";
-import { formatUsageToGB } from "../utils/";
import { CloseFamily } from "./CloseFamily";
+interface FamilyMember {
+ id: string;
+ email: string;
+ status: string;
+ usage: number;
+ storageLimit: number;
+}
+
export const FamilyTableComponent: React.FC = () => {
const [familyMembers, setFamilyMembers] = useState<FamilyMember[]>([]);
const [closeFamilyOpen, setCloseFamilyOpen] = useState(false);
- const [loading, setLoading] = useState<boolean>(true);
+ const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
@@ -152,3 +157,6 @@ export const FamilyTableComponent: React.FC = () => {
</>
);
};
+
+const formatUsageToGB = (usage: number): string =>
+ `${(usage / (1024 * 1024 * 1024)).toFixed(2)} GB`;
diff --git a/infra/staff/src/components/StorageBonusTableComponent.tsx b/infra/staff/src/components/StorageBonusTableComponent.tsx
index 98740ee95c..586767397b 100644
--- a/infra/staff/src/components/StorageBonusTableComponent.tsx
+++ b/infra/staff/src/components/StorageBonusTableComponent.tsx
@@ -7,8 +7,7 @@ import {
TableHead,
TableRow,
} from "@mui/material";
-import * as React from "react";
-import { useEffect, useState } from "react";
+import React, { useEffect, useState } from "react";
import { getCurrentAdminUser } from "../services/support";
interface BonusData {
@@ -46,18 +45,14 @@ export const StorageBonusTableComponent: React.FC = () => {
);
}, []);
- const formatCreatedAt = (createdAt: number): string => {
- const date = new Date(createdAt / 1000);
- return date.toLocaleDateString(); // Adjust date formatting as needed
- };
+ const formatCreatedAt = (createdAt: number): string =>
+ new Date(createdAt / 1000).toLocaleDateString();
const formatValidTill = (validTill: number): string => {
if (validTill === 0) {
return "Forever";
- } else {
- const date = new Date(validTill / 1000);
- return date.toLocaleDateString(); // Adjust date formatting as needed
}
+ return new Date(validTill / 1000).toLocaleDateString();
};
const formatStorage = (storage: number): string => {
diff --git a/infra/staff/src/components/ToggleEmailMFA.tsx b/infra/staff/src/components/ToggleEmailMFA.tsx
index 03dca92d44..429e8ea22a 100644
--- a/infra/staff/src/components/ToggleEmailMFA.tsx
+++ b/infra/staff/src/components/ToggleEmailMFA.tsx
@@ -17,7 +17,7 @@ import {
interface ToggleEmailMFAProps {
open: boolean;
handleClose: () => void;
- handleToggleEmailMFA: (status: boolean) => void; // Callback to handle toggling Email MFA
+ handleToggleEmailMFA: (status: boolean) => void;
}
export const ToggleEmailMFA: React.FC<ToggleEmailMFAProps> = ({
diff --git a/infra/staff/src/components/TokenTableComponent.tsx b/infra/staff/src/components/TokenTableComponent.tsx
index 95617e5a58..eac273abed 100644
--- a/infra/staff/src/components/TokenTableComponent.tsx
+++ b/infra/staff/src/components/TokenTableComponent.tsx
@@ -8,8 +8,7 @@ import {
TableRow,
TableSortLabel,
} from "@mui/material";
-import * as React from "react";
-import { useEffect, useMemo, useState } from "react";
+import React, { useEffect, useMemo, useState } from "react";
import { getCurrentAdminUser } from "../services/support";
interface TokenData {
@@ -66,10 +65,8 @@ export const TokensTableComponent: React.FC = () => {
return sortableTokens;
}, [order, orderBy, tokens]);
- const formatDate = (timestamp: number): string => {
- const date = new Date(timestamp / 1000);
- return date.toLocaleDateString();
- };
+ const formatDate = (timestamp: number): string =>
+ new Date(timestamp / 1000).toLocaleDateString();
if (loading) {
return <p>Loading...</p>;
diff --git a/infra/staff/src/components/UpdateSubscription.tsx b/infra/staff/src/components/UpdateSubscription.tsx
index fb7a62ffc6..7fdad08c37 100644
--- a/infra/staff/src/components/UpdateSubscription.tsx
+++ b/infra/staff/src/components/UpdateSubscription.tsx
@@ -1,15 +1,18 @@
import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
import CloseIcon from "@mui/icons-material/Close";
-import Button from "@mui/material/Button";
-import Dialog from "@mui/material/Dialog";
-import DialogActions from "@mui/material/DialogActions";
-import DialogContent from "@mui/material/DialogContent";
-import DialogTitle from "@mui/material/DialogTitle";
-import Grid from "@mui/material/Grid";
-import InputAdornment from "@mui/material/InputAdornment";
-import MenuItem from "@mui/material/MenuItem";
-import Select, { type SelectChangeEvent } from "@mui/material/Select";
-import TextField from "@mui/material/TextField";
+import {
+ Button,
+ Dialog,
+ DialogActions,
+ DialogContent,
+ DialogTitle,
+ Grid,
+ InputAdornment,
+ MenuItem,
+ Select,
+ type SelectChangeEvent,
+ TextField,
+} from "@mui/material";
import React, { useEffect, useState } from "react";
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
@@ -18,6 +21,7 @@ import {
getCurrentAdminUser,
requireToken,
} from "../services/support";
+
interface Subscription {
productID: string;
paymentProvider: string;
@@ -87,7 +91,7 @@ export const UpdateSubscription: React.FC<UpdateSubscriptionProps> = ({
transactionId:
userDataResponse.subscription.originalTransactionID ||
"",
- expiryTime: expiryTime,
+ expiryTime,
userId: userDataResponse.subscription.userID || "",
attributes: {
customerID:
diff --git a/infra/staff/src/components/UserComponent.tsx b/infra/staff/src/components/UserComponent.tsx
index f4f9acc3e8..bddd358603 100644
--- a/infra/staff/src/components/UserComponent.tsx
+++ b/infra/staff/src/components/UserComponent.tsx
@@ -1,28 +1,40 @@
import DeleteIcon from "@mui/icons-material/Delete";
import EditIcon from "@mui/icons-material/Edit";
-import Box from "@mui/material/Box";
-import Button from "@mui/material/Button";
-import Grid from "@mui/material/Grid";
-import IconButton from "@mui/material/IconButton";
-import Paper from "@mui/material/Paper";
-import Switch from "@mui/material/Switch";
-import Table from "@mui/material/Table";
-import TableBody from "@mui/material/TableBody";
-import TableCell from "@mui/material/TableCell";
-import TableContainer from "@mui/material/TableContainer";
-import TableRow from "@mui/material/TableRow";
-import Typography from "@mui/material/Typography";
-import { useEffect, useState } from "react";
-import type { UserComponentProps } from "../types";
+import {
+ Box,
+ Button,
+ Grid,
+ IconButton,
+ Paper,
+ Switch,
+ Table,
+ TableBody,
+ TableCell,
+ TableContainer,
+ TableRow,
+ Typography,
+} from "@mui/material";
+import React, { useEffect, useState } from "react";
import { AddOtt } from "./AddOtt";
import { ChangeEmail } from "./ChangeEmail";
-import { DeleteAccount } from "./DeleteAccont";
+import { DeleteAccount } from "./DeleteAccount";
import { Disable2FA } from "./Disable2FA";
import { DisablePasskeys } from "./DisablePasskeys";
import { ToggleEmailMFA } from "./ToggleEmailMFA";
import { UpdateSubscription } from "./UpdateSubscription";
-export const UserComponent = ({ userData }: UserComponentProps) => {
+export interface UserData {
+ user: Record<string, string>;
+ storage: Record<string, string>;
+ subscription: Record<string, string>;
+ security: Record<string, string>;
+}
+
+interface UserComponentProps {
+ userData: UserData | null;
+}
+
+export const UserComponent: React.FC<UserComponentProps> = ({ userData }) => {
const [deleteAccountOpen, setDeleteAccountOpen] = useState(false);
const [email2FAEnabled, setEmail2FAEnabled] = useState(false);
const [email2FAOpen, setEmail2FAToggleOpen] = useState(false);
@@ -130,7 +142,7 @@ interface DataTableProps {
setEmail2FAToggleOpen: (open: boolean) => void;
}
-const DataTable = ({
+const DataTable: React.FC<DataTableProps> = ({
title,
data,
onEditEmail,
@@ -144,7 +156,7 @@ const DataTable = ({
setDisable2FAOpen,
email2FAEnabled,
setEmail2FAToggleOpen,
-}: DataTableProps) => (
+}) => (
<TableContainer
component={Paper}
variant="outlined"
diff --git a/infra/staff/src/styles/globals.css b/infra/staff/src/styles/globals.css
index 158d0e10ce..6e03e1fb9c 100644
--- a/infra/staff/src/styles/globals.css
+++ b/infra/staff/src/styles/globals.css
@@ -1,12 +1,11 @@
:root {
color-scheme: light dark;
- color: #213547;
- background-color: #ffffff;
+ color: light-dark(#213547, rgb(255 255 255 / 87%));
+ background-color: light-dark(#ffffff, #242424);
}
body {
font-family: system-ui, sans-serif;
-
margin: 0;
display: flex;
justify-content: center;
@@ -15,24 +14,9 @@ body {
}
a {
- color: green;
+ color: light-dark(green, lightgreen);
}
a:hover {
- color: darkgreen;
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- color: rgba(255, 255, 255, 0.87);
- background-color: #242424;
- }
-
- a {
- color: lightgreen;
- }
-
- a:hover {
- color: chartreuse;
- }
+ color: light-dark(darkgreen, chartreuse);
}
diff --git a/infra/staff/src/types/index.ts b/infra/staff/src/types/index.ts
deleted file mode 100644
index 4e66272f0e..0000000000
--- a/infra/staff/src/types/index.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-export interface User {
- ID: string;
- email: string;
- creationTime: number;
-}
-
-export interface UserResponse {
- user: User;
- subscription: Subscription;
- authCodes?: number;
- details?: { usage?: number; storageBonus?: number; profileData: Security };
-}
-
-export interface UserData {
- user: Record<string, string>;
- storage: Record<string, string>;
- subscription: Record<string, string>;
- security: Record<string, string>;
-}
-
-export interface UserComponentProps {
- userData: UserData | null;
-}
-
-export interface ErrorResponse {
- message: string;
-}
-
-export interface Subscription {
- productID: string;
- paymentProvider: string;
- expiryTime: number;
- storage: number;
-}
-
-export interface Security {
- isEmailMFAEnabled: boolean;
- isTwoFactorEnabled: boolean;
- passkeys: string;
- passkeyCount: number;
- canDisableEmailMFA: boolean;
-}
-
-export interface FamilyMember {
- id: string;
- email: string;
- status: string;
- usage: number;
- storageLimit: number;
-}
-
-export interface DisablePasskeysProps {
- open: boolean;
- handleClose: () => void;
- handleDisablePasskeys: () => void;
-}
diff --git a/infra/staff/src/utils/index.ts b/infra/staff/src/utils/index.ts
deleted file mode 100644
index 0e9497d434..0000000000
--- a/infra/staff/src/utils/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export const formatUsageToGB = (usage: number): string => {
- const usageInGB = (usage / (1024 * 1024 * 1024)).toFixed(2);
- return `${usageInGB} GB`;
-};