fix: feedback by Dingyi

This commit is contained in:
zerosoul
2022-05-24 10:46:50 +08:00
parent 741608c7be
commit ff14ed1e10
7 changed files with 26 additions and 18 deletions
+9 -3
View File
@@ -1,6 +1,6 @@
// import React from 'react';
// import { useEffect } from "react";
import { Outlet, NavLink, useLocation } from "react-router-dom";
import { Outlet, NavLink, useLocation, useMatch } from "react-router-dom";
import { useSelector } from "react-redux";
import StyledWrapper from "./styled";
import User from "./User";
@@ -20,6 +20,8 @@ import FolderIcon from "../../assets/icons/folder.svg";
// const routes = ["/setting", "/setting/channel/:cid"];
export default function HomePage() {
usePWABadge();
const isHomePath = useMatch(`/`);
const isChatHomePath = useMatch(`/chat`);
const { pathname } = useLocation();
const {
loginUid,
@@ -47,7 +49,8 @@ export default function HomePage() {
</>
);
}
const chatNav = chatPath || "/chat";
// 有点绕
const chatNav = isChatHomePath ? "/chat" : chatPath || "/chat";
const contactNav = contactPath || "/contacts";
return (
@@ -58,7 +61,10 @@ export default function HomePage() {
<div className={`col left`}>
<User uid={loginUid} />
<nav className="link_navs">
<NavLink className="link" to={chatNav}>
<NavLink
className={`link ${isHomePath ? "active" : ""}`}
to={chatNav}
>
<Tooltip tip="Chat">
<ChatIcon />
</Tooltip>
+1
View File
@@ -19,6 +19,7 @@ import IconQuestion from "../../../assets/icons/question.svg";
export default function Tooltip({ link = "#" }) {
return (
<Tippy
delay={[0, 500]}
interactive
arrow={roundArrow}
placement="bottom"