feat: expand user profiles and google account linking ux

This commit is contained in:
cesnimda
2026-03-22 14:29:23 +01:00
parent e12f659684
commit ef04961c9f
3 changed files with 48 additions and 1 deletions
@@ -5,7 +5,7 @@ import { Box, Button, Paper, TextField, Typography } from "@mui/material";
import { api } from "../api";
import { getAuthToken } from "../auth";
import { useToast } from "../toast";
import { confirmAction } from "../dialogs";
import { useDialogActions } from "../dialogs";
type UserDto = {
id: string;
@@ -212,6 +212,28 @@ export default function AdminUsersPage() {
);
})}
{!loading && users.length === 0 ? (
<TableRow>
<TableCell colSpan={7}>
<Typography sx={{ color: "text.secondary", py: 2, textAlign: "center" }}>No users.</Typography>
</TableCell>
</TableRow>
) : null}
</TableBody>
</Table>
</TableContainer>
</Paper>
);
}
<Button size="small" color="error" variant="outlined" onClick={() => void remove(u)}>
Delete
</Button>
</Box>
</TableCell>
</TableRow>
);
})}
{!loading && users.length === 0 ? (
<TableRow>
<TableCell colSpan={5}>
+25
View File
@@ -88,6 +88,8 @@ export default function ProfilePage() {
</Box>
</Box>
<GoogleAuthCard />
<Box sx={{ mt: 3, display: "grid", gridTemplateColumns: { xs: "1fr", md: "1fr 1fr" }, gap: 2 }}>
<Box sx={{ gridColumn: "1 / -1" }}>
<Typography variant="h6">Account</Typography>
@@ -186,4 +188,27 @@ export default function ProfilePage() {
</Box>
</Paper>
);
}
try {
await api.post("/auth/change-password", {
currentPassword,
newPassword,
});
setCurrentPassword("");
setNewPassword("");
toast("Password updated.", "success");
} catch (e: any) {
const msg = e?.response?.data || e?.message || "Failed to change password.";
toast(String(msg), "error");
} finally {
setLoading(false);
}
}}
>
Update password
</Button>
</Box>
</Box>
</Paper>
);
}