-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
724 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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 Box from '@mui/material/Box'; | ||
import { useState } from 'react'; | ||
import { BaseReaderOverlayProps, MobileHeaderProps } from '@/modules/reader/types/ReaderOverlay.types.ts'; | ||
import { ReaderSettings } from '@/modules/reader/components/settings/ReaderSettings.tsx'; | ||
import { ReaderPageNumber } from '@/modules/reader/components/ReaderPageNumber.tsx'; | ||
import { StandardReaderProgressBar } from '@/modules/reader/components/overlay/progress-bar/variants/StandardReaderProgressBar.tsx'; | ||
import { ReaderNavBarDesktop } from '@/modules/reader/components/overlay/navigation/desktop/ReaderNavBarDesktop.tsx'; | ||
import { ReaderOverlayHeaderMobile } from '@/modules/reader/components/overlay/ReaderOverlayHeaderMobile.tsx'; | ||
import { ReaderBottomBarMobile } from '@/modules/reader/components/overlay/navigation/mobile/ReaderBottomBarMobile.tsx'; | ||
import { ReaderService } from '@/modules/reader/services/ReaderService.ts'; | ||
|
||
export const ReaderOverlay = ({ | ||
isVisible, | ||
setIsVisible, | ||
manga, | ||
chapter, | ||
}: BaseReaderOverlayProps & MobileHeaderProps) => { | ||
const { isDesktop, isMobile } = ReaderService.useOverlayMode(); | ||
|
||
const [areSettingsOpen, setAreSettingsOpen] = useState(false); | ||
|
||
return ( | ||
<Box sx={{ position: 'absolute', width: '100%', height: '100%', pointerEvents: 'none' }}> | ||
{isDesktop && ( | ||
<> | ||
<StandardReaderProgressBar /> | ||
<ReaderNavBarDesktop | ||
isVisible={isVisible} | ||
setIsVisible={setIsVisible} | ||
openSettings={() => setAreSettingsOpen(true)} | ||
/> | ||
</> | ||
)} | ||
|
||
{isMobile && ( | ||
<> | ||
<ReaderOverlayHeaderMobile manga={manga} chapter={chapter} isVisible={isVisible} /> | ||
<ReaderBottomBarMobile openSettings={() => setAreSettingsOpen(true)} isVisible={isVisible} /> | ||
</> | ||
)} | ||
|
||
<ReaderSettings isOpen={areSettingsOpen} close={() => setAreSettingsOpen(false)} /> | ||
|
||
<ReaderPageNumber /> | ||
</Box> | ||
); | ||
}; |
15 changes: 15 additions & 0 deletions
15
src/modules/reader/components/viewer/ReaderChapterViewer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* 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 Box from '@mui/material/Box'; | ||
|
||
export const ReaderChapterViewer = () => { | ||
const a = null; | ||
|
||
return <Box />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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 { useMemo } from 'react'; | ||
import { ReaderService } from '@/modules/reader/services/ReaderService.ts'; | ||
import { ReadingMode } from '@/modules/reader/types/Reader.types.ts'; | ||
import { ReaderPagedPager } from '@/modules/reader/components/viewer/pager/ReaderPagedPager.tsx'; | ||
import { ReaderDoublePagedPager } from '@/modules/reader/components/viewer/pager/ReaderDoublePagedPager.tsx'; | ||
import { ReaderHorizontalPager } from '@/modules/reader/components/viewer/pager/ReaderHorizontalPager.tsx'; | ||
import { ReaderVerticalPager } from '@/modules/reader/components/viewer/pager/ReaderVerticalPager.tsx'; | ||
|
||
export const ReaderViewer = () => { | ||
const { readingMode } = ReaderService.useSettings(); | ||
|
||
const Pager = useMemo(() => { | ||
switch (readingMode.value) { | ||
case ReadingMode.SINGLE_PAGE: | ||
return ReaderPagedPager; | ||
case ReadingMode.DOUBLE_PAGE: | ||
return ReaderDoublePagedPager; | ||
case ReadingMode.CONTINUOUS_VERTICAL: | ||
return ReaderVerticalPager; | ||
case ReadingMode.CONTINUOUS_HORIZONTAL: | ||
return ReaderHorizontalPager; | ||
default: | ||
throw new Error(`Unexpected "ReadingMode" (${readingMode.value})`); | ||
} | ||
}, [readingMode.value]); | ||
|
||
return <Pager />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.