Add dedicated store access util functions

Makes it easier to find the specific store slice usage
This commit is contained in:
schroda
2025-09-21 00:50:19 +02:00
parent ed488f76dd
commit 525173e05e
28 changed files with 247 additions and 161 deletions

View File

@@ -15,18 +15,18 @@ import { useResizeObserver } from '@/base/hooks/useResizeObserver.tsx';
import { ReadingDirection } from '@/features/reader/Reader.types.ts';
import { withPropsFrom } from '@/base/hoc/withPropsFrom.tsx';
import { NavbarContextType } from '@/features/navigation-bar/NavigationBar.types.ts';
import { useReaderStore } from '@/features/reader/stores/ReaderStore.ts';
import { useReaderSettingsStore, useReaderTapZoneStore } from '@/features/reader/stores/ReaderStore.ts';
const CANVAS_ID = 'reader-tap-zone-layout-canvas';
const BaseTapZoneLayout = ({ readerNavBarWidth }: Pick<NavbarContextType, 'readerNavBarWidth'>) => {
const theme = useTheme();
const { tapZoneLayout, tapZoneInvertMode, readingDirection } = useReaderStore((state) => ({
const { tapZoneLayout, tapZoneInvertMode, readingDirection } = useReaderSettingsStore((state) => ({
tapZoneLayout: state.settings.tapZoneLayout.value,
tapZoneInvertMode: state.settings.tapZoneInvertMode.value,
readingDirection: state.settings.readingDirection.value,
}));
const showPreview = useReaderStore((state) => state.tapZone.showPreview);
const showPreview = useReaderTapZoneStore((state) => state.tapZone.showPreview);
const [width, setWidth] = useState(0);
const [height, setHeight] = useState(0);