1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

added user description for deactivated units

This commit is contained in:
Fedor Katurov 2021-10-05 15:32:02 +07:00
parent f19fed1c5a
commit 07852df0dc
3 changed files with 27 additions and 6 deletions

View file

@ -3,24 +3,24 @@ import { INode } from '~/redux/types';
import styles from './styles.module.scss';
import { Avatar } from '~/components/common/Avatar';
import { openUserProfile } from '~/utils/user';
import { useRandomPhrase } from '~/constants/phrases';
import { useUserDescription } from '~/utils/hooks/user/useUserDescription';
interface Props {
node?: INode;
}
const NodeAuthorBlock: FC<Props> = ({ node }) => {
const randomPhrase = useRandomPhrase('USER_DESCRIPTION');
const onOpenProfile = useCallback(() => openUserProfile(node?.user?.username), [
node?.user?.username,
]);
const description = useUserDescription(node?.user);
if (!node?.user) {
return null;
}
const { fullname, username, description, photo } = node.user;
const { fullname, username, photo } = node.user;
return (
<div className={styles.block} onClick={onOpenProfile}>
@ -28,8 +28,7 @@ const NodeAuthorBlock: FC<Props> = ({ node }) => {
<div className={styles.info}>
<div className={styles.username}>{fullname || username}</div>
<div className={styles.description}>{description || randomPhrase}</div>
<div className={styles.description}>{description}</div>
</div>
</div>
);