mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
that's how 4chan does it, it makes sense since the theme is distracting especially on desktop
35 lines
774 B
TypeScript
35 lines
774 B
TypeScript
import { create } from 'zustand';
|
|
import { persist } from 'zustand/middleware';
|
|
import { isChristmas } from '../lib/utils/time-utils';
|
|
|
|
interface SpecialThemeStore {
|
|
isEnabled: boolean | null;
|
|
setIsEnabled: (value: boolean) => void;
|
|
}
|
|
|
|
const useSpecialThemeStore = create(
|
|
persist<SpecialThemeStore>(
|
|
(set) => ({
|
|
isEnabled: null,
|
|
setIsEnabled: (value: boolean) => {
|
|
if (value && !isChristmas()) {
|
|
return;
|
|
}
|
|
set({ isEnabled: value });
|
|
},
|
|
}),
|
|
{
|
|
name: 'Special-theme-storage',
|
|
onRehydrateStorage: () => {
|
|
return (state) => {
|
|
if (state && !isChristmas()) {
|
|
state.isEnabled = null;
|
|
}
|
|
};
|
|
},
|
|
},
|
|
),
|
|
);
|
|
|
|
export default useSpecialThemeStore;
|