refactor: add 'stores' folder and move challenges store

This commit is contained in:
Tom (plebeius.eth)
2024-05-31 10:28:57 +02:00
parent 531be45dd7
commit cd6e56a704
4 changed files with 5 additions and 5 deletions
@@ -3,8 +3,8 @@ import Draggable from 'react-draggable';
import { useTranslation } from 'react-i18next';
import { Challenge as ChallengeType } from '@plebbit/plebbit-react-hooks';
import { getPublicationType } from '../../lib/utils/challenge-utils';
import useChallenges from '../../hooks/use-challenges';
import useIsMobile from '../../hooks/use-is-mobile';
import useChallengesStore from '../../stores/use-challenges-store';
import styles from './challenge-modal.module.css';
import _ from 'lodash';
@@ -125,7 +125,7 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => {
};
const ChallengeModal = () => {
const { challenges, removeChallenge } = useChallenges();
const { challenges, removeChallenge } = useChallengesStore();
const isOpen = !!challenges.length;
const closeModal = () => removeChallenge();
+2 -2
View File
@@ -7,9 +7,9 @@ import { alertChallengeVerificationFailed } from '../../lib/utils/challenge-util
import { getLinkMediaInfo } from '../../lib/utils/media-utils';
import { isValidURL } from '../../lib/utils/url-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 useReply from '../../hooks/use-reply';
import useChallengesStore from '../../stores/use-challenges-store';
import styles from './post-form.module.css';
import _ from 'lodash';
@@ -23,7 +23,7 @@ type SubmitState = {
resetSubmitStore: () => void;
};
const { addChallenge } = challengesStore.getState();
const { addChallenge } = useChallengesStore.getState();
const useSubmitStore = create<SubmitState>((set) => ({
subplebbitAddress: undefined,
+1 -1
View File
@@ -1,8 +1,8 @@
import { useMemo } from 'react';
import { ChallengeVerification, Comment, PublishCommentOptions, usePublishComment } from '@plebbit/plebbit-react-hooks';
import { create } from 'zustand';
import useChallengesStore from './use-challenges';
import { alertChallengeVerificationFailed } from '../lib/utils/challenge-utils';
import useChallengesStore from '../stores/use-challenges-store';
type SetReplyStoreData = {
subplebbitAddress: string;