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

fixed random phrase outputting

This commit is contained in:
Fedor Katurov 2021-09-22 16:11:42 +07:00
parent b8b2714040
commit d7b86202eb

View file

@ -10,14 +10,18 @@ interface Props {
}
const NodeAuthorBlock: FC<Props> = ({ node }) => {
const randomPhrase = useRandomPhrase('USER_DESCRIPTION');
const onOpenProfile = useCallback(() => openUserProfile(node?.user?.username), [
node?.user?.username,
]);
if (!node?.user) {
return null;
}
const { fullname, username, description, photo } = node.user;
const onOpenProfile = useCallback(() => openUserProfile(username), [username]);
return (
<div className={styles.block} onClick={onOpenProfile}>
<CommentAvatar username={username} url={photo?.url} className={styles.avatar} />
@ -25,11 +29,7 @@ const NodeAuthorBlock: FC<Props> = ({ node }) => {
<div className={styles.info}>
<div className={styles.username}>{fullname || username}</div>
{description && (
<div className={styles.description}>
{description || useRandomPhrase('USER_DESCRIPTION')}
</div>
)}
<div className={styles.description}>{description || randomPhrase}</div>
</div>
</div>
);