add stores directory and naming

This commit is contained in:
plebbitor
2023-04-08 13:27:17 +02:00
parent 2a0d590713
commit 603c1084a9
15 changed files with 28 additions and 28 deletions
+55
View File
@@ -0,0 +1,55 @@
import { create } from 'zustand';
const useGeneralStore = create((set) => ({
bodyStyle: JSON.parse(localStorage.getItem('bodyStyle')) || {
background: '#ffe url(/assets/fade.png) top repeat-x',
color: 'maroon',
fontFamily: 'Helvetica, Arial, sans-serif',
},
setBodyStyle: (bodyStyle) => {
localStorage.setItem('bodyStyle', JSON.stringify(bodyStyle));
set(() => ({ bodyStyle }));
},
captchaResponse: '',
setCaptchaResponse: (response) => set({ captchaResponse: response }),
challengesArray: [],
setChallengesArray: (challengesArray) => set({ challengesArray }),
defaultSubplebbits: [],
setDefaultSubplebbits: (subplebbits) => set({ defaultSubplebbits: subplebbits }),
isSettingsOpen: false,
setIsSettingsOpen: (isOpen) => set({ isSettingsOpen: isOpen }),
pendingComment: '',
setPendingComment: (comment) => set({ pendingComment: comment }),
publishedComment: '',
setPublishedComment: (comment) => set({ publishedComment: comment }),
selectedAddress: '',
setSelectedAddress: (address) => set({ selectedAddress: address }),
selectedStyle: localStorage.getItem('selectedStyle') || 'Yotsuba',
setSelectedStyle: (style) => {
localStorage.setItem('selectedStyle', style);
set({ selectedStyle: style });
},
selectedThread: '',
setSelectedThread: (thread) => set({ selectedThread: thread }),
selectedTitle: '',
setSelectedTitle: (title) => set({ selectedTitle: title }),
showPostForm: false,
setShowPostForm: (show) => set({ showPostForm: show }),
showPostFormLink: true,
setShowPostFormLink: (show) => set({ showPostFormLink: show }),
}));
export default useGeneralStore;