1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-06-26 19:48:28 +07:00

removed profile redux items

This commit is contained in:
Fedor Katurov 2022-01-08 18:01:38 +07:00
parent 5b28313afd
commit 3c0571816c
55 changed files with 488 additions and 710 deletions

View file

@ -1,39 +1,33 @@
import React, { FC } from 'react';
import { formatText } from '~/utils/dom';
import styles from './styles.module.scss';
import { connect } from 'react-redux';
import { selectAuthProfile } from '~/redux/auth/selectors';
import { ProfileLoader } from '~/containers/profile/ProfileLoader';
import { Group } from '~/components/containers/Group';
import markdown from '~/styles/common/markdown.module.scss';
import classNames from 'classnames';
import { useProfileContext } from '~/utils/providers/ProfileProvider';
const mapStateToProps = state => ({
profile: selectAuthProfile(state),
});
const ProfileDescription: FC = () => {
const { profile, isLoading } = useProfileContext();
type IProps = ReturnType<typeof mapStateToProps> & {};
const ProfileDescriptionUnconnected: FC<IProps> = ({ profile: { user, is_loading } }) => {
if (is_loading) return <ProfileLoader />;
if (isLoading) return <ProfileLoader />;
return (
<div className={styles.wrap}>
{!!user?.description && (
{!!profile?.description && (
<Group
className={classNames(styles.content, markdown.wrapper)}
dangerouslySetInnerHTML={{ __html: formatText(user.description) }}
dangerouslySetInnerHTML={{ __html: formatText(profile.description) }}
/>
)}
{!user?.description && (
{!profile?.description && (
<div className={styles.placeholder}>
{user?.fullname || user?.username} пока ничего не рассказал о себе
{profile?.fullname || profile?.username} пока ничего не рассказал о себе
</div>
)}
</div>
);
};
const ProfileDescription = connect(mapStateToProps)(ProfileDescriptionUnconnected);
export { ProfileDescription };