From c18be32c09280a7663e2f9364aac3c6284f49910 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 25 May 2024 16:48:13 +0530 Subject: [PATCH] Rearrange --- web/apps/auth/src/pages/auth.tsx | 55 +++++++++++++------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/web/apps/auth/src/pages/auth.tsx b/web/apps/auth/src/pages/auth.tsx index 7be7835a85..93a95c880a 100644 --- a/web/apps/auth/src/pages/auth.tsx +++ b/web/apps/auth/src/pages/auth.tsx @@ -12,7 +12,7 @@ import { CustomError } from "@ente/shared/error"; import InMemoryStore, { MS_KEYS } from "@ente/shared/storage/InMemoryStore"; import LogoutOutlined from "@mui/icons-material/LogoutOutlined"; import MoreHoriz from "@mui/icons-material/MoreHoriz"; -import { Button, ButtonBase, Snackbar, TextField } from "@mui/material"; +import { Button, ButtonBase, Snackbar, TextField, styled } from "@mui/material"; import { t } from "i18next"; import { useRouter } from "next/router"; import { AppContext } from "pages/_app"; @@ -30,8 +30,7 @@ const AuthenticatorCodesPage = () => { useEffect(() => { const fetchCodes = async () => { try { - const res = await getAuthCodes(); - setCodes(res); + setCodes(await getAuthCodes()); } catch (e) { if ( e instanceof Error && @@ -58,11 +57,9 @@ const AuthenticatorCodesPage = () => { if (!hasFetched) { return ( - <> - - - - + + + ); } @@ -80,9 +77,7 @@ const AuthenticatorCodesPage = () => { }} >
- {filteredCodes.length === 0 && searchTerm.length === 0 ? ( - <> - ) : ( + {(filteredCodes.length || searchTerm.length) && ( { justifyContent: "center", }} > - {filteredCodes.length === 0 ? ( + {filteredCodes.length ? ( + filteredCodes.map((code) => ( + + )) + ) : (
{ marginTop: "32px", }} > - {searchTerm.length !== 0 ? ( -

{t("NO_RESULTS")}

- ) : ( -
- )} + {searchTerm.length &&

{t("NO_RESULTS")}

}
- ) : ( - filteredCodes.map((code) => ( - - )) )}
-