Make reader width configurable (#565)

Signed-off-by: Chance Zibolski <chance.zibolski@gmail.com>
This commit is contained in:
Chance Zibolski
2024-01-21 13:33:13 -08:00
committed by GitHub
parent dcbf5a1899
commit 5032a0ae94
9 changed files with 61 additions and 33 deletions

View File

@@ -11,7 +11,15 @@ import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'r
import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { Box } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { ChapterOffset, IReaderSettings, ReaderType, TChapter, TManga, TranslationKey } from '@/typings';
import {
AllowedMetadataValueTypes,
ChapterOffset,
IReaderSettings,
ReaderType,
TChapter,
TManga,
TranslationKey,
} from '@/typings';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import {
checkAndHandleMissingStoredReaderSettings,
@@ -227,7 +235,7 @@ export function Reader() {
.response.catch();
};
const setSettingValue = (key: keyof IReaderSettings, value: string | boolean) => {
const setSettingValue = (key: keyof IReaderSettings, value: AllowedMetadataValueTypes) => {
setSettings({ ...settings, [key]: value });
requestUpdateMangaMetadata(manga, [[key, value]]).catch(() =>
makeToast(t('reader.settings.error.label.failed_to_save_settings'), 'warning'),

View File

@@ -10,7 +10,7 @@ import { useContext, useEffect } from 'react';
import { Box } from '@mui/material';
import CircularProgress from '@mui/material/CircularProgress';
import { useTranslation } from 'react-i18next';
import { IReaderSettings } from '@/typings';
import { AllowedMetadataValueTypes, IReaderSettings } from '@/typings';
import { convertToGqlMeta, requestUpdateServerMetadata } from '@/util/metadata';
import {
checkAndHandleMissingStoredReaderSettings,
@@ -34,7 +34,7 @@ export function DefaultReaderSettings() {
useSetDefaultBackTo('settings');
const setSettingValue = (key: keyof IReaderSettings, value: string | boolean) => {
const setSettingValue = (key: keyof IReaderSettings, value: AllowedMetadataValueTypes) => {
requestUpdateServerMetadata(convertToGqlMeta(metadata)! ?? {}, [[key, value]]).catch(() =>
makeToast(t('reader.settings.error.label.failed_to_save_settings'), 'warning'),
);
@@ -71,6 +71,7 @@ export function DefaultReaderSettings() {
fitPageToWindow={settings.fitPageToWindow}
readerType={settings.readerType}
offsetFirstPage={settings.offsetFirstPage}
readerWidth={settings.readerWidth}
/>
);
}