Corgi
@@ -77,7 +77,7 @@ const Header: React.FC = () => {
actions={
<>
My Account
diff --git a/web/src/less/common-dialog.less b/web/src/less/common-dialog.less
new file mode 100644
index 0000000..125cb50
--- /dev/null
+++ b/web/src/less/common-dialog.less
@@ -0,0 +1,25 @@
+.common-dialog {
+ > .dialog-container {
+ @apply w-80;
+
+ > .dialog-content-container {
+ @apply flex flex-col justify-start items-start;
+
+ > .btns-container {
+ @apply flex flex-row justify-end items-center w-full mt-4;
+
+ > .btn {
+ @apply text-sm py-1 px-3 mr-2 rounded-md cursor-pointer hover:opacity-80;
+
+ &.confirm-btn {
+ @apply bg-red-100 border border-solid border-blue-600 text-blue-600;
+
+ &.warning {
+ @apply border-red-600 text-red-600;
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/web/src/pages/UserDetail.tsx b/web/src/pages/UserDetail.tsx
index a404701..3956904 100644
--- a/web/src/pages/UserDetail.tsx
+++ b/web/src/pages/UserDetail.tsx
@@ -1,16 +1,71 @@
import { useAppSelector } from "../store";
import Header from "../components/Header";
+import { showCommonDialog } from "../components/Dialog/CommonDialog";
+import { userService } from "../services";
+import Icon from "../components/Icon";
+import copy from "copy-to-clipboard";
+import toastHelper from "../components/Toast";
+import showChangePasswordDialog from "../components/ChangePasswordDialog";
const UserDetail: React.FC = () => {
const { user } = useAppSelector((state) => state.user);
+ const handleChangePasswordBtnClick = async () => {
+ showChangePasswordDialog();
+ };
+
+ const handleCopyOpenIdBtnClick = async () => {
+ if (!user?.openId) {
+ toastHelper.error("OpenID not found");
+ return;
+ }
+
+ copy(user.openId);
+ toastHelper.success("OpenID copied");
+ };
+
+ const handleResetOpenIdBtnClick = async () => {
+ showCommonDialog({
+ title: "Reset Open API",
+ content: "❗️The existing API will be invalidated and a new one will be generated, are you sure you want to reset?",
+ style: "warning",
+ onConfirm: async () => {
+ await userService.patchUser({
+ id: user?.id as UserId,
+ resetOpenID: true,
+ });
+ },
+ });
+ };
+
return (
-
+
{user?.name}
-
Email: {user?.email}
-
OpenID: {user?.openId}
+
+ Email:
+ {user?.email}
+
+
+ Password:
+
+
+
+ OpenID:
+
+
+
+
);
diff --git a/web/src/pages/WorkspaceDetail.tsx b/web/src/pages/WorkspaceDetail.tsx
index 392ee44..e6fb615 100644
--- a/web/src/pages/WorkspaceDetail.tsx
+++ b/web/src/pages/WorkspaceDetail.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
-import { Link, useParams } from "react-router-dom";
+import { useParams } from "react-router-dom";
import { shortcutService, workspaceService } from "../services";
import { useAppSelector } from "../store";
import useLoading from "../hooks/useLoading";