Change compression option to integer range

This commit is contained in:
glax 2024-10-27 03:54:24 +01:00
parent 363d4d7518
commit 7eca06332a
2 changed files with 9 additions and 11 deletions

View File

@ -120,17 +120,17 @@ export default function Settings({backendConnected, apiUri, settings, changeSett
}) })
} }
const SetCompressImages : ChangeEventHandler<HTMLInputElement> = (e) => { const SetCompressImages : MouseEventHandler<HTMLInputElement> = (e) => {
console.info(`Updating ImageCompression ${e.target.checked}`); //console.info(`Updating ImageCompression ${e.currentTarget.value}`);
postData(`${apiUri}/v2/Settings/CompressImages`, {value: e.target.checked}) postData(`${apiUri}/v2/Settings/CompressImages`, {value: e.currentTarget.value})
.then((json) => { .then((json) => {
//console.info(`Successfully updated ImageCompression ${e.target.checked}`); //console.info(`Successfully updated ImageCompression ${e.currentTarget.value}`);
UpdateBackendSettings(); UpdateBackendSettings();
}) })
} }
const SetBWImages : ChangeEventHandler<HTMLInputElement> = (e) => { const SetBWImages : ChangeEventHandler<HTMLInputElement> = (e) => {
console.info(`Updating B/W Images ${e.target.checked}`); //console.info(`Updating B/W Images ${e.target.checked}`);
postData(`${apiUri}/v2/Settings/BWImages`, {value: e.target.checked}) postData(`${apiUri}/v2/Settings/BWImages`, {value: e.target.checked})
.then((json) => { .then((json) => {
//console.info(`Successfully updated B/W Images ${e.target.checked}`); //console.info(`Successfully updated B/W Images ${e.target.checked}`);
@ -170,10 +170,8 @@ export default function Settings({backendConnected, apiUri, settings, changeSett
<Toggle id="aprilFoolsMode" <Toggle id="aprilFoolsMode"
checked={backendSettings?.aprilFoolsMode ?? false} checked={backendSettings?.aprilFoolsMode ?? false}
onChange={SetAprilFoolsMode}/> onChange={SetAprilFoolsMode}/>
<label htmlFor="compressImages">Image Compression</label> <label htmlFor="compression">Image Compression</label>
<Toggle id="compressImages" <input type="range" min="1" max="100" defaultValue={backendSettings?.compression ?? 50} className="slider" id="compression" onMouseUp={SetCompressImages}/>
checked={backendSettings?.compressImages ?? false}
onChange={SetCompressImages}/>
<label htmlFor="bwImages">B/W Images</label> <label htmlFor="bwImages">B/W Images</label>
<Toggle id="bwImages" <Toggle id="bwImages"
checked={backendSettings?.bwImages ?? false} checked={backendSettings?.bwImages ?? false}

View File

@ -7,7 +7,7 @@ export default interface IBackendSettings {
"bufferNotifications": boolean; "bufferNotifications": boolean;
"version": number; "version": number;
"aprilFoolsMode": boolean; "aprilFoolsMode": boolean;
"compressImages": boolean; "compression": number;
"bwImages": boolean; "bwImages": boolean;
"requestLimits": { "requestLimits": {
"MangaInfo": number; "MangaInfo": number;