Rename context types

This commit is contained in:
schroda
2024-12-20 21:30:41 +01:00
parent 28d0b470bf
commit 9d37c8bc15
4 changed files with 9 additions and 9 deletions

View File

@@ -10,12 +10,12 @@ import React, { useContext } from 'react';
import { DEFAULT_CATEGORY_METADATA } from '@/modules/category/services/CategoryMetadata.ts'; import { DEFAULT_CATEGORY_METADATA } from '@/modules/category/services/CategoryMetadata.ts';
import { LibraryOptions } from '@/modules/library/Library.types.ts'; import { LibraryOptions } from '@/modules/library/Library.types.ts';
type ContextType = { type LibraryOptionsContextType = {
options: LibraryOptions; options: LibraryOptions;
setOptions: React.Dispatch<React.SetStateAction<LibraryOptions>>; setOptions: React.Dispatch<React.SetStateAction<LibraryOptions>>;
}; };
export const LibraryOptionsContext = React.createContext<ContextType>({ export const LibraryOptionsContext = React.createContext<LibraryOptionsContextType>({
options: DEFAULT_CATEGORY_METADATA, options: DEFAULT_CATEGORY_METADATA,
setOptions: () => {}, setOptions: () => {},
}); });

View File

@@ -10,12 +10,12 @@ import React, { useContext } from 'react';
import { INavbarOverride } from '@/modules/navigation-bar/NavigationBar.types.ts'; import { INavbarOverride } from '@/modules/navigation-bar/NavigationBar.types.ts';
type ContextType = { type NavbarContextType = {
history: string[]; history: string[];
// AppBar title // AppBar title
title: string | React.ReactNode; title: string | React.ReactNode;
setTitle: (title: ContextType['title'], browserTitle?: string) => void; setTitle: (title: NavbarContextType['title'], browserTitle?: string) => void;
appBarHeight: number; appBarHeight: number;
setAppBarHeight: React.Dispatch<React.SetStateAction<number>>; setAppBarHeight: React.Dispatch<React.SetStateAction<number>>;
@@ -42,7 +42,7 @@ type ContextType = {
setBottomBarHeight: React.Dispatch<React.SetStateAction<number>>; setBottomBarHeight: React.Dispatch<React.SetStateAction<number>>;
}; };
export const NavBarContext = React.createContext<ContextType>({ export const NavBarContext = React.createContext<NavbarContextType>({
history: [], history: [],
title: 'Suwayomi', title: 'Suwayomi',
setTitle: (): void => {}, setTitle: (): void => {},

View File

@@ -8,14 +8,14 @@
import { createContext, useContext } from 'react'; import { createContext, useContext } from 'react';
type TReaderContext = { type TReaderProgressBarContext = {
isMaximized: boolean; isMaximized: boolean;
setIsMaximized: (visible: boolean) => void; setIsMaximized: (visible: boolean) => void;
isDragging: boolean; isDragging: boolean;
setIsDragging: (isDragging: boolean) => void; setIsDragging: (isDragging: boolean) => void;
}; };
export const ReaderProgressBarContext = createContext<TReaderContext>({ export const ReaderProgressBarContext = createContext<TReaderProgressBarContext>({
isMaximized: false, isMaximized: false,
setIsMaximized: () => undefined, setIsMaximized: () => undefined,
isDragging: false, isDragging: false,

View File

@@ -15,7 +15,7 @@ export enum ThemeMode {
LIGHT = 'light', LIGHT = 'light',
} }
type ContextType = { type ThemeModeContextType = {
appTheme: AppThemes; appTheme: AppThemes;
setAppTheme: React.Dispatch<React.SetStateAction<AppThemes>>; setAppTheme: React.Dispatch<React.SetStateAction<AppThemes>>;
themeMode: ThemeMode; themeMode: ThemeMode;
@@ -24,7 +24,7 @@ type ContextType = {
setPureBlackMode: React.Dispatch<React.SetStateAction<boolean>>; setPureBlackMode: React.Dispatch<React.SetStateAction<boolean>>;
}; };
export const ThemeModeContext = React.createContext<ContextType>({ export const ThemeModeContext = React.createContext<ThemeModeContextType>({
appTheme: 'default', appTheme: 'default',
setAppTheme: (): void => {}, setAppTheme: (): void => {},
themeMode: ThemeMode.SYSTEM, themeMode: ThemeMode.SYSTEM,