2024-11-04 18:00:35 +01:00
|
|
|
/*
|
|
|
|
|
* 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 Button from '@mui/material/Button';
|
|
|
|
|
import Box from '@mui/material/Box';
|
2026-01-10 19:45:02 +01:00
|
|
|
import { useLingui } from '@lingui/react/macro';
|
2026-03-11 00:11:29 +01:00
|
|
|
import type { IReaderSettings } from '@/features/reader/Reader.types.ts';
|
2025-08-16 02:02:13 +02:00
|
|
|
import { READER_PAGE_SCALE_MODE_TO_SCALING_ALLOWED } from '@/features/reader/settings/ReaderSettings.constants.tsx';
|
2024-11-04 18:00:35 +01:00
|
|
|
|
|
|
|
|
export const ReaderSettingStretchPage = ({
|
|
|
|
|
pageScaleMode,
|
|
|
|
|
shouldStretchPage,
|
|
|
|
|
setShouldStretchPage,
|
|
|
|
|
}: Pick<IReaderSettings, 'pageScaleMode' | 'shouldStretchPage'> & {
|
|
|
|
|
setShouldStretchPage: (mode: IReaderSettings['shouldStretchPage']) => void;
|
|
|
|
|
}) => {
|
2026-01-10 19:45:02 +01:00
|
|
|
const { t } = useLingui();
|
2024-11-04 18:00:35 +01:00
|
|
|
|
|
|
|
|
if (!READER_PAGE_SCALE_MODE_TO_SCALING_ALLOWED[pageScaleMode]) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Box>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() => setShouldStretchPage(!shouldStretchPage)}
|
|
|
|
|
variant={shouldStretchPage ? 'contained' : 'outlined'}
|
|
|
|
|
>
|
2026-01-10 19:45:02 +01:00
|
|
|
{t`Stretch small pages`}
|
2024-11-04 18:00:35 +01:00
|
|
|
</Button>
|
|
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
};
|