From 270cac5a44691fe20b54a15e37aee2038b98e2f4 Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Tue, 28 Feb 2023 20:04:53 +0800 Subject: [PATCH] fix: tweak UX --- src/common/component/InviteLink.tsx | 2 +- src/common/component/ManageMembers/index.tsx | 77 ++++++++++---------- src/common/component/Message/Reaction.tsx | 2 +- src/common/component/Message/index.tsx | 2 +- src/common/component/RequireAuth.tsx | 7 +- src/routes/chat/index.tsx | 2 +- 6 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/common/component/InviteLink.tsx b/src/common/component/InviteLink.tsx index ca498b60..4c59b665 100644 --- a/src/common/component/InviteLink.tsx +++ b/src/common/component/InviteLink.tsx @@ -16,7 +16,7 @@ const InviteLink: FC = () => { return (
-

+

{t("share_invite_link")} {t("invite_link_faq")} diff --git a/src/common/component/ManageMembers/index.tsx b/src/common/component/ManageMembers/index.tsx index e6e2f5d1..71ef5c68 100644 --- a/src/common/component/ManageMembers/index.tsx +++ b/src/common/component/ManageMembers/index.tsx @@ -84,44 +84,45 @@ const ManageMembers: FC = ({ cid }) => {

- - {is_admin ? t("admin") : t("user")} - {switchRoleVisible && ( - -
  • - {t("admin")} - {is_admin && } -
  • -
  • - {t("user")} - {!is_admin && } -
  • - - } - > - -
    - )} -
    + {switchRoleVisible ? +
  • + {t("admin")} + {is_admin && } +
  • +
  • + {t("user")} + {!is_admin && } +
  • + + } + > + + {is_admin ? t("admin") : t("user")} + + +
    : + + {is_admin ? t("admin") : t("user")}} + {dotsVisible && ( = ({ mid, reactions = null, readOnly = false }) => { placement="top" content={} > - + diff --git a/src/common/component/Message/index.tsx b/src/common/component/Message/index.tsx index e8ca5ba1..a6599bd8 100644 --- a/src/common/component/Message/index.tsx +++ b/src/common/component/Message/index.tsx @@ -98,7 +98,7 @@ const Message: FC = ({ ref={inviewRef} className={clsx(`group w-full relative flex items-start gap-2 md:gap-4 px-1 md:px-2 py-1 my-2 rounded-lg md:dark:hover:bg-gray-800 md:hover:bg-gray-100`, readOnly && "hover:bg-transparent", - showExpire && "bg-red-200", + showExpire && "bg-red-200 dark:bg-red-200/40", pinInfo && "bg-cyan-50 dark:bg-cyan-800 pt-7" )} > diff --git a/src/common/component/RequireAuth.tsx b/src/common/component/RequireAuth.tsx index fb675c55..d35ffa6e 100644 --- a/src/common/component/RequireAuth.tsx +++ b/src/common/component/RequireAuth.tsx @@ -4,6 +4,7 @@ import { GuestRoutes } from "../../app/config"; import { useGetInitializedQuery } from "../../app/services/auth"; import { useGetLoginConfigQuery } from "../../app/services/server"; import { useAppSelector } from "../../app/store"; +import Loading from "./Loading"; interface Props { children: ReactElement; @@ -14,15 +15,15 @@ const GuestAllows = GuestRoutes.map((path) => { }); const RequireAuth: FC = ({ children, redirectTo = "/login" }) => { const location = useLocation(); - const matchs = matchRoutes(GuestAllows, location); - const allowGuest = matchs ? !!matchs[0].pathname : false; + const matches = matchRoutes(GuestAllows, location); + const allowGuest = matches ? !!matches[0].pathname : false; const { data: loginConfig, isSuccess: loginConfigSuccess } = useGetLoginConfigQuery(); const { isSuccess: checkInitialSuccess } = useGetInitializedQuery(); const { token, guest, initialized } = useAppSelector((store) => store.authData); // console.log("auth route", { checkInitialSuccess, loginConfigSuccess, initialized, guest: loginConfig?.guest, token, allowGuest, guest }); // 初始化和login配置检查 - if (!checkInitialSuccess || !loginConfigSuccess) return null; + if (!checkInitialSuccess || !loginConfigSuccess) return ; // 未初始化 则先走setup 流程 if (!initialized) return ; // 开启guest 并且没token 而且是允许guest访问的路由 则先去过渡页登录 diff --git a/src/routes/chat/index.tsx b/src/routes/chat/index.tsx index 3661b26d..48dffecc 100644 --- a/src/routes/chat/index.tsx +++ b/src/routes/chat/index.tsx @@ -56,7 +56,7 @@ function ChatPage() { {usersModalVisible && }
    {sessionListVisible &&
    } -