mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-26 13:26:40 +07:00
removed profile redux items
This commit is contained in:
parent
5b28313afd
commit
3c0571816c
55 changed files with 488 additions and 710 deletions
|
@ -1,8 +1,8 @@
|
|||
import React, { FC, MouseEventHandler, useEffect, useRef } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { clearAllBodyScrollLocks, disableBodyScroll } from 'body-scroll-lock';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { LoaderCircle } from '~/components/input/LoaderCircle';
|
||||
import React, { FC, MouseEventHandler, useEffect, useRef } from "react";
|
||||
import styles from "./styles.module.scss";
|
||||
import { clearAllBodyScrollLocks, disableBodyScroll } from "body-scroll-lock";
|
||||
import { Icon } from "~/components/input/Icon";
|
||||
import { LoaderCircle } from "~/components/input/LoaderCircle";
|
||||
|
||||
interface IProps {
|
||||
children: React.ReactChild;
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
import React, { createElement, FC, useCallback, useMemo, useState } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { NODE_EDITORS } from '~/constants/node';
|
||||
import { BetterScrollDialog } from '../BetterScrollDialog';
|
||||
import { CoverBackdrop } from '~/components/containers/CoverBackdrop';
|
||||
import { prop } from 'ramda';
|
||||
import { useNodeFormFormik } from '~/hooks/node/useNodeFormFormik';
|
||||
import { EditorButtons } from '~/components/editors/EditorButtons';
|
||||
import { UploadSubject, UploadTarget } from '~/constants/uploads';
|
||||
import { FormikProvider } from 'formik';
|
||||
import { INode } from '~/redux/types';
|
||||
import { ModalWrapper } from '~/components/dialogs/ModalWrapper';
|
||||
import { useTranslatedError } from '~/hooks/data/useTranslatedError';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
import { EditorConfirmClose } from '~/components/editors/EditorConfirmClose';
|
||||
import { IDialogProps } from '~/types/modal';
|
||||
import { useUploader } from '~/hooks/data/useUploader';
|
||||
import { UploaderContextProvider } from '~/utils/context/UploaderContextProvider';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import React, { createElement, FC, useCallback, useMemo, useState } from "react";
|
||||
import styles from "./styles.module.scss";
|
||||
import { NODE_EDITORS } from "~/constants/node";
|
||||
import { BetterScrollDialog } from "../BetterScrollDialog";
|
||||
import { CoverBackdrop } from "~/components/containers/CoverBackdrop";
|
||||
import { prop } from "ramda";
|
||||
import { useNodeFormFormik } from "~/hooks/node/useNodeFormFormik";
|
||||
import { EditorButtons } from "~/components/editors/EditorButtons";
|
||||
import { UploadSubject, UploadTarget } from "~/constants/uploads";
|
||||
import { FormikProvider } from "formik";
|
||||
import { INode } from "~/redux/types";
|
||||
import { ModalWrapper } from "~/components/dialogs/ModalWrapper";
|
||||
import { useTranslatedError } from "~/hooks/data/useTranslatedError";
|
||||
import { useCloseOnEscape } from "~/hooks";
|
||||
import { EditorConfirmClose } from "~/components/editors/EditorConfirmClose";
|
||||
import { DialogComponentProps } from "~/types/modal";
|
||||
import { useUploader } from "~/hooks/data/useUploader";
|
||||
import { UploaderContextProvider } from "~/utils/context/UploaderContextProvider";
|
||||
import { observer } from "mobx-react-lite";
|
||||
|
||||
interface Props extends IDialogProps {
|
||||
interface Props extends DialogComponentProps {
|
||||
node: INode;
|
||||
onSubmit: (node: INode) => Promise<unknown>;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import { LoginDialogButtons } from '~/containers/dialogs/LoginDialogButtons';
|
|||
import { OAUTH_EVENT_TYPES } from '~/redux/types';
|
||||
import { DialogTitle } from '~/components/dialogs/DialogTitle';
|
||||
import { useTranslatedError } from '~/hooks/data/useTranslatedError';
|
||||
import { IDialogProps } from '~/types/modal';
|
||||
import { DialogComponentProps } from '~/types/modal';
|
||||
import { useShowModal } from '~/hooks/modal/useShowModal';
|
||||
import { Dialog } from '~/constants/modal';
|
||||
|
||||
|
@ -32,7 +32,9 @@ const mapDispatchToProps = {
|
|||
authGotOauthLoginEvent: ACTIONS.authGotOauthLoginEvent,
|
||||
};
|
||||
|
||||
type IProps = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & IDialogProps & {};
|
||||
type IProps = ReturnType<typeof mapStateToProps> &
|
||||
typeof mapDispatchToProps &
|
||||
DialogComponentProps & {};
|
||||
|
||||
const LoginDialogUnconnected: FC<IProps> = ({
|
||||
error,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React, { FC, MouseEventHandler } from 'react';
|
||||
import { Button } from '~/components/input/Button';
|
||||
import { Grid } from '~/components/containers/Grid';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import styles from './styles.module.scss';
|
||||
import { ISocialProvider } from '~/redux/auth/types';
|
||||
import React, { FC, MouseEventHandler } from "react";
|
||||
import { Button } from "~/components/input/Button";
|
||||
import { Grid } from "~/components/containers/Grid";
|
||||
import { Group } from "~/components/containers/Group";
|
||||
import styles from "./styles.module.scss";
|
||||
import { ISocialProvider } from "~/redux/auth/types";
|
||||
|
||||
interface IProps {
|
||||
openOauthWindow: (provider: ISocialProvider) => MouseEventHandler;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { FC } from 'react';
|
||||
import { Button } from '~/components/input/Button';
|
||||
import styles from './styles.module.scss';
|
||||
import React, { FC } from "react";
|
||||
import { Button } from "~/components/input/Button";
|
||||
import styles from "./styles.module.scss";
|
||||
|
||||
interface IProps {}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import * as AUTH_ACTIONS from '~/redux/auth/actions';
|
|||
import { useCloseOnEscape } from '~/hooks';
|
||||
import { LoginSocialRegisterButtons } from '~/containers/dialogs/LoginSocialRegisterButtons';
|
||||
import { Toggle } from '~/components/input/Toggle';
|
||||
import { IDialogProps } from '~/types/modal';
|
||||
import { DialogComponentProps } from '~/types/modal';
|
||||
|
||||
const mapStateToProps = selectAuthRegisterSocial;
|
||||
const mapDispatchToProps = {
|
||||
|
@ -20,7 +20,9 @@ const mapDispatchToProps = {
|
|||
authSendRegisterSocial: AUTH_ACTIONS.authSendRegisterSocial,
|
||||
};
|
||||
|
||||
type Props = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & IDialogProps & {};
|
||||
type Props = ReturnType<typeof mapStateToProps> &
|
||||
typeof mapDispatchToProps &
|
||||
DialogComponentProps & {};
|
||||
|
||||
const phrase = [
|
||||
'Сушёный кабачок особенно хорош в это время года, знаете ли.',
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React, { FC } from 'react';
|
||||
import { ModalWrapper } from '~/components/dialogs/ModalWrapper';
|
||||
import { DIALOG_CONTENT } from '~/constants/modal';
|
||||
import { useModalStore } from '~/store/modal/useModalStore';
|
||||
import { has } from 'ramda';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import React, { FC } from "react";
|
||||
import { ModalWrapper } from "~/components/dialogs/ModalWrapper";
|
||||
import { DIALOG_CONTENT } from "~/constants/modal";
|
||||
import { useModalStore } from "~/store/modal/useModalStore";
|
||||
import { has } from "ramda";
|
||||
import { observer } from "mobx-react-lite";
|
||||
|
||||
type IProps = {};
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ import { useBlockBackButton } from '~/hooks/navigation/useBlockBackButton';
|
|||
import { useModal } from '~/hooks/modal/useModal';
|
||||
import { observer } from 'mobx-react';
|
||||
import { IFile } from '~/redux/types';
|
||||
import { IDialogProps } from '~/types/modal';
|
||||
import { DialogComponentProps } from '~/types/modal';
|
||||
|
||||
export interface PhotoSwipeProps extends IDialogProps {
|
||||
export interface PhotoSwipeProps extends DialogComponentProps {
|
||||
items: IFile[];
|
||||
index: number;
|
||||
}
|
||||
|
|
|
@ -1,73 +1,43 @@
|
|||
import React, { FC, useCallback } from 'react';
|
||||
import React, { FC } from 'react';
|
||||
import { BetterScrollDialog } from '../BetterScrollDialog';
|
||||
import { ProfileInfo } from '~/containers/profile/ProfileInfo';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectAuthProfile, selectAuthUser } from '~/redux/auth/selectors';
|
||||
import * as AUTH_ACTIONS from '~/redux/auth/actions';
|
||||
import { IAuthState } from '~/redux/auth/types';
|
||||
import { pick } from 'ramda';
|
||||
import { CoverBackdrop } from '~/components/containers/CoverBackdrop';
|
||||
import { Tabs } from '~/components/dialogs/Tabs';
|
||||
import { ProfileDescription } from '~/components/profile/ProfileDescription';
|
||||
import { ProfileMessages } from '~/containers/profile/ProfileMessages';
|
||||
import { ProfileSettings } from '~/components/profile/ProfileSettings';
|
||||
import { ProfileAccounts } from '~/components/profile/ProfileAccounts';
|
||||
import { IDialogProps } from '~/types/modal';
|
||||
import { DialogComponentProps } from '~/types/modal';
|
||||
import { useUser } from '~/hooks/user/userUser';
|
||||
import { useGetProfile } from '~/hooks/profile/useGetProfile';
|
||||
import { ProfileProvider } from '~/utils/providers/ProfileProvider';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
profile: selectAuthProfile(state),
|
||||
user: pick(['id'], selectAuthUser(state)),
|
||||
});
|
||||
export interface ProfileDialogProps extends DialogComponentProps {
|
||||
username: string;
|
||||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
authSetProfile: AUTH_ACTIONS.authSetProfile,
|
||||
};
|
||||
|
||||
type IProps = IDialogProps & ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {};
|
||||
|
||||
const PROFILE_HEADERS = {};
|
||||
|
||||
const PROFILE_FOOTERS = {};
|
||||
|
||||
const ProfileDialogUnconnected: FC<IProps> = ({
|
||||
onRequestClose,
|
||||
authSetProfile,
|
||||
|
||||
profile: { is_loading, user, tab },
|
||||
user: { id },
|
||||
}) => {
|
||||
const setTab = useCallback((val: IAuthState['profile']['tab']) => authSetProfile({ tab: val }), [
|
||||
authSetProfile,
|
||||
]);
|
||||
const ProfileDialog: FC<ProfileDialogProps> = ({ username, onRequestClose }) => {
|
||||
const { isLoading, profile } = useGetProfile(username);
|
||||
const { id } = useUser();
|
||||
|
||||
return (
|
||||
<Tabs>
|
||||
<BetterScrollDialog
|
||||
header={
|
||||
<ProfileInfo
|
||||
is_own={user && user.id === id}
|
||||
is_loading={is_loading}
|
||||
user={user}
|
||||
tab={tab}
|
||||
setTab={setTab}
|
||||
content={PROFILE_HEADERS[tab]}
|
||||
/>
|
||||
}
|
||||
footer={PROFILE_FOOTERS[tab]}
|
||||
backdrop={<CoverBackdrop cover={user && user.cover} />}
|
||||
onClose={onRequestClose}
|
||||
>
|
||||
<Tabs.Content>
|
||||
<ProfileDescription />
|
||||
<ProfileMessages />
|
||||
<ProfileSettings />
|
||||
<ProfileAccounts />
|
||||
</Tabs.Content>
|
||||
</BetterScrollDialog>
|
||||
</Tabs>
|
||||
<ProfileProvider username={username}>
|
||||
<Tabs>
|
||||
<BetterScrollDialog
|
||||
header={<ProfileInfo isOwn={profile.id === id} isLoading={isLoading} />}
|
||||
backdrop={<CoverBackdrop cover={profile.cover} />}
|
||||
onClose={onRequestClose}
|
||||
>
|
||||
<Tabs.Content>
|
||||
<ProfileDescription />
|
||||
<ProfileMessages />
|
||||
<ProfileSettings />
|
||||
<ProfileAccounts />
|
||||
</Tabs.Content>
|
||||
</BetterScrollDialog>
|
||||
</Tabs>
|
||||
</ProfileProvider>
|
||||
);
|
||||
};
|
||||
|
||||
const ProfileDialog = connect(mapStateToProps, mapDispatchToProps)(ProfileDialogUnconnected);
|
||||
|
||||
export { ProfileDialog };
|
||||
|
|
|
@ -12,7 +12,7 @@ import { selectAuthRestore } from '~/redux/auth/selectors';
|
|||
import { ERROR_LITERAL, ERRORS } from '~/constants/errors';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
import { IDialogProps } from '~/types/modal';
|
||||
import { DialogComponentProps } from '~/types/modal';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
restore: selectAuthRestore(state),
|
||||
|
@ -20,7 +20,9 @@ const mapStateToProps = state => ({
|
|||
|
||||
const mapDispatchToProps = pick(['authRestorePassword', 'authSetRestore'], AUTH_ACTIONS);
|
||||
|
||||
type IProps = IDialogProps & ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {};
|
||||
type IProps = DialogComponentProps &
|
||||
ReturnType<typeof mapStateToProps> &
|
||||
typeof mapDispatchToProps & {};
|
||||
|
||||
const RestorePasswordDialogUnconnected: FC<IProps> = ({
|
||||
restore: { error, is_loading, is_succesfull, user },
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import React, { useCallback, useEffect, useMemo, useState, VFC } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { BetterScrollDialog } from '../BetterScrollDialog';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import { InputText } from '~/components/input/InputText';
|
||||
import { Button } from '~/components/input/Button';
|
||||
import styles from './styles.module.scss';
|
||||
import React, { useCallback, useEffect, useMemo, useState, VFC } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { BetterScrollDialog } from "../BetterScrollDialog";
|
||||
import { Group } from "~/components/containers/Group";
|
||||
import { InputText } from "~/components/input/InputText";
|
||||
import { Button } from "~/components/input/Button";
|
||||
import styles from "./styles.module.scss";
|
||||
|
||||
import * as AUTH_ACTIONS from '~/redux/auth/actions';
|
||||
import { selectAuthRestore } from '~/redux/auth/selectors';
|
||||
import { ERROR_LITERAL } from '~/constants/errors';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
import { IDialogProps } from '~/types/modal';
|
||||
import { useShallowSelect } from '~/hooks/data/useShallowSelect';
|
||||
import { IAuthState } from '~/redux/auth/types';
|
||||
import * as AUTH_ACTIONS from "~/redux/auth/actions";
|
||||
import { selectAuthRestore } from "~/redux/auth/selectors";
|
||||
import { ERROR_LITERAL } from "~/constants/errors";
|
||||
import { Icon } from "~/components/input/Icon";
|
||||
import { useCloseOnEscape } from "~/hooks";
|
||||
import { DialogComponentProps } from "~/types/modal";
|
||||
import { useShallowSelect } from "~/hooks/data/useShallowSelect";
|
||||
import { IAuthState } from "~/redux/auth/types";
|
||||
|
||||
interface RestoreRequestDialogProps extends IDialogProps {}
|
||||
interface RestoreRequestDialogProps extends DialogComponentProps {}
|
||||
|
||||
const RestoreRequestDialog: VFC<RestoreRequestDialogProps> = ({ onRequestClose }) => {
|
||||
const dispatch = useDispatch();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { FC } from 'react';
|
||||
import { BetterScrollDialog } from '../BetterScrollDialog';
|
||||
import styles from './styles.module.scss';
|
||||
import React, { FC } from "react";
|
||||
import { BetterScrollDialog } from "../BetterScrollDialog";
|
||||
import styles from "./styles.module.scss";
|
||||
|
||||
interface IProps {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue