mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat: add challenge modal
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user