Skip to content

Commit 9a8dc5f

Browse files
committed
feat(web): Add loading indicator to show the app is authanticating
1 parent b0f9763 commit 9a8dc5f

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

apps/web/src/auth/auth.client.tsx

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
multiSessionClient,
1414
} from "better-auth/client/plugins";
1515
import env from "@/env";
16+
import Box from "@mui/material/Box";
17+
import CircularProgress from "@mui/material/CircularProgress";
1618

1719
export const authClient = createAuthClient({
1820
baseURL: env.VITE_BACKEND_API_URL,
@@ -28,7 +30,42 @@ export const { signIn, signUp, useSession } = authClient;
2830
export function AuthProtectedComponent(props: { component: ReactElement }) {
2931
const session = useSession();
3032
if (session.isPending) {
31-
return <Skeleton width={"100%"} height={"100%"} />;
33+
return (
34+
<div
35+
style={{
36+
height: "80vh",
37+
width: "80vw",
38+
position: "relative",
39+
top: "50%",
40+
left: "50%",
41+
transform: "translate(-50%, -50%)",
42+
}}
43+
>
44+
<Skeleton width="100%" height="100%" />
45+
<div
46+
style={{
47+
position: "relative",
48+
top: "-50%",
49+
left: "50%",
50+
transform: "translate(-50%, -50%)",
51+
display: "flex",
52+
width: "100%",
53+
justifyContent: "center",
54+
alignItems: "center",
55+
}}
56+
>
57+
<CircularProgress color="secondary" thickness={5} />
58+
<Typography
59+
variant="h5"
60+
textAlign="right"
61+
color="textSecondary"
62+
sx={{ mx: 2 }}
63+
>
64+
Authanticating
65+
</Typography>
66+
</div>
67+
</div>
68+
);
3269
}
3370

3471
if (!session.data)

0 commit comments

Comments
 (0)