mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
Only allow dual page view when there is more than one page, update to… (#5246)
This commit is contained in:
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
|
|||||||
import { Button, Paper, Group, NumberInput } from '@mantine/core';
|
import { Button, Paper, Group, NumberInput } from '@mantine/core';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useViewer } from '@app/contexts/ViewerContext';
|
import { useViewer } from '@app/contexts/ViewerContext';
|
||||||
|
import { Tooltip } from '@app/components/shared/Tooltip';
|
||||||
import FirstPageIcon from '@mui/icons-material/FirstPage';
|
import FirstPageIcon from '@mui/icons-material/FirstPage';
|
||||||
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
|
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
|
||||||
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
||||||
@@ -209,21 +210,27 @@ export function PdfViewerToolbar({
|
|||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* Dual Page Toggle */}
|
{/* Dual Page Toggle */}
|
||||||
|
<Tooltip
|
||||||
|
content={
|
||||||
|
isDualPageActive
|
||||||
|
? t("viewer.singlePageView", "Single Page View")
|
||||||
|
: t("viewer.dualPageView", "Dual Page View")
|
||||||
|
}
|
||||||
|
position="top"
|
||||||
|
arrow
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
variant={isDualPageActive ? "filled" : "light"}
|
variant={isDualPageActive ? "filled" : "light"}
|
||||||
color="blue"
|
color="blue"
|
||||||
size="md"
|
size="md"
|
||||||
radius="xl"
|
radius="xl"
|
||||||
onClick={handleDualPageToggle}
|
onClick={handleDualPageToggle}
|
||||||
|
disabled={scrollState.totalPages <= 1}
|
||||||
style={{ minWidth: '2.5rem' }}
|
style={{ minWidth: '2.5rem' }}
|
||||||
title={
|
|
||||||
isDualPageActive
|
|
||||||
? t("viewer.singlePageView", "Single Page View")
|
|
||||||
: t("viewer.dualPageView", "Dual Page View")
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{isDualPageActive ? <DescriptionIcon fontSize="small" /> : <ViewWeekIcon fontSize="small" />}
|
{isDualPageActive ? <DescriptionIcon fontSize="small" /> : <ViewWeekIcon fontSize="small" />}
|
||||||
</Button>
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
{/* Zoom Controls */}
|
{/* Zoom Controls */}
|
||||||
<Group gap={4} align="center" style={{ marginLeft: 16 }}>
|
<Group gap={4} align="center" style={{ marginLeft: 16 }}>
|
||||||
|
|||||||
Reference in New Issue
Block a user