mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
refactor: add 'stores' folder and move challenges store
This commit is contained in:
@@ -3,8 +3,8 @@ import Draggable from 'react-draggable';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Challenge as ChallengeType } from '@plebbit/plebbit-react-hooks';
|
import { Challenge as ChallengeType } from '@plebbit/plebbit-react-hooks';
|
||||||
import { getPublicationType } from '../../lib/utils/challenge-utils';
|
import { getPublicationType } from '../../lib/utils/challenge-utils';
|
||||||
import useChallenges from '../../hooks/use-challenges';
|
|
||||||
import useIsMobile from '../../hooks/use-is-mobile';
|
import useIsMobile from '../../hooks/use-is-mobile';
|
||||||
|
import useChallengesStore from '../../stores/use-challenges-store';
|
||||||
import styles from './challenge-modal.module.css';
|
import styles from './challenge-modal.module.css';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ChallengeModal = () => {
|
const ChallengeModal = () => {
|
||||||
const { challenges, removeChallenge } = useChallenges();
|
const { challenges, removeChallenge } = useChallengesStore();
|
||||||
const isOpen = !!challenges.length;
|
const isOpen = !!challenges.length;
|
||||||
const closeModal = () => removeChallenge();
|
const closeModal = () => removeChallenge();
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import { alertChallengeVerificationFailed } from '../../lib/utils/challenge-util
|
|||||||
import { getLinkMediaInfo } from '../../lib/utils/media-utils';
|
import { getLinkMediaInfo } from '../../lib/utils/media-utils';
|
||||||
import { isValidURL } from '../../lib/utils/url-utils';
|
import { isValidURL } from '../../lib/utils/url-utils';
|
||||||
import { isAllView, isDescriptionView, isPostPageView, isRulesView, isSubscriptionsView } from '../../lib/utils/view-utils';
|
import { isAllView, isDescriptionView, isPostPageView, isRulesView, isSubscriptionsView } from '../../lib/utils/view-utils';
|
||||||
import challengesStore from '../../hooks/use-challenges';
|
|
||||||
import { useDefaultSubplebbitAddresses } from '../../hooks/use-default-subplebbits';
|
import { useDefaultSubplebbitAddresses } from '../../hooks/use-default-subplebbits';
|
||||||
import useReply from '../../hooks/use-reply';
|
import useReply from '../../hooks/use-reply';
|
||||||
|
import useChallengesStore from '../../stores/use-challenges-store';
|
||||||
import styles from './post-form.module.css';
|
import styles from './post-form.module.css';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ type SubmitState = {
|
|||||||
resetSubmitStore: () => void;
|
resetSubmitStore: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const { addChallenge } = challengesStore.getState();
|
const { addChallenge } = useChallengesStore.getState();
|
||||||
|
|
||||||
const useSubmitStore = create<SubmitState>((set) => ({
|
const useSubmitStore = create<SubmitState>((set) => ({
|
||||||
subplebbitAddress: undefined,
|
subplebbitAddress: undefined,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { ChallengeVerification, Comment, PublishCommentOptions, usePublishComment } from '@plebbit/plebbit-react-hooks';
|
import { ChallengeVerification, Comment, PublishCommentOptions, usePublishComment } from '@plebbit/plebbit-react-hooks';
|
||||||
import { create } from 'zustand';
|
import { create } from 'zustand';
|
||||||
import useChallengesStore from './use-challenges';
|
|
||||||
import { alertChallengeVerificationFailed } from '../lib/utils/challenge-utils';
|
import { alertChallengeVerificationFailed } from '../lib/utils/challenge-utils';
|
||||||
|
import useChallengesStore from '../stores/use-challenges-store';
|
||||||
|
|
||||||
type SetReplyStoreData = {
|
type SetReplyStoreData = {
|
||||||
subplebbitAddress: string;
|
subplebbitAddress: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user