diff --git a/web/src/components/SettingDialog.tsx b/web/src/components/SettingDialog.tsx index 4cd8e88d..8b5479ed 100644 --- a/web/src/components/SettingDialog.tsx +++ b/web/src/components/SettingDialog.tsx @@ -13,21 +13,23 @@ import StorageSection from "./Settings/StorageSection"; import SSOSection from "./Settings/SSOSection"; import "../less/setting-dialog.less"; -type Props = DialogProps; - type SettingSection = "my-account" | "preference" | "member" | "system" | "storage" | "sso"; +interface Props extends DialogProps { + selectedSection?: SettingSection; +} + interface State { selectedSection: SettingSection; } const SettingDialog: React.FC = (props: Props) => { - const { destroy } = props; + const { destroy, selectedSection } = props; const { t } = useTranslation(); const userStore = useUserStore(); const user = userStore.state.user; const [state, setState] = useState({ - selectedSection: "my-account", + selectedSection: selectedSection || "my-account", }); const isHost = user?.role === "HOST"; @@ -128,13 +130,15 @@ const SettingDialog: React.FC = (props: Props) => { ); }; -export default function showSettingDialog(): void { +export default function showSettingDialog(selectedSection?: SettingSection): void { generateDialog( { className: "setting-dialog", dialogName: "setting-dialog", }, SettingDialog, - {} + { + selectedSection, + } ); } diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsx index 9029be7b..b9b4d212 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserBanner.tsx @@ -7,6 +7,7 @@ import Dropdown from "./common/Dropdown"; import showArchivedMemoDialog from "./ArchivedMemoDialog"; import showAboutSiteDialog from "./AboutSiteDialog"; import UserAvatar from "./UserAvatar"; +import showSettingDialog from "./SettingDialog"; const UserBanner = () => { const { t } = useTranslation(); @@ -44,6 +45,10 @@ const UserBanner = () => { }); }, [memos]); + const handleMyAccountClick = () => { + showSettingDialog("my-account"); + }; + const handleArchivedBtnClick = () => { showArchivedMemoDialog(); }; @@ -77,6 +82,12 @@ const UserBanner = () => { <> {!userStore.isVisitorMode() && ( <> + {!userStore.isVisitorMode() && (