mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
refactored hooks directory
This commit is contained in:
parent
efa3ba902d
commit
f76a5a4798
106 changed files with 122 additions and 144 deletions
|
@ -7,8 +7,8 @@ import { Modal } from '~/containers/dialogs/Modal';
|
|||
import { PageCover } from '~/components/containers/PageCover';
|
||||
import { BottomContainer } from '~/containers/main/BottomContainer';
|
||||
import { MainRouter } from '~/containers/main/MainRouter';
|
||||
import { DragDetectorProvider } from '~/utils/hooks/useDragDetector';
|
||||
import { useUser } from '~/utils/hooks/user/userUser';
|
||||
import { DragDetectorProvider } from '~/hooks/dom/useDragDetector';
|
||||
import { useUser } from '~/hooks/user/userUser';
|
||||
import { UserContextProvider } from '~/utils/context/UserContextProvider';
|
||||
import { SWRConfigProvider } from '~/utils/providers/SWRConfigProvider';
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ 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 { useCloseOnEscape } from '~/utils/hooks';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
|
||||
interface IProps {
|
||||
children: React.ReactChild;
|
||||
|
|
|
@ -5,8 +5,8 @@ import { useHistory, useRouteMatch } from 'react-router';
|
|||
import { values } from 'ramda';
|
||||
import { INode } from '~/redux/types';
|
||||
import { apiPostNode } from '~/redux/node/api';
|
||||
import { useUpdateNode } from '~/utils/hooks/data/useUpdateNode';
|
||||
import { useCreateNode } from '~/utils/hooks/data/useCreateNode';
|
||||
import { useUpdateNode } from '~/hooks/node/useUpdateNode';
|
||||
import { useCreateNode } from '~/hooks/node/useCreateNode';
|
||||
|
||||
const EditorCreateDialog: FC = () => {
|
||||
const history = useHistory();
|
||||
|
|
|
@ -5,15 +5,15 @@ import { NODE_EDITORS } from '~/redux/node/constants';
|
|||
import { BetterScrollDialog } from '../BetterScrollDialog';
|
||||
import { CoverBackdrop } from '~/components/containers/CoverBackdrop';
|
||||
import { prop } from 'ramda';
|
||||
import { useNodeFormFormik } from '~/utils/hooks/node/useNodeFormFormik';
|
||||
import { useNodeFormFormik } from '~/hooks/node/useNodeFormFormik';
|
||||
import { EditorButtons } from '~/components/editors/EditorButtons';
|
||||
import { FileUploaderProvider, useFileUploader } from '~/utils/hooks/useFileUploader';
|
||||
import { FileUploaderProvider, useFileUploader } from '~/hooks/data/useFileUploader';
|
||||
import { UPLOAD_SUBJECTS, UPLOAD_TARGETS } from '~/redux/uploads/constants';
|
||||
import { FormikProvider } from 'formik';
|
||||
import { INode } from '~/redux/types';
|
||||
import { ModalWrapper } from '~/components/dialogs/ModalWrapper';
|
||||
import { useTranslatedError } from '~/utils/hooks/useTranslatedError';
|
||||
import { useCloseOnEscape } from '~/utils/hooks';
|
||||
import { useTranslatedError } from '~/hooks/data/useTranslatedError';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
import { EditorConfirmClose } from '~/components/editors/EditorConfirmClose';
|
||||
import { on } from 'cluster';
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import { useHistory, useRouteMatch } from 'react-router';
|
|||
import { ModalWrapper } from '~/components/dialogs/ModalWrapper';
|
||||
import { LoaderCircle } from '~/components/input/LoaderCircle';
|
||||
import styles from './styles.module.scss';
|
||||
import { useGetNode } from '~/utils/hooks/data/useGetNode';
|
||||
import { useUpdateNode } from '~/utils/hooks/data/useUpdateNode';
|
||||
import { useGetNode } from '~/hooks/node/useGetNode';
|
||||
import { useUpdateNode } from '~/hooks/node/useUpdateNode';
|
||||
import { INode } from '~/redux/types';
|
||||
|
||||
const EditorEditDialog: FC = () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { FC, FormEvent, useCallback, useEffect, useState } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { DIALOGS, IDialogProps } from '~/redux/modal/constants';
|
||||
import { useCloseOnEscape } from '~/utils/hooks';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import { InputText } from '~/components/input/InputText';
|
||||
import { Button } from '~/components/input/Button';
|
||||
|
@ -18,7 +18,7 @@ import { pick } from 'ramda';
|
|||
import { LoginDialogButtons } from '~/containers/dialogs/LoginDialogButtons';
|
||||
import { OAUTH_EVENT_TYPES } from '~/redux/types';
|
||||
import { DialogTitle } from '~/components/dialogs/DialogTitle';
|
||||
import { useTranslatedError } from '~/utils/hooks/useTranslatedError';
|
||||
import { useTranslatedError } from '~/hooks/data/useTranslatedError';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
...pick(['error', 'is_registering'], selectAuthLogin(state)),
|
||||
|
@ -80,7 +80,7 @@ const LoginDialogUnconnected: FC<IProps> = ({
|
|||
[authGotOauthLoginEvent]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
useEffect(() => {
|
||||
if (error) userSetLoginError('');
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [username, password]);
|
||||
|
|
|
@ -9,7 +9,7 @@ import { InputText } from '~/components/input/InputText';
|
|||
import styles from './styles.module.scss';
|
||||
import { selectAuthRegisterSocial } from '~/redux/auth/selectors';
|
||||
import * as AUTH_ACTIONS from '~/redux/auth/actions';
|
||||
import { useCloseOnEscape } from '~/utils/hooks';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
import { LoginSocialRegisterButtons } from '~/containers/dialogs/LoginSocialRegisterButtons';
|
||||
import { Toggle } from '~/components/input/Toggle';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { FC, useCallback } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { DIALOG_CONTENT } from '~/constants/dialogs';
|
||||
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
|
||||
import { useShallowSelect } from '~/hooks/data/useShallowSelect';
|
||||
import { selectModal } from '~/redux/modal/selectors';
|
||||
import { modalSetDialog, modalSetShown, modalShowDialog } from '~/redux/modal/actions';
|
||||
import { ModalWrapper } from '~/components/dialogs/ModalWrapper';
|
||||
|
|
|
@ -12,7 +12,7 @@ import { PRESETS } from '~/constants/urls';
|
|||
import * as MODAL_ACTIONS from '~/redux/modal/actions';
|
||||
import styles from './styles.module.scss';
|
||||
import classNames from 'classnames';
|
||||
import { useBlockBackButton } from '~/utils/hooks/useBlockBackButton';
|
||||
import { useBlockBackButton } from '~/hooks/navigation/useBlockBackButton';
|
||||
|
||||
const mapStateToProps = (state: IState) => ({
|
||||
photoswipe: selectModal(state).photoswipe,
|
||||
|
|
|
@ -12,7 +12,7 @@ import { pick } from 'ramda';
|
|||
import { selectAuthRestore } from '~/redux/auth/selectors';
|
||||
import { ERROR_LITERAL, ERRORS } from '~/constants/errors';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { useCloseOnEscape } from '~/utils/hooks';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
restore: selectAuthRestore(state),
|
||||
|
|
|
@ -12,7 +12,7 @@ import { pick } from 'ramda';
|
|||
import { selectAuthRestore } from '~/redux/auth/selectors';
|
||||
import { ERROR_LITERAL } from '~/constants/errors';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { useCloseOnEscape } from '~/utils/hooks';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
restore: selectAuthRestore(state),
|
||||
|
|
|
@ -4,7 +4,7 @@ import styles from './styles.module.scss';
|
|||
import { LabNode } from '~/components/lab/LabNode';
|
||||
import { EMPTY_NODE, NODE_TYPES } from '~/redux/node/constants';
|
||||
import { values } from 'ramda';
|
||||
import { useLabPagination } from '~/utils/hooks/lab/useLabPagination';
|
||||
import { useLabPagination } from '~/hooks/lab/useLabPagination';
|
||||
import { useLabContext } from '~/utils/context/LabContextProvider';
|
||||
|
||||
interface IProps {}
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { FC } from 'react';
|
|||
import { URLS } from '~/constants/urls';
|
||||
import { ErrorNotFound } from '~/containers/pages/ErrorNotFound';
|
||||
import { Redirect, Route, Switch, useLocation } from 'react-router';
|
||||
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
|
||||
import { useShallowSelect } from '~/hooks/data/useShallowSelect';
|
||||
import { selectAuthUser } from '~/redux/auth/selectors';
|
||||
import { ProfileLayout } from '~/layouts/ProfileLayout';
|
||||
import FlowPage from '~/pages';
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Group } from '~/components/containers/Group';
|
|||
import { Padder } from '~/components/containers/Padder';
|
||||
import { NodeCommentForm } from '~/components/node/NodeCommentForm';
|
||||
import { NodeRelatedBlock } from '~/components/node/NodeRelatedBlock';
|
||||
import { useNodeBlocks } from '~/utils/hooks/node/useNodeBlocks';
|
||||
import { useNodeBlocks } from '~/hooks/node/useNodeBlocks';
|
||||
import { NodeTagsBlock } from '~/components/node/NodeTagsBlock';
|
||||
import StickyBox from 'react-sticky-box/dist/esnext';
|
||||
import styles from './styles.module.scss';
|
||||
|
|
|
@ -5,7 +5,7 @@ import { ICommentGroup } from '~/redux/types';
|
|||
import { canEditComment } from '~/utils/node';
|
||||
import { COMMENTS_DISPLAY } from '~/redux/node/constants';
|
||||
import { plural } from '~/utils/dom';
|
||||
import { useGrouppedComments } from '~/utils/hooks/node/useGrouppedComments';
|
||||
import { useGrouppedComments } from '~/hooks/node/useGrouppedComments';
|
||||
import { useCommentContext } from '~/utils/context/CommentContextProvider';
|
||||
import { Comment } from '~/components/comment/Comment';
|
||||
import { useUserContext } from '~/utils/context/UserContextProvider';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { VFC } from 'react';
|
||||
import { PlayerBar } from '~/components/bars/PlayerBar';
|
||||
import { usePlayer } from '~/utils/hooks/player/usePlayer';
|
||||
import { usePlayer } from '~/hooks/player/usePlayer';
|
||||
|
||||
interface PlayerViewProps {}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import { Filler } from '~/components/containers/Filler';
|
|||
import { Route, Switch, useHistory, useRouteMatch } from 'react-router';
|
||||
import * as USER_ACTIONS from '~/redux/auth/actions';
|
||||
import { ProfileSidebarMenu } from '~/components/profile/ProfileSidebarMenu';
|
||||
import { useCloseOnEscape } from '~/utils/hooks';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { ProfileSidebarSettings } from '~/components/profile/ProfileSidebarSettings';
|
||||
import classNames from 'classnames';
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { FC, useEffect, useRef } from 'react';
|
|||
import styles from './styles.module.scss';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { clearAllBodyScrollLocks, disableBodyScroll } from 'body-scroll-lock';
|
||||
import { useCloseOnEscape } from '~/utils/hooks';
|
||||
import { useCloseOnEscape } from '~/hooks';
|
||||
|
||||
interface IProps {
|
||||
onClose?: () => void;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue