Typing
This commit is contained in:
@@ -8,11 +8,11 @@ export function useCommonHooks() {
|
||||
const { mutateAsync } = useMutationAPI();
|
||||
const isMobile = window.matchMedia('(max-width: 600px)').matches;
|
||||
const [theme, setTheme] = useAtom(appTheme);
|
||||
const [themeName, setThemeName] = useLocalStorage<any>({
|
||||
const [themeName, setThemeName] = useLocalStorage<string>({
|
||||
key: 'theme',
|
||||
defaultValue: 'blackboard',
|
||||
});
|
||||
const [appFilter, setAppFilter] = useLocalStorage<[any]>({
|
||||
const [appFilter, setAppFilter] = useLocalStorage<[string]>({
|
||||
key: 'appFilter',
|
||||
defaultValue: ['All'],
|
||||
});
|
||||
@@ -24,16 +24,16 @@ export function useCommonHooks() {
|
||||
key: 'bookmarkSort',
|
||||
defaultValue: 'A-Z',
|
||||
});
|
||||
const [bookmarkFilter, setBookmarkFilter] = useLocalStorage<[any]>({
|
||||
const [bookmarkFilter, setBookmarkFilter] = useLocalStorage<[string]>({
|
||||
key: 'bookmarkFilter',
|
||||
defaultValue: ['All'],
|
||||
});
|
||||
const [currentTheme, setCurrentTheme] = useLocalStorage<any>({
|
||||
const [currentTheme, setCurrentTheme] = useLocalStorage<string>({
|
||||
key: 'theme',
|
||||
defaultValue: 'blackboard',
|
||||
});
|
||||
|
||||
const [currentThemePlaylist, setCurrentThemePlaylist] = useLocalStorage<any>({
|
||||
const [currentThemePlaylist, setCurrentThemePlaylist] = useLocalStorage<string>({
|
||||
key: 'themePlaylist',
|
||||
defaultValue: 'All',
|
||||
});
|
||||
@@ -80,6 +80,13 @@ export function useCommonHooks() {
|
||||
'i',
|
||||
); // fragment locator
|
||||
|
||||
const reorder = (list: any, startIndex: any, endIndex: any) => {
|
||||
const result = Array.from(list);
|
||||
const [removed]: any = result.splice(startIndex, 1);
|
||||
result.splice(endIndex, 0, removed);
|
||||
return result;
|
||||
};
|
||||
|
||||
const handleThemeChange = (themes: any, save: any) => {
|
||||
const enabled = themes
|
||||
.filter((t: any) => t.randomEnabled)
|
||||
@@ -116,6 +123,7 @@ export function useCommonHooks() {
|
||||
modalStyle,
|
||||
urlPattern,
|
||||
fixDigits,
|
||||
reorder,
|
||||
handleThemeChange,
|
||||
handleDelete,
|
||||
themeName,
|
||||
|
||||
Reference in New Issue
Block a user