feat: add Home tab to mobile bottom nav with iframe landing page
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"home": "Start",
|
||||||
"chat": "Chat",
|
"chat": "Chat",
|
||||||
"members": "Mitglieder",
|
"members": "Mitglieder",
|
||||||
"favs": "Gespeichert",
|
"favs": "Gespeichert",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"home": "Home",
|
||||||
"chat": "Chat",
|
"chat": "Chat",
|
||||||
"members": "Members",
|
"members": "Members",
|
||||||
"favs": "Saved Items",
|
"favs": "Saved Items",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"home": "Inicio",
|
||||||
"chat": "Chat",
|
"chat": "Chat",
|
||||||
"members": "Miembros",
|
"members": "Miembros",
|
||||||
"favs": "Elementos Guardados",
|
"favs": "Elementos Guardados",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"home": "Accueil",
|
||||||
"chat": "Chat",
|
"chat": "Chat",
|
||||||
"members": "Membres",
|
"members": "Membres",
|
||||||
"favs": "Éléments Enregistrés",
|
"favs": "Éléments Enregistrés",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"home": "ホーム",
|
||||||
"chat": "チャット",
|
"chat": "チャット",
|
||||||
"members": "メンバー",
|
"members": "メンバー",
|
||||||
"favs": "お気に入り",
|
"favs": "お気に入り",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"home": "Início",
|
||||||
"chat": "Chat",
|
"chat": "Chat",
|
||||||
"members": "Members",
|
"members": "Members",
|
||||||
"favs": "Saved Items",
|
"favs": "Saved Items",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"home": "Главная",
|
||||||
"chat": "Чат",
|
"chat": "Чат",
|
||||||
"members": "Участники",
|
"members": "Участники",
|
||||||
"favs": "Сохраненные элементы",
|
"favs": "Сохраненные элементы",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"home": "Ana Sayfa",
|
||||||
"chat": "Sohbet",
|
"chat": "Sohbet",
|
||||||
"members": "Üeyler",
|
"members": "Üeyler",
|
||||||
"favs": "Kaydedilmiş Öğeler",
|
"favs": "Kaydedilmiş Öğeler",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"home": "首页",
|
||||||
"chat": "聊天",
|
"chat": "聊天",
|
||||||
"members": "成员",
|
"members": "成员",
|
||||||
"favs": "收藏",
|
"favs": "收藏",
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ function ChatPage() {
|
|||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
`left-container flex-col md:rounded-l-2xl w-full ${mobileHeight} md:h-full md:max-w-[250px] md:min-w-[268px] shadow-[rgb(0_0_0_/_10%)_-1px_0px_0px_inset] bg-white dark:!bg-gray-800`,
|
`left-container flex-col md:rounded-l-2xl w-full ${mobileHeight} md:h-full md:max-w-[250px] md:min-w-[268px] shadow-[rgb(0_0_0_/_10%)_-1px_0px_0px_inset] bg-white dark:!bg-gray-800`,
|
||||||
isMainPath ? "flex" : "hidden md:flex"
|
isChatHomePath ? "flex" : "hidden md:flex"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Server readonly={isGuest} />
|
<Server readonly={isGuest} />
|
||||||
@@ -102,7 +102,7 @@ function ChatPage() {
|
|||||||
className={clsx(
|
className={clsx(
|
||||||
`right-container md:rounded-r-2xl w-full bg-white dark:!bg-gray-700`,
|
`right-container md:rounded-r-2xl w-full bg-white dark:!bg-gray-700`,
|
||||||
placeholderVisible && "h-full flex-center",
|
placeholderVisible && "h-full flex-center",
|
||||||
isMainPath && "hidden md:flex"
|
isChatHomePath && "hidden md:flex"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{voiceFullscreenVisible && <VoiceFullscreen id={contextId} context={context} />}
|
{voiceFullscreenVisible && <VoiceFullscreen id={contextId} context={context} />}
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ import UserIcon from "@/assets/icons/user.svg";
|
|||||||
import { useAppSelector } from "../../app/store";
|
import { useAppSelector } from "../../app/store";
|
||||||
import { shallowEqual } from "react-redux";
|
import { shallowEqual } from "react-redux";
|
||||||
|
|
||||||
// type Props = {}
|
const HomeIcon = ({ className }: { className?: string }) => (
|
||||||
|
<svg className={className} viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
||||||
|
<path d="M10.55 2.533a2.25 2.25 0 0 1 2.9 0l6.75 5.695c.508.428.8 1.057.8 1.72v9.802a1.75 1.75 0 0 1-1.75 1.75h-3.5a1.75 1.75 0 0 1-1.75-1.75v-5a.25.25 0 0 0-.25-.25h-3.5a.25.25 0 0 0-.25.25v5a1.75 1.75 0 0 1-1.75 1.75h-3.5A1.75 1.75 0 0 1 3 19.75V9.948c0-.663.292-1.292.8-1.72l6.75-5.695Z" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
const MobileNavs = () => {
|
const MobileNavs = () => {
|
||||||
const { t } = useTranslation("common");
|
const { t } = useTranslation("common");
|
||||||
@@ -17,7 +21,6 @@ const MobileNavs = () => {
|
|||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
const isChatHomePath = useMatch(`/chat`);
|
const isChatHomePath = useMatch(`/chat`);
|
||||||
const isDMChat = useMatch(`/chat/dm/:user_id`);
|
const isDMChat = useMatch(`/chat/dm/:user_id`);
|
||||||
// const isSettingPage = useMatch(`/setting`);
|
|
||||||
const isChannelChat = useMatch(`/chat/channel/:channel_id`);
|
const isChannelChat = useMatch(`/chat/channel/:channel_id`);
|
||||||
const { chat: chatPath, user: userPath } = useAppSelector(
|
const { chat: chatPath, user: userPath } = useAppSelector(
|
||||||
(store) => store.ui.rememberedNavs,
|
(store) => store.ui.rememberedNavs,
|
||||||
@@ -25,11 +28,9 @@ const MobileNavs = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const linkClass = `flex`;
|
const linkClass = `flex`;
|
||||||
const isChatPage = isHomePath || pathname.startsWith("/chat");
|
const isChatPage = pathname.startsWith("/chat");
|
||||||
const isChattingPage = !!isDMChat || !!isChannelChat;
|
const isChattingPage = !!isDMChat || !!isChannelChat;
|
||||||
// console.log("rrr", isDMChat, isChannelChat);
|
|
||||||
|
|
||||||
// 有点绕
|
|
||||||
const chatNav = isChatHomePath ? "/chat" : chatPath || "/chat";
|
const chatNav = isChatHomePath ? "/chat" : chatPath || "/chat";
|
||||||
const userNav = userPath || "/users";
|
const userNav = userPath || "/users";
|
||||||
return (
|
return (
|
||||||
@@ -39,6 +40,21 @@ const MobileNavs = () => {
|
|||||||
isChattingPage && "hidden"
|
isChattingPage && "hidden"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
<li>
|
||||||
|
<NavLink className={() => `${linkClass}`} to="/" end>
|
||||||
|
{({ isActive }) => {
|
||||||
|
const active = isActive || !!isHomePath;
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col gap-1 items-center">
|
||||||
|
<HomeIcon className={!active ? "fill-gray-500 text-gray-500" : "fill-primary-500 text-primary-500"} />
|
||||||
|
<span className={clsx("text-xs", !active ? "text-gray-500" : "text-primary-500")}>
|
||||||
|
{t("home")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</NavLink>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<NavLink className={() => `${linkClass}`} to={chatNav}>
|
<NavLink className={() => `${linkClass}`} to={chatNav}>
|
||||||
{({ isActive }) => {
|
{({ isActive }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user