From 5b6b1e1b89a23eb91e96b16a0de09fa247debcf1 Mon Sep 17 00:00:00 2001 From: haorwen Date: Sat, 27 Jun 2026 22:17:03 +0800 Subject: [PATCH] feat: add Home tab to mobile bottom nav with iframe landing page --- public/locales/de/common.json | 1 + public/locales/en/common.json | 1 + public/locales/es/common.json | 1 + public/locales/fr/common.json | 1 + public/locales/jp/common.json | 1 + public/locales/pt/common.json | 1 + public/locales/ru/common.json | 1 + public/locales/tr/common.json | 1 + public/locales/zh/common.json | 1 + src/routes/chat/index.tsx | 4 ++-- src/routes/home/MobileNavs.tsx | 26 +++++++++++++++++++++----- 11 files changed, 32 insertions(+), 7 deletions(-) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index c88ecca8..d8fcf8c0 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -1,4 +1,5 @@ { + "home": "Start", "chat": "Chat", "members": "Mitglieder", "favs": "Gespeichert", diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 44624e16..e9a9a3c7 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -1,4 +1,5 @@ { + "home": "Home", "chat": "Chat", "members": "Members", "favs": "Saved Items", diff --git a/public/locales/es/common.json b/public/locales/es/common.json index b938fc31..af8cddf0 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -1,4 +1,5 @@ { + "home": "Inicio", "chat": "Chat", "members": "Miembros", "favs": "Elementos Guardados", diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index b44e421f..3c00685c 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -1,4 +1,5 @@ { + "home": "Accueil", "chat": "Chat", "members": "Membres", "favs": "Éléments Enregistrés", diff --git a/public/locales/jp/common.json b/public/locales/jp/common.json index 1e7f59cd..d938e4ae 100644 --- a/public/locales/jp/common.json +++ b/public/locales/jp/common.json @@ -1,4 +1,5 @@ { + "home": "ホーム", "chat": "チャット", "members": "メンバー", "favs": "お気に入り", diff --git a/public/locales/pt/common.json b/public/locales/pt/common.json index c0ca3060..177b3b79 100644 --- a/public/locales/pt/common.json +++ b/public/locales/pt/common.json @@ -1,4 +1,5 @@ { + "home": "Início", "chat": "Chat", "members": "Members", "favs": "Saved Items", diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index 730d3e7a..acd0474d 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -1,4 +1,5 @@ { + "home": "Главная", "chat": "Чат", "members": "Участники", "favs": "Сохраненные элементы", diff --git a/public/locales/tr/common.json b/public/locales/tr/common.json index d8dde563..a6616d62 100644 --- a/public/locales/tr/common.json +++ b/public/locales/tr/common.json @@ -1,4 +1,5 @@ { + "home": "Ana Sayfa", "chat": "Sohbet", "members": "Üeyler", "favs": "Kaydedilmiş Öğeler", diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json index 1ed2ef97..6435ff5a 100644 --- a/public/locales/zh/common.json +++ b/public/locales/zh/common.json @@ -1,4 +1,5 @@ { + "home": "首页", "chat": "聊天", "members": "成员", "favs": "收藏", diff --git a/src/routes/chat/index.tsx b/src/routes/chat/index.tsx index 2b09270e..40c81768 100644 --- a/src/routes/chat/index.tsx +++ b/src/routes/chat/index.tsx @@ -91,7 +91,7 @@ function ChatPage() {
@@ -102,7 +102,7 @@ function ChatPage() { className={clsx( `right-container md:rounded-r-2xl w-full bg-white dark:!bg-gray-700`, placeholderVisible && "h-full flex-center", - isMainPath && "hidden md:flex" + isChatHomePath && "hidden md:flex" )} > {voiceFullscreenVisible && } diff --git a/src/routes/home/MobileNavs.tsx b/src/routes/home/MobileNavs.tsx index 5490fe1a..912ae21d 100644 --- a/src/routes/home/MobileNavs.tsx +++ b/src/routes/home/MobileNavs.tsx @@ -9,7 +9,11 @@ import UserIcon from "@/assets/icons/user.svg"; import { useAppSelector } from "../../app/store"; import { shallowEqual } from "react-redux"; -// type Props = {} +const HomeIcon = ({ className }: { className?: string }) => ( + + + +); const MobileNavs = () => { const { t } = useTranslation("common"); @@ -17,7 +21,6 @@ const MobileNavs = () => { const { pathname } = useLocation(); const isChatHomePath = useMatch(`/chat`); const isDMChat = useMatch(`/chat/dm/:user_id`); - // const isSettingPage = useMatch(`/setting`); const isChannelChat = useMatch(`/chat/channel/:channel_id`); const { chat: chatPath, user: userPath } = useAppSelector( (store) => store.ui.rememberedNavs, @@ -25,11 +28,9 @@ const MobileNavs = () => { ); const linkClass = `flex`; - const isChatPage = isHomePath || pathname.startsWith("/chat"); + const isChatPage = pathname.startsWith("/chat"); const isChattingPage = !!isDMChat || !!isChannelChat; - // console.log("rrr", isDMChat, isChannelChat); - // 有点绕 const chatNav = isChatHomePath ? "/chat" : chatPath || "/chat"; const userNav = userPath || "/users"; return ( @@ -39,6 +40,21 @@ const MobileNavs = () => { isChattingPage && "hidden" )} > +
  • + `${linkClass}`} to="/" end> + {({ isActive }) => { + const active = isActive || !!isHomePath; + return ( +
    + + + {t("home")} + +
    + ); + }} +
    +
  • `${linkClass}`} to={chatNav}> {({ isActive }) => {