From 7c3ce5214ff89bef6180f42a68b8b237e989452b 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.

---
 FrontEnd/src/app/views/user/UserCard.tsx | 52 +++-----------------------------
 1 file changed, 4 insertions(+), 48 deletions(-)

(limited to 'FrontEnd/src/app/views/user/UserCard.tsx')

diff --git a/FrontEnd/src/app/views/user/UserCard.tsx b/FrontEnd/src/app/views/user/UserCard.tsx
index 575ca2c1..b2c94457 100644
--- a/FrontEnd/src/app/views/user/UserCard.tsx
+++ b/FrontEnd/src/app/views/user/UserCard.tsx
@@ -5,16 +5,13 @@ import TimelinePageCardTemplate, {
 } from "../timeline-common/TimelinePageCardTemplate";
 import { TimelinePageCardProps } from "../timeline-common/TimelinePageTemplate";
 import UserAvatar from "../common/user/UserAvatar";
-import ChangeNicknameDialog from "./ChangeNicknameDialog";
-import { getHttpUserClient } from "@/http/user";
-import ChangeAvatarDialog from "./ChangeAvatarDialog";
 
 const UserCard: React.FC<TimelinePageCardProps> = (props) => {
-  const { timeline, onReload } = props;
+  const { timeline } = props;
 
-  const [dialog, setDialog] = React.useState<
-    "member" | "property" | "avatar" | "nickname" | null
-  >(null);
+  const [dialog, setDialog] = React.useState<"member" | "property" | null>(
+    null
+  );
 
   return (
     <>
@@ -41,16 +38,6 @@ const UserCard: React.FC<TimelinePageCardProps> = (props) => {
             return {
               type: "manage",
               items: [
-                {
-                  type: "button",
-                  text: "timeline.manageItem.nickname",
-                  onClick: () => setDialog("nickname"),
-                },
-                {
-                  type: "button",
-                  text: "timeline.manageItem.avatar",
-                  onClick: () => setDialog("avatar"),
-                },
                 {
                   type: "button",
                   text: "timeline.manageItem.property",
@@ -69,37 +56,6 @@ const UserCard: React.FC<TimelinePageCardProps> = (props) => {
         setDialog={setDialog}
         {...props}
       />
-      {(() => {
-        // TODO: Move this two to settings.
-        if (dialog === "nickname") {
-          return (
-            <ChangeNicknameDialog
-              open
-              close={() => setDialog(null)}
-              onProcess={async (newNickname) => {
-                await getHttpUserClient().patch(timeline.owner.username, {
-                  nickname: newNickname,
-                });
-                onReload();
-              }}
-            />
-          );
-        } else if (dialog === "avatar") {
-          return (
-            <ChangeAvatarDialog
-              open
-              close={() => setDialog(null)}
-              process={async (file) => {
-                await getHttpUserClient().putAvatar(
-                  timeline.owner.username,
-                  file
-                );
-                onReload();
-              }}
-            />
-          );
-        }
-      })()}
     </>
   );
 };
-- 
cgit v1.2.3

