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:
parent
efa3ba902d
commit
f76a5a4798
106 changed files with 122 additions and 144 deletions
|
@ -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 {}
|
||||
|
||||
|
|
|
@ -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 {}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue