1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-26 05:16:41 +07:00

refactored hooks directory

This commit is contained in:
Fedor Katurov 2022-01-02 18:17:09 +07:00
parent efa3ba902d
commit f76a5a4798
106 changed files with 122 additions and 144 deletions

View file

@ -4,7 +4,7 @@ import { UPLOAD_TYPES } from '~/redux/uploads/constants';
import { AudioPlayer } from '~/components/media/AudioPlayer';
import styles from './styles.module.scss';
import { INodeComponentProps } from '~/redux/node/constants';
import { useNodeAudios } from '~/utils/hooks/node/useNodeAudios';
import { useNodeAudios } from '~/hooks/node/useNodeAudios';
interface IProps extends INodeComponentProps {}

View file

@ -6,7 +6,7 @@ import { path } from 'ramda';
import { getURL } from '~/utils/dom';
import { PRESETS } from '~/constants/urls';
import { INodeComponentProps } from '~/redux/node/constants';
import { useNodeImages } from '~/utils/hooks/node/useNodeImages';
import { useNodeImages } from '~/hooks/node/useNodeImages';
interface IProps extends INodeComponentProps {}

View file

@ -2,7 +2,7 @@ import React, { FC, useCallback } from 'react';
import styles from './styles.module.scss';
import { Avatar } from '~/components/common/Avatar';
import { openUserProfile } from '~/utils/user';
import { useUserDescription } from '~/utils/hooks/user/useUserDescription';
import { useUserDescription } from '~/hooks/user/useUserDescription';
import { INodeUser } from '~/redux/types';
interface Props {

View file

@ -10,12 +10,11 @@ import styles from './styles.module.scss';
import SwiperCore, { Keyboard, Navigation, Pagination, SwiperOptions } from 'swiper';
import { useNodeImages } from '~/utils/hooks/node/useNodeImages';
import { useNodeImages } from '~/hooks/node/useNodeImages';
import SwiperClass from 'swiper/types/swiper-class';
import { modalShowPhotoswipe } from '~/redux/modal/actions';
import { useDispatch } from 'react-redux';
import { ImagePreloader } from '~/components/media/ImagePreloader';
import { normalizeBrightColor } from '~/utils/color';
import { useImageModal } from '~/hooks/navigation/useImageModal';
SwiperCore.use([Navigation, Pagination, Keyboard]);
@ -28,8 +27,8 @@ const breakpoints: SwiperOptions['breakpoints'] = {
};
const NodeImageSwiperBlock: FC<IProps> = ({ node }) => {
const dispatch = useDispatch();
const [controlledSwiper, setControlledSwiper] = useState<SwiperClass | undefined>(undefined);
const showPhotoSwiper = useImageModal();
const images = useNodeImages(node);
@ -50,9 +49,9 @@ const NodeImageSwiperBlock: FC<IProps> = ({ node }) => {
return;
}
dispatch(modalShowPhotoswipe(images, index));
showPhotoSwiper(images, index);
},
[dispatch, images, controlledSwiper]
[images, controlledSwiper, showPhotoSwiper]
);
if (!images?.length) {

View file

@ -6,7 +6,7 @@ import { PRESETS, URLS } from '~/constants/urls';
import { RouteComponentProps, withRouter } from 'react-router';
import { getURL } from '~/utils/dom';
import { Avatar } from '~/components/common/Avatar';
import { useColorGradientFromString } from '~/utils/hooks/useColorGradientFromString';
import { useColorGradientFromString } from '~/hooks/color/useColorGradientFromString';
type IProps = RouteComponentProps & {
item: Partial<INode>;