mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +07:00
added messages to profile dialog
This commit is contained in:
parent
618c2e3275
commit
298ba7d586
12 changed files with 62 additions and 24 deletions
|
@ -22,13 +22,15 @@ const mapDispatchToProps = {
|
|||
push: historyPush,
|
||||
showDialog: MODAL_ACTIONS.modalShowDialog,
|
||||
authLogout: AUTH_ACTIONS.authLogout,
|
||||
authOpenProfile: AUTH_ACTIONS.authOpenProfile,
|
||||
};
|
||||
|
||||
type IProps = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {};
|
||||
|
||||
const HeaderUnconnected: FC<IProps> = memo(
|
||||
({ user, user: { username, is_user, photo }, showDialog, authLogout }) => {
|
||||
({ user, user: { username, is_user }, showDialog, authLogout, authOpenProfile }) => {
|
||||
const onLogin = useCallback(() => showDialog(DIALOGS.LOGIN), [showDialog]);
|
||||
const onProfileClick = useCallback(() => authOpenProfile(username), [authOpenProfile, user]);
|
||||
|
||||
return (
|
||||
<div className={style.container}>
|
||||
|
@ -41,7 +43,9 @@ const HeaderUnconnected: FC<IProps> = memo(
|
|||
<Link to="/">flow</Link>
|
||||
</div>
|
||||
|
||||
{is_user && <UserButton user={user} onLogout={authLogout} />}
|
||||
{is_user && (
|
||||
<UserButton user={user} onLogout={authLogout} onProfileClick={onProfileClick} />
|
||||
)}
|
||||
|
||||
{!is_user && (
|
||||
<Group horizontal className={style.user_button} onClick={onLogin}>
|
||||
|
|
|
@ -10,12 +10,13 @@ import { Link } from 'react-router-dom';
|
|||
interface IProps {
|
||||
user: Partial<IUser>;
|
||||
onLogout: () => void;
|
||||
onProfileClick: () => void;
|
||||
}
|
||||
|
||||
const UserButton: FC<IProps> = ({ user: { username, photo }, onLogout }) => (
|
||||
const UserButton: FC<IProps> = ({ user: { username, photo }, onProfileClick, onLogout }) => (
|
||||
<div className={styles.wrap}>
|
||||
<Group horizontal className={styles.user_button}>
|
||||
<Link to={`/~${username}`}>{username}</Link>
|
||||
<div onClick={onProfileClick}>{username}</div>
|
||||
|
||||
<div
|
||||
className={styles.user_avatar}
|
||||
|
|
|
@ -7,7 +7,7 @@ import { ERRORS } from '~/constants/errors';
|
|||
import { t } from '~/utils/trans';
|
||||
|
||||
interface IProps {
|
||||
is_loading: boolean;
|
||||
is_loading?: boolean;
|
||||
}
|
||||
|
||||
const NodeNoComments: FC<IProps> = ({ is_loading = false }) => (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue