feat: add challenge modal

This commit is contained in:
plebeius.eth
2024-04-26 19:13:23 +02:00
parent 3ce3f090f5
commit cc5d042889
10 changed files with 463 additions and 29 deletions
+24
View File
@@ -0,0 +1,24 @@
import { create } from 'zustand';
import { Challenge } from '@plebbit/plebbit-react-hooks';
interface State {
challenges: Challenge[];
addChallenge: (challenge: Challenge) => void;
removeChallenge: () => void;
}
const useChallengesStore = create<State>((set) => ({
challenges: [],
addChallenge: (challenge: Challenge) => {
set((state) => ({ challenges: [...state.challenges, challenge] }));
},
removeChallenge: () => {
set((state) => {
const challenges = [...state.challenges];
challenges.shift();
return { challenges };
});
},
}));
export default useChallengesStore;