|
|
|
@@ -67,64 +67,73 @@ const FooterBar: React.FC<FooterBarProps> = ({
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const isVisible = hoveredBookKey === bookKey;
|
|
|
|
|
const progressInfo = bookFormat === 'PDF' ? section : pageinfo;
|
|
|
|
|
const progressValid = !!progressInfo;
|
|
|
|
|
const progressFraction = progressValid ? (progressInfo!.current + 1) / progressInfo!.total : 0;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={clsx(
|
|
|
|
|
'footer-bar absolute bottom-0 z-10 flex h-12 w-full items-center gap-x-4 px-4',
|
|
|
|
|
'shadow-xs bg-base-100 transition-opacity duration-300',
|
|
|
|
|
appService?.hasSafeAreaInset && 'pb-[env(safe-area-inset-bottom)]',
|
|
|
|
|
appService?.hasRoundedWindow && 'rounded-window-bottom-right',
|
|
|
|
|
!isSideBarVisible && appService?.hasRoundedWindow && 'rounded-window-bottom-left',
|
|
|
|
|
isHoveredAnim && 'hover-bar-anim',
|
|
|
|
|
viewSettings?.vertical && viewSettings?.scrolled ? 'mb-3 !h-6' : '',
|
|
|
|
|
hoveredBookKey === bookKey ? `opacity-100` : `opacity-0`,
|
|
|
|
|
)}
|
|
|
|
|
dir={viewSettings?.rtl ? 'rtl' : 'ltr'}
|
|
|
|
|
onMouseEnter={() => setHoveredBookKey(bookKey)}
|
|
|
|
|
onMouseLeave={() => setHoveredBookKey('')}
|
|
|
|
|
>
|
|
|
|
|
<div className='hidden sm:flex'>
|
|
|
|
|
<>
|
|
|
|
|
<div
|
|
|
|
|
className='absolute bottom-0 left-0 z-10 h-12 w-full'
|
|
|
|
|
onMouseEnter={() => setHoveredBookKey(bookKey)}
|
|
|
|
|
onTouchStart={() => setHoveredBookKey(bookKey)}
|
|
|
|
|
/>
|
|
|
|
|
<div
|
|
|
|
|
className={clsx(
|
|
|
|
|
'footer-bar absolute bottom-0 z-10 flex h-12 w-full items-center gap-x-4 px-4',
|
|
|
|
|
'shadow-xs bg-base-100 transition-opacity duration-300',
|
|
|
|
|
appService?.hasSafeAreaInset && 'pb-[env(safe-area-inset-bottom)]',
|
|
|
|
|
appService?.hasRoundedWindow && 'rounded-window-bottom-right',
|
|
|
|
|
!isSideBarVisible && appService?.hasRoundedWindow && 'rounded-window-bottom-left',
|
|
|
|
|
isHoveredAnim && 'hover-bar-anim',
|
|
|
|
|
viewSettings?.vertical && viewSettings?.scrolled ? 'mb-3 !h-6' : '',
|
|
|
|
|
isVisible ? `pointer-events-auto opacity-100` : `pointer-events-none opacity-0`,
|
|
|
|
|
)}
|
|
|
|
|
dir={viewSettings?.rtl ? 'rtl' : 'ltr'}
|
|
|
|
|
onMouseLeave={() => setHoveredBookKey('')}
|
|
|
|
|
aria-hidden={!isVisible}
|
|
|
|
|
>
|
|
|
|
|
<div className='hidden sm:flex'>
|
|
|
|
|
<Button
|
|
|
|
|
icon={viewSettings?.rtl ? <RiArrowRightWideLine /> : <RiArrowLeftWideLine />}
|
|
|
|
|
onClick={viewSettings?.rtl ? handleGoNext : handleGoPrev}
|
|
|
|
|
tooltip={viewSettings?.rtl ? _('Go Right') : _('Go Left')}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<Button
|
|
|
|
|
icon={viewSettings?.rtl ? <RiArrowRightWideLine /> : <RiArrowLeftWideLine />}
|
|
|
|
|
onClick={viewSettings?.rtl ? handleGoNext : handleGoPrev}
|
|
|
|
|
tooltip={viewSettings?.rtl ? _('Go Right') : _('Go Left')}
|
|
|
|
|
icon={viewSettings?.rtl ? <RiArrowGoForwardLine /> : <RiArrowGoBackLine />}
|
|
|
|
|
onClick={viewSettings?.rtl ? handleGoForward : handleGoBack}
|
|
|
|
|
tooltip={viewSettings?.rtl ? _('Go Forward') : _('Go Back')}
|
|
|
|
|
disabled={viewSettings?.rtl ? !view?.history.canGoForward : !view?.history.canGoBack}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<Button
|
|
|
|
|
icon={viewSettings?.rtl ? <RiArrowGoForwardLine /> : <RiArrowGoBackLine />}
|
|
|
|
|
onClick={viewSettings?.rtl ? handleGoForward : handleGoBack}
|
|
|
|
|
tooltip={viewSettings?.rtl ? _('Go Forward') : _('Go Back')}
|
|
|
|
|
disabled={viewSettings?.rtl ? !view?.history.canGoForward : !view?.history.canGoBack}
|
|
|
|
|
/>
|
|
|
|
|
<Button
|
|
|
|
|
icon={viewSettings?.rtl ? <RiArrowGoBackLine /> : <RiArrowGoForwardLine />}
|
|
|
|
|
onClick={viewSettings?.rtl ? handleGoBack : handleGoForward}
|
|
|
|
|
tooltip={viewSettings?.rtl ? _('Go Back') : _('Go Forward')}
|
|
|
|
|
disabled={viewSettings?.rtl ? !view?.history.canGoBack : !view?.history.canGoForward}
|
|
|
|
|
/>
|
|
|
|
|
<span className='mx-2 text-center text-sm'>
|
|
|
|
|
{progressValid ? `${Math.round(progressFraction * 100)}%` : ''}
|
|
|
|
|
</span>
|
|
|
|
|
<input
|
|
|
|
|
type='range'
|
|
|
|
|
className='text-base-content mx-2 w-full'
|
|
|
|
|
min={0}
|
|
|
|
|
max={100}
|
|
|
|
|
value={progressValid ? progressFraction * 100 : 0}
|
|
|
|
|
onChange={(e) => handleProgressChange(e)}
|
|
|
|
|
/>
|
|
|
|
|
<Button icon={<FaHeadphones />} onClick={handleSpeakText} tooltip={_('Speak')} />
|
|
|
|
|
<div className='hidden sm:flex'>
|
|
|
|
|
<Button
|
|
|
|
|
icon={viewSettings?.rtl ? <RiArrowLeftWideLine /> : <RiArrowRightWideLine />}
|
|
|
|
|
onClick={viewSettings?.rtl ? handleGoPrev : handleGoNext}
|
|
|
|
|
tooltip={viewSettings?.rtl ? _('Go Left') : _('Go Right')}
|
|
|
|
|
icon={viewSettings?.rtl ? <RiArrowGoBackLine /> : <RiArrowGoForwardLine />}
|
|
|
|
|
onClick={viewSettings?.rtl ? handleGoBack : handleGoForward}
|
|
|
|
|
tooltip={viewSettings?.rtl ? _('Go Back') : _('Go Forward')}
|
|
|
|
|
disabled={viewSettings?.rtl ? !view?.history.canGoBack : !view?.history.canGoForward}
|
|
|
|
|
/>
|
|
|
|
|
<span className='mx-2 text-center text-sm'>
|
|
|
|
|
{progressValid ? `${Math.round(progressFraction * 100)}%` : ''}
|
|
|
|
|
</span>
|
|
|
|
|
<input
|
|
|
|
|
type='range'
|
|
|
|
|
className='text-base-content mx-2 w-full'
|
|
|
|
|
min={0}
|
|
|
|
|
max={100}
|
|
|
|
|
value={progressValid ? progressFraction * 100 : 0}
|
|
|
|
|
onChange={(e) => handleProgressChange(e)}
|
|
|
|
|
/>
|
|
|
|
|
<Button icon={<FaHeadphones />} onClick={handleSpeakText} tooltip={_('Speak')} />
|
|
|
|
|
<div className='hidden sm:flex'>
|
|
|
|
|
<Button
|
|
|
|
|
icon={viewSettings?.rtl ? <RiArrowLeftWideLine /> : <RiArrowRightWideLine />}
|
|
|
|
|
onClick={viewSettings?.rtl ? handleGoPrev : handleGoNext}
|
|
|
|
|
tooltip={viewSettings?.rtl ? _('Go Left') : _('Go Right')}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|