fix: channel icon and chat icon active

This commit is contained in:
zerosoul
2022-06-13 21:12:07 +08:00
parent 87994f0a9c
commit ec0f4240b0
2 changed files with 11 additions and 3 deletions
+5 -2
View File
@@ -18,8 +18,11 @@ const channelsSlice = createSlice({
state.ids = chs.map(({ gid }) => +gid);
state.byId = Object.fromEntries(
chs.map((c) => {
const { gid } = c;
c.icon = `${BASE_URL}/resource/group_avatar?gid=${gid}`;
const { gid, avatar_updated_at } = c;
c.icon =
avatar_updated_at == 0
? ""
: `${BASE_URL}/resource/group_avatar?gid=${gid}&t=${avatar_updated_at}`;
return [gid, c];
})
);
+6 -1
View File
@@ -61,7 +61,12 @@ export default function HomePage() {
<div className={`col left`}>
<User uid={loginUid} />
<nav className="link_navs">
<NavLink className={`link ${isHomePath ? "active" : ""}`} to={chatNav}>
<NavLink
className={({ isActive }) => {
return `link ${isHomePath || isActive ? "active" : ""}`;
}}
to={chatNav}
>
<Tooltip tip="Chat">
<ChatIcon />
</Tooltip>