Add full profiles and latency tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { Box, Button, Paper, Typography } from "@mui/material";
|
||||
|
||||
@@ -11,7 +11,14 @@ type MeResponse = {
|
||||
id?: string;
|
||||
email?: string;
|
||||
userName?: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
displayName?: string;
|
||||
roles?: string[];
|
||||
googleLink?: {
|
||||
linked: boolean;
|
||||
email?: string | null;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export default function AuthStatusCard() {
|
||||
@@ -30,6 +37,8 @@ export default function AuthStatusCard() {
|
||||
.catch(() => setMe(null));
|
||||
}, [token]);
|
||||
|
||||
const label = useMemo(() => me?.displayName || [me?.firstName, me?.lastName].filter(Boolean).join(" ") || me?.email, [me]);
|
||||
|
||||
return (
|
||||
<Paper sx={{ mt: 2, p: 2 }}>
|
||||
<Typography variant="h6" sx={{ mb: 1 }}>
|
||||
@@ -41,13 +50,18 @@ export default function AuthStatusCard() {
|
||||
) : (
|
||||
<Box sx={{ display: "flex", flexDirection: "column", gap: 0.5 }}>
|
||||
<Typography sx={{ color: "text.secondary" }}>
|
||||
Signed in{me?.email ? ` as ${me.email}` : ""}{me?.provider ? ` (${me.provider})` : ""}.
|
||||
Signed in{label ? ` as ${label}` : ""}{me?.provider ? ` (${me.provider})` : ""}.
|
||||
</Typography>
|
||||
{me?.roles && me.roles.length > 0 ? (
|
||||
<Typography sx={{ color: "text.secondary" }}>
|
||||
Roles: {me.roles.join(", ")}
|
||||
</Typography>
|
||||
) : null}
|
||||
{me?.googleLink?.linked ? (
|
||||
<Typography sx={{ color: "text.secondary" }}>
|
||||
Google linked{me.googleLink.email ? `: ${me.googleLink.email}` : "."}
|
||||
</Typography>
|
||||
) : null}
|
||||
|
||||
<Box sx={{ mt: 1 }}>
|
||||
<Button
|
||||
@@ -66,4 +80,3 @@ export default function AuthStatusCard() {
|
||||
</Paper>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user