From 70be5235ba90a15b7798a7922382835fd680b1fc Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 3 Sep 2020 18:10:02 +0800 Subject: Migrate to react-bootstrap. --- .../src/app/views/user/ChangeAvatarDialog.tsx | 93 ++++++++++------------ .../ClientApp/src/app/views/user/UserInfoCard.tsx | 48 ++++------- 2 files changed, 61 insertions(+), 80 deletions(-) (limited to 'Timeline/ClientApp/src/app/views/user') diff --git a/Timeline/ClientApp/src/app/views/user/ChangeAvatarDialog.tsx b/Timeline/ClientApp/src/app/views/user/ChangeAvatarDialog.tsx index 1dd2ee8b..ffa2218b 100644 --- a/Timeline/ClientApp/src/app/views/user/ChangeAvatarDialog.tsx +++ b/Timeline/ClientApp/src/app/views/user/ChangeAvatarDialog.tsx @@ -1,14 +1,7 @@ import React, { useState, useEffect } from "react"; import { useTranslation } from "react-i18next"; -import { - Modal, - ModalHeader, - Row, - Button, - ModalBody, - ModalFooter, -} from "reactstrap"; import { AxiosError } from "axios"; +import { Modal, Row, Button } from "react-bootstrap"; import { UiLogicError } from "@/common"; @@ -56,7 +49,7 @@ const ChangeAvatarDialog: React.FC = (props) => { const closeDialog = props.close; - const toggle = React.useCallback((): void => { + const close = React.useCallback((): void => { if (!(state === "uploading")) { closeDialog(); } @@ -163,23 +156,25 @@ const ChangeAvatarDialog: React.FC = (props) => { }; return ( - - {t("userPage.dialogChangeAvatar.title")} + + + {t("userPage.dialogChangeAvatar.title")} + {(() => { if (state === "select") { return ( <> - + {t("userPage.dialogChangeAvatar.prompt.select")} - - - - + ); } else if (state === "crop") { @@ -188,7 +183,7 @@ const ChangeAvatarDialog: React.FC = (props) => { } return ( <> - + = (props) => { /> {t("userPage.dialogChangeAvatar.prompt.crop")} - - - - - + ); } else if (state === "processcrop") { return ( <> - + {t("userPage.dialogChangeAvatar.prompt.processingCrop")} - - - - - + ); } else if (state === "preview") { return ( <> - + {createPreviewRow()} {t("userPage.dialogChangeAvatar.prompt.preview")} - - - - - - + ); } else if (state === "uploading") { return ( <> - + {createPreviewRow()} {t("userPage.dialogChangeAvatar.prompt.uploading")} - - + + ); } else if (state === "success") { return ( <> - + {t("operationDialog.success")} - - - - + ); } else { return ( <> - + {createPreviewRow()} {trueMessage} - - - - - + ); } diff --git a/Timeline/ClientApp/src/app/views/user/UserInfoCard.tsx b/Timeline/ClientApp/src/app/views/user/UserInfoCard.tsx index 1a111877..f1878b5c 100644 --- a/Timeline/ClientApp/src/app/views/user/UserInfoCard.tsx +++ b/Timeline/ClientApp/src/app/views/user/UserInfoCard.tsx @@ -1,14 +1,8 @@ import React from "react"; import clsx from "clsx"; -import { - Dropdown, - DropdownToggle, - DropdownMenu, - DropdownItem, - Button, -} from "reactstrap"; import { useTranslation } from "react-i18next"; import { fromEvent } from "rxjs"; +import { Dropdown, Button } from "react-bootstrap"; import { timelineVisibilityTooltipTranslationMap } from "@/services/timeline"; import { useAvatar } from "@/services/user"; @@ -42,24 +36,16 @@ const UserInfoCard: React.FC = (props) => { return () => subscription.unsubscribe(); }); - const [manageDropdownOpen, setManageDropdownOpen] = React.useState( - false - ); - const toggleManageDropdown = React.useCallback( - (): void => setManageDropdownOpen((old) => !old), - [] - ); - return (
{props.timeline.owner.nickname} @@ -73,27 +59,27 @@ const UserInfoCard: React.FC = (props) => {
{onManage != null ? ( - - + + {t("timeline.manage")} - - - onManage("nickname")}> + + + onManage("nickname")}> {t("timeline.manageItem.nickname")} - - onManage("avatar")}> + + onManage("avatar")}> {t("timeline.manageItem.avatar")} - - onManage("property")}> + + onManage("property")}> {t("timeline.manageItem.property")} - - + + {t("timeline.manageItem.member")} - - + + ) : ( - )} -- cgit v1.2.3