From 19265fb44fe0970e0a6c9afe8f2b48571aee9e75 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Mon, 15 Feb 2021 01:23:24 +0800
Subject: feat: Move change avatar and nickname to settings.

---
 .../app/views/settings/ChangeNicknameDialog.tsx    | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 FrontEnd/src/app/views/settings/ChangeNicknameDialog.tsx

(limited to 'FrontEnd/src/app/views/settings/ChangeNicknameDialog.tsx')

diff --git a/FrontEnd/src/app/views/settings/ChangeNicknameDialog.tsx b/FrontEnd/src/app/views/settings/ChangeNicknameDialog.tsx
new file mode 100644
index 00000000..4b44cdd6
--- /dev/null
+++ b/FrontEnd/src/app/views/settings/ChangeNicknameDialog.tsx
@@ -0,0 +1,32 @@
+import { getHttpUserClient } from "@/http/user";
+import { useUserLoggedIn } from "@/services/user";
+import React from "react";
+
+import OperationDialog from "../common/OperationDialog";
+
+export interface ChangeNicknameDialogProps {
+  open: boolean;
+  close: () => void;
+}
+
+const ChangeNicknameDialog: React.FC<ChangeNicknameDialogProps> = (props) => {
+  const user = useUserLoggedIn();
+
+  return (
+    <OperationDialog
+      open={props.open}
+      title="settings.dialogChangeNickname.title"
+      inputScheme={[
+        { type: "text", label: "settings.dialogChangeNickname.inputLabel" },
+      ]}
+      onProcess={([newNickname]) => {
+        return getHttpUserClient().patch(user.username, {
+          nickname: newNickname,
+        });
+      }}
+      close={props.close}
+    />
+  );
+};
+
+export default ChangeNicknameDialog;
-- 
cgit v1.2.3

