mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-06-26 19:48:28 +07:00
displaying user description
This commit is contained in:
parent
371f47f866
commit
7f04fe1e36
7 changed files with 59 additions and 3 deletions
32
src/components/profile/ProfileDescription/index.tsx
Normal file
32
src/components/profile/ProfileDescription/index.tsx
Normal file
|
@ -0,0 +1,32 @@
|
|||
import React, { FC } from 'react';
|
||||
import { IUser } from '~/redux/auth/types';
|
||||
import { formatText } from '~/utils/dom';
|
||||
import styles from './styles.scss';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectAuthProfile } from '~/redux/auth/selectors';
|
||||
import { ProfileLoader } from '~/containers/profile/ProfileLoader';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
profile: selectAuthProfile(state),
|
||||
});
|
||||
|
||||
type IProps = ReturnType<typeof mapStateToProps> & {};
|
||||
|
||||
const ProfileDescriptionUnconnected: FC<IProps> = ({ profile: { user, is_loading } }) => {
|
||||
if (is_loading) return <ProfileLoader />;
|
||||
|
||||
return (
|
||||
<div className={styles.wrap}>
|
||||
{user.description && <div className={styles.content}>{formatText(user.description)}</div>}
|
||||
{!user.description && (
|
||||
<div className={styles.placeholder}>
|
||||
{user.fullname || user.username} пока ничего не рассказал о себе
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const ProfileDescription = connect(mapStateToProps)(ProfileDescriptionUnconnected);
|
||||
|
||||
export { ProfileDescription };
|
Loading…
Add table
Add a link
Reference in a new issue