From 376177d78efcfc835d96840edb9c8cf2cd9d933a Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Fri, 3 Oct 2025 12:49:28 +0800 Subject: [PATCH] rename: (User -> My)ProfileDialog --- client/ui/App.tsx | 16 ++-- client/ui/AppMobile.tsx | 16 ++-- ...rProfileDialog.tsx => MyProfileDialog.tsx} | 73 +++++++++---------- 3 files changed, 50 insertions(+), 55 deletions(-) rename client/ui/dialog/{UserProfileDialog.tsx => MyProfileDialog.tsx} (67%) diff --git a/client/ui/App.tsx b/client/ui/App.tsx index ce27c1b..d843f33 100644 --- a/client/ui/App.tsx +++ b/client/ui/App.tsx @@ -14,7 +14,7 @@ import { checkApiSuccessOrSncakbar } from "./snackbar.ts" import RegisterDialog from "./dialog/RegisterDialog.tsx" import LoginDialog from "./dialog/LoginDialog.tsx" -import UserProfileDialog from "./dialog/UserProfileDialog.tsx" +import MyProfileDialog from "./dialog/MyProfileDialog.tsx" import ContactsList from "./main/ContactsList.tsx" import RecentsList from "./main/RecentsList.tsx" import useAsyncEffect from "./useAsyncEffect.ts" @@ -52,10 +52,10 @@ export default function App() { const registerInputNickNameRef = React.useRef(null) const registerInputPasswordRef = React.useRef(null) - const userProfileDialogRef = React.useRef(null) - const openMyUserProfileDialogButtonRef = React.useRef(null) - useEventListener(openMyUserProfileDialogButtonRef, 'click', (_event) => { - userProfileDialogRef.current!.open = true + const myProfileDialogRef = React.useRef(null) + const openMyProfileDialogButtonRef = React.useRef(null) + useEventListener(openMyProfileDialogButtonRef, 'click', (_event) => { + myProfileDialogRef.current!.open = true }) const addContactDialogRef = React.useRef(null) @@ -112,8 +112,8 @@ export default function App() { loginInputAccountRef={loginInputAccountRef} loginInputPasswordRef={loginInputPasswordRef} /> - - + diff --git a/client/ui/AppMobile.tsx b/client/ui/AppMobile.tsx index 1b417ae..f5c56c7 100644 --- a/client/ui/AppMobile.tsx +++ b/client/ui/AppMobile.tsx @@ -13,7 +13,7 @@ import { checkApiSuccessOrSncakbar } from "./snackbar.ts" import RegisterDialog from "./dialog/RegisterDialog.tsx" import LoginDialog from "./dialog/LoginDialog.tsx" -import UserProfileDialog from "./dialog/UserProfileDialog.tsx" +import MyProfileDialog from "./dialog/MyProfileDialog.tsx" import ContactsList from "./main/ContactsList.tsx" import RecentsList from "./main/RecentsList.tsx" import useAsyncEffect from "./useAsyncEffect.ts" @@ -51,10 +51,10 @@ export default function AppMobile() { const registerInputNickNameRef = React.useRef(null) const registerInputPasswordRef = React.useRef(null) - const userProfileDialogRef = React.useRef(null) - const openMyUserProfileDialogButtonRef = React.useRef(null) - useEventListener(openMyUserProfileDialogButtonRef, 'click', (_event) => { - userProfileDialogRef.current!.open = true + const myProfileDialogRef = React.useRef(null) + const openMyProfileDialogButtonRef = React.useRef(null) + useEventListener(openMyProfileDialogButtonRef, 'click', (_event) => { + myProfileDialogRef.current!.open = true }) const addContactDialogRef = React.useRef(null) @@ -131,8 +131,8 @@ export default function AppMobile() { loginInputAccountRef={loginInputAccountRef} loginInputPasswordRef={loginInputPasswordRef} /> - - + { diff --git a/client/ui/dialog/UserProfileDialog.tsx b/client/ui/dialog/MyProfileDialog.tsx similarity index 67% rename from client/ui/dialog/UserProfileDialog.tsx rename to client/ui/dialog/MyProfileDialog.tsx index 256eea4..95978cf 100644 --- a/client/ui/dialog/UserProfileDialog.tsx +++ b/client/ui/dialog/MyProfileDialog.tsx @@ -10,12 +10,12 @@ import Avatar from "../Avatar.tsx" import User from "../../api/client_data/User.ts" interface Refs { - userProfileDialogRef: React.MutableRefObject + myProfileDialogRef: React.MutableRefObject user: User } -export default function UserProfileDialog({ - userProfileDialogRef, +export default function MyProfileDialog({ + myProfileDialogRef, user }: Refs) { const isMySelf = Client.myUserProfile?.id == user?.id @@ -47,7 +47,7 @@ export default function UserProfileDialog({ { // 公用 - 資料卡 } - +
- {!isMySelf && 編輯聯絡人訊息} - { - isMySelf && <> - userProfileEditDialogRef.current!.open = true}>編輯資料 - {/* - 賬號設定 - 隱私設定 - */} - - dialog({ - headline: "退出登錄", - description: "確定要退出登錄嗎? (若您的賬號未設定 用戶名, 請無務必複製 用戶 ID, 以免丟失賬號!)", - actions: [ - { - text: "取消", - onClick: () => { - return true - }, - }, - { - text: "確定", - onClick: () => { - data.access_token = '' - data.apply() - location.reload() - return true - }, - } - ], - })}>退出登錄 - - } + userProfileEditDialogRef.current!.open = true}>編輯資料 + {/* + 賬號設定 + 隱私設定 + */} + + dialog({ + headline: "退出登錄", + description: "確定要退出登錄嗎? (若您的賬號未設定 用戶名, 請無務必複製 用戶 ID, 以免丟失賬號!)", + actions: [ + { + text: "取消", + onClick: () => { + return true + }, + }, + { + text: "確定", + onClick: () => { + data.access_token = '' + data.apply() + location.reload() + return true + }, + } + ], + })}>退出登錄 {