Skip to content

Commit

Permalink
Fix Issue with Checkbox not Updating on AniDB Settings. (#664)
Browse files Browse the repository at this point in the history
* Fix Issue With Checkbox not Updating on AniDB Settings.

* CSS Updates.

* Update Check in updateSettings.
  • Loading branch information
ElementalCrisis authored Oct 29, 2023
1 parent bc96d23 commit a2fad60
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/pages/settings/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ export const initialSettings = {
type ContextType = {
newSettings: SettingsType;
setNewSettings: (settings: SettingsType) => void;
updateSetting: (type: string, key: string, value: string) => void;
updateSetting: (type: string, key: string, value: string | boolean) => void;
};

function SettingsPage() {
Expand All @@ -544,8 +544,8 @@ function SettingsPage() {
return !isEqual(newSettings, initialSettings);
}, [newSettings, settings]);

const updateSetting = (type: string, key: string, value: string) => {
if (key === 'theme') {
const updateSetting = (type: string, key: string, value: string | boolean) => {
if (key === 'theme' && typeof value === 'string') {
globalThis.localStorage.setItem('theme', value);
}

Expand Down
20 changes: 10 additions & 10 deletions src/pages/settings/tabs/AniDBSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function AniDBSettings() {
onClick={() => testLogin()}
loading={testAniDbLoginResult.isLoading}
buttonType="primary"
className="!text-base font-semibold"
className="px-4"
>
Test
</Button>
Expand Down Expand Up @@ -179,28 +179,28 @@ function AniDBSettings() {
label="Character Images"
id="character-images"
isChecked={DownloadCharacters}
onChange={event => updateSetting('AniDb', 'DownloadCharacters', event.target.checked.toString())}
onChange={event => updateSetting('AniDb', 'DownloadCharacters', event.target.checked)}
/>
<Checkbox
justify
label="Creator Images"
id="creator-images"
isChecked={DownloadCreators}
onChange={event => updateSetting('AniDb', 'DownloadCreators', event.target.checked.toString())}
onChange={event => updateSetting('AniDb', 'DownloadCreators', event.target.checked)}
/>
<Checkbox
justify
label="Release Groups"
id="release-groups"
isChecked={DownloadReleaseGroups}
onChange={event => updateSetting('AniDb', 'DownloadReleaseGroups', event.target.checked.toString())}
onChange={event => updateSetting('AniDb', 'DownloadReleaseGroups', event.target.checked)}
/>
<Checkbox
justify
label="Related Anime"
id="related-anime"
isChecked={DownloadRelatedAnime}
onChange={event => updateSetting('AniDb', 'DownloadRelatedAnime', event.target.checked.toString())}
onChange={event => updateSetting('AniDb', 'DownloadRelatedAnime', event.target.checked)}
/>
<div
className={cx(
Expand Down Expand Up @@ -228,35 +228,35 @@ function AniDBSettings() {
label="Add Files"
id="add-files"
isChecked={MyList_AddFiles}
onChange={event => updateSetting('AniDb', 'MyList_AddFiles', event.target.checked.toString())}
onChange={event => updateSetting('AniDb', 'MyList_AddFiles', event.target.checked)}
/>
<Checkbox
justify
label="Read Watched"
id="read-watched"
isChecked={MyList_ReadWatched}
onChange={event => updateSetting('AniDb', 'MyList_ReadWatched', event.target.checked.toString())}
onChange={event => updateSetting('AniDb', 'MyList_ReadWatched', event.target.checked)}
/>
<Checkbox
justify
label="Read Unwatched"
id="read-unwatched"
isChecked={MyList_ReadUnwatched}
onChange={event => updateSetting('AniDb', 'MyList_ReadUnwatched', event.target.checked.toString())}
onChange={event => updateSetting('AniDb', 'MyList_ReadUnwatched', event.target.checked)}
/>
<Checkbox
justify
label="Set Watched"
id="set-watched"
isChecked={MyList_SetWatched}
onChange={event => updateSetting('AniDb', 'MyList_SetWatched', event.target.checked.toString())}
onChange={event => updateSetting('AniDb', 'MyList_SetWatched', event.target.checked)}
/>
<Checkbox
justify
label="Set Unwatched"
id="set-unwatched"
isChecked={MyList_SetUnwatched}
onChange={event => updateSetting('AniDb', 'MyList_SetUnwatched', event.target.checked.toString())}
onChange={event => updateSetting('AniDb', 'MyList_SetUnwatched', event.target.checked)}
/>
<div className="flex items-center justify-between">
<span>Storage State</span>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/settings/tabs/MetadataSitesSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ function MetadataSitesSettings() {
undefined,
{ autoClose: 10000 },
), () => {})}
className="bg-panel-text-primary px-2 py-1 font-semibold "
className="px-4"
buttonType="primary"
>
{traktCodeResult.isFetching ? 'Requesting...' : 'Get Code'}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = {
'panel-border': 'var(--panel-border)',
'panel-icon': 'var(--panel-icon)',
'panel-icon-action': 'var(--panel-icon-action)',
'panel-icon-danger': 'var(--panel-icon-remove)',
'panel-icon-danger': 'var(--panel-icon-danger)',
'panel-icon-important': 'var(--panel-icon-important)',
'panel-icon-warning': 'var(--panel-icon-warning)',
'panel-input': 'var(--panel-input)',
Expand Down

0 comments on commit a2fad60

Please sign in to comment.