refactor: use blurhash to render background

This commit is contained in:
Prayag Prajapati committed 2025-07-04 15:19:38 +05:30
1 parent 53311a1728
commit c9d16f4669
12 files changed
+205 -164

No files matched your search

+9 -20
View File
@@ -1,24 +1,13 @@
import { shallow } from "zustand/shallow";
import { createWithEqualityFn } from "zustand/traditional";
import { create } from "zustand";
type BackdropStore = {
backdropUrl: string;
backdropId: string;
setBackdrop: (url: string | undefined, id: string | undefined) => void;
backdropHash: string;
// backdropId: string;
setBackdrop: (hash: string | undefined) => void;
};
export const useBackdropStore = createWithEqualityFn<BackdropStore>(
(set) => ({
backdropUrl: "",
backdropId: "",
setBackdrop: (url, id) => set(() => ({ backdropUrl: url, backdropId: id })),
}),
shallow,
);
/**
* @deprecated Please use setBackdrop method from the store
*/
export const setBackdrop = () => {
// useBackdropStore.setState(() => ({ backdropUrl: url, backdropId: id }));
};
export const useBackdropStore = create<BackdropStore>((set) => ({
backdropHash: "",
// backdropI: "",
setBackdrop: (hash) => set(() => ({ backdropHash: hash })),
}));