Move library files into new folder

This commit is contained in:
schroda
2024-10-05 19:33:09 +02:00
parent abc40de47b
commit 91e1f01de5
24 changed files with 95 additions and 76 deletions

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import React, { useMemo } from 'react';
import { useLocalStorage } from '@/modules/core/hooks/useStorage.tsx';
import { LibraryOptionsContext } from '@/modules/library/contexts/LibraryOptionsContext.tsx';
import { getDefaultCategoryMetadata } from '@/lib/metadata/categoryMetadata.ts';
import { LibraryOptions } from '@/modules/library/Library.types.ts';
interface IProps {
children: React.ReactNode;
}
export const LibraryOptionsContextProvider: React.FC<IProps> = ({ children }) => {
const [options, setOptions] = useLocalStorage<LibraryOptions>('libraryOptions', getDefaultCategoryMetadata());
const value = useMemo(
() => ({ options: { ...getDefaultCategoryMetadata(), ...options }, setOptions }),
[options, setOptions],
);
return <LibraryOptionsContext.Provider value={value}>{children}</LibraryOptionsContext.Provider>;
};