feat: add route links to user and server
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import styled from "styled-components";
|
||||
import Avatar from "../../common/component/Avatar";
|
||||
import { useSelector } from "react-redux";
|
||||
import { NavLink, useLocation } from "react-router-dom";
|
||||
const StyledWrapper = styled.div`
|
||||
padding: 10px 12px;
|
||||
.avatar {
|
||||
@@ -14,14 +15,17 @@ const StyledWrapper = styled.div`
|
||||
}
|
||||
}
|
||||
`;
|
||||
export default function ServerDropList({ uid = null }) {
|
||||
export default function User({ uid = null }) {
|
||||
const { pathname } = useLocation();
|
||||
const user = useSelector((store) => store.contacts.byId[uid]);
|
||||
if (!user) return null;
|
||||
return (
|
||||
<StyledWrapper>
|
||||
<div className="avatar">
|
||||
<Avatar url={user.avatar} name={user.name} />
|
||||
</div>
|
||||
<NavLink to={`/setting?nav=my_account&f=${pathname}`}>
|
||||
<div className="avatar">
|
||||
<Avatar url={user.avatar} name={user.name} />
|
||||
</div>
|
||||
</NavLink>
|
||||
</StyledWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user