mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-21 21:29:20 +01:00
Fix toggle values for settings for translation
This commit is contained in:
parent
bbdfb5dd7d
commit
731f91122b
2 changed files with 66 additions and 55 deletions
|
@ -159,17 +159,27 @@ function Settings({ onClose }) {
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={snapStates.settings.contentTranslation}
|
checked={snapStates.settings.contentTranslation}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
states.settings.contentTranslation = e.target.checked;
|
const { checked } = e.target;
|
||||||
|
states.settings.contentTranslation = checked;
|
||||||
|
if (!checked) {
|
||||||
|
states.settings.contentTranslationTargetLanguage = null;
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
Post translation
|
Post translation
|
||||||
</label>
|
</label>
|
||||||
{snapStates.settings.contentTranslation && (
|
<div
|
||||||
<div class="sub-section">
|
class={`sub-section ${
|
||||||
|
!snapStates.settings.contentTranslation
|
||||||
|
? 'more-insignificant'
|
||||||
|
: ''
|
||||||
|
}`}
|
||||||
|
>
|
||||||
<label>
|
<label>
|
||||||
Translate to{' '}
|
Translate to{' '}
|
||||||
<select
|
<select
|
||||||
value={targetLanguage}
|
value={targetLanguage || ''}
|
||||||
|
disabled={!snapStates.settings.contentTranslation}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
states.settings.contentTranslationTargetLanguage =
|
states.settings.contentTranslationTargetLanguage =
|
||||||
e.target.value || null;
|
e.target.value || null;
|
||||||
|
@ -198,7 +208,6 @@ function Settings({ onClose }) {
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -56,9 +56,9 @@ subscribeKey(states, 'notificationsLast', (v) => {
|
||||||
console.log('CHANGE', v);
|
console.log('CHANGE', v);
|
||||||
store.account.set('notificationsLast', states.notificationsLast);
|
store.account.set('notificationsLast', states.notificationsLast);
|
||||||
});
|
});
|
||||||
subscribe(states, (v) => {
|
subscribe(states, (changes) => {
|
||||||
console.debug('STATES change', v);
|
console.debug('STATES change', changes);
|
||||||
const [action, path, value, prevValue] = v[0];
|
for (const [action, path, value, prevValue] of changes) {
|
||||||
if (path.join('.') === 'settings.boostsCarousel') {
|
if (path.join('.') === 'settings.boostsCarousel') {
|
||||||
store.account.set('settings-boostsCarousel', !!value);
|
store.account.set('settings-boostsCarousel', !!value);
|
||||||
}
|
}
|
||||||
|
@ -72,11 +72,13 @@ subscribe(states, (v) => {
|
||||||
store.account.set('settings-contentTranslation', !!value);
|
store.account.set('settings-contentTranslation', !!value);
|
||||||
}
|
}
|
||||||
if (path.join('.') === 'settings.contentTranslationTargetLanguage') {
|
if (path.join('.') === 'settings.contentTranslationTargetLanguage') {
|
||||||
|
console.log('SET', value);
|
||||||
store.account.set('settings-contentTranslationTargetLanguage', value);
|
store.account.set('settings-contentTranslationTargetLanguage', value);
|
||||||
}
|
}
|
||||||
if (path?.[0] === 'shortcuts') {
|
if (path?.[0] === 'shortcuts') {
|
||||||
store.account.set('shortcuts', states.shortcuts);
|
store.account.set('shortcuts', states.shortcuts);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export function hideAllModals() {
|
export function hideAllModals() {
|
||||||
|
|
Loading…
Reference in a new issue