diff --git a/src/components/modals/main/settings/KeybindInput.jsx b/src/components/modals/main/settings/KeybindInput.jsx index 70ffb1d5..a5b5b204 100644 --- a/src/components/modals/main/settings/KeybindInput.jsx +++ b/src/components/modals/main/settings/KeybindInput.jsx @@ -1,22 +1,22 @@ import variables from 'modules/variables'; export default function KeybindInput(props) { - const value = props.state[props.settingsName]; + const value = props.state[props.setting]; const getButton = () => { if (!value) { return null; } else if (value === variables.language.getMessage(variables.languagecode, 'modals.main.settings.sections.keybinds.recording')) { - return props.cancel(props.settingsName)}>{variables.language.getMessage(variables.languagecode, 'modals.main.settings.sections.advanced.reset_modal.cancel')} + return props.action('cancel', props.setting)}>{variables.language.getMessage(variables.languagecode, 'modals.main.settings.sections.advanced.reset_modal.cancel')} } else { - return props.reset(props.settingsName)}>{variables.language.getMessage(variables.languagecode, 'modals.main.settings.buttons.reset')}; + return props.action('reset', props.setting)}>{variables.language.getMessage(variables.languagecode, 'modals.main.settings.buttons.reset')}; } } return ( <>

{props.name}

- props.set(props.settingsName)} value={value || variables.language.getMessage(variables.languagecode, 'modals.main.settings.sections.keybinds.click_to_record')} readOnly/> + props.action('listen', props.setting)} value={value || variables.language.getMessage(variables.languagecode, 'modals.main.settings.sections.keybinds.click_to_record')} readOnly/> {getButton()} ); diff --git a/src/components/modals/main/settings/sections/Keybinds.jsx b/src/components/modals/main/settings/sections/Keybinds.jsx index 7a95ec6a..fff24f68 100644 --- a/src/components/modals/main/settings/sections/Keybinds.jsx +++ b/src/components/modals/main/settings/sections/Keybinds.jsx @@ -74,23 +74,41 @@ export default class KeybindSettings extends PureComponent { this.showReminder(); } + action(action, e) { + switch (action) { + case 'listen': + this.listen(e); + break; + case 'cancel': + this.cancel(e); + break; + case 'reset': + this.reset(e); + break; + default: + break; + } + } + render() { + const { getMessage, languagecode } = this; + return ( <> -

{this.getMessage(this.languagecode, 'modals.main.settings.sections.keybinds.title')}

- - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> - this.listen(e)} reset={(e) => this.reset(e)} cancel={(e) => this.cancel(e)}/> +

{getMessage(languagecode, 'modals.main.settings.sections.keybinds.title')}

+ + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> + this.action(type, e)}/> ); } diff --git a/src/components/modals/main/settings/sections/background/Background.jsx b/src/components/modals/main/settings/sections/background/Background.jsx index 208721ca..ce015351 100644 --- a/src/components/modals/main/settings/sections/background/Background.jsx +++ b/src/components/modals/main/settings/sections/background/Background.jsx @@ -52,21 +52,13 @@ export default class BackgroundSettings extends PureComponent { localStorage.setItem('showReminder', true); } - addCustomBackground() { + modifyCustomBackground(type, index) { const customBackground = this.state.customBackground; - customBackground.push(''); - - this.setState({ - customBackground - }); - this.forceUpdate(); - - localStorage.setItem('customBackground', JSON.stringify(customBackground)); - } - - removeCustomBackground(index) { - const customBackground = this.state.customBackground; - customBackground.splice(index, 1); + if (type === 'add') { + customBackground.push(''); + } else { + customBackground.splice(index, 1); + } this.setState({ customBackground @@ -148,6 +140,8 @@ export default class BackgroundSettings extends PureComponent { } render() { + const { getMessage, languagecode } = this; + let backgroundSettings; const apiOptions = [ @@ -168,29 +162,29 @@ export default class BackgroundSettings extends PureComponent { const APISettings = ( <>
- +
- + {this.state.backgroundCategories.map((category) => ( ))}

- - - - - + + + + +

- - - - - - - - + + + + + + + + ); @@ -198,19 +192,19 @@ export default class BackgroundSettings extends PureComponent { const customSettings = ( <>
    -

    {this.getMessage(this.languagecode, 'modals.main.settings.sections.background.source.custom_background')} {this.getMessage(this.languagecode, 'modals.main.settings.buttons.reset')}

    +

    {getMessage(languagecode, 'modals.main.settings.sections.background.source.custom_background')} {getMessage(languagecode, 'modals.main.settings.buttons.reset')}

    {this.state.customBackground.map((_url, index) => ( this.customBackground(e, true, index)}> - {this.state.customBackground.length > 1 ? : null} - this.uploadCustombackground(index)}>{this.getMessage(this.languagecode, 'modals.main.settings.sections.background.source.ypload')} + this.uploadCustombackground(index)}>{getMessage(languagecode, 'modals.main.settings.sections.background.source.upload')} {this.videoCustomSettings(index)}

    ))} - + this.customBackground(e, false, this.state.currentBackgroundIndex)} />
@@ -228,41 +222,41 @@ export default class BackgroundSettings extends PureComponent { return ( <> -

{this.getMessage(this.languagecode, 'modals.main.settings.sections.background.title')}

- - - - +

{getMessage(languagecode, 'modals.main.settings.sections.background.title')}

+ + + + -

{this.getMessage(this.languagecode, 'modals.main.settings.sections.background.source.title')}

- this.setState({ backgroundType: value })} category='background'> +

{getMessage(languagecode, 'modals.main.settings.sections.background.source.title')}

+ this.setState({ backgroundType: value })} category='background'> {this.marketplaceType()} - - - + + +
{backgroundSettings} -

{this.getMessage(this.languagecode, 'modals.main.settings.sections.background.buttons.title')}

- - - +

{getMessage(languagecode, 'modals.main.settings.sections.background.buttons.title')}

+ + + -

{this.getMessage(this.languagecode, 'modals.main.settings.sections.background.effects.title')}

- - +

{getMessage(languagecode, 'modals.main.settings.sections.background.effects.title')}

+ +

- - - - - - + + + + + + - + ); } diff --git a/src/components/modals/main/settings/sections/background/Colour.jsx b/src/components/modals/main/settings/sections/background/Colour.jsx index 4dd58dba..c1d7afa1 100644 --- a/src/components/modals/main/settings/sections/background/Colour.jsx +++ b/src/components/modals/main/settings/sections/background/Colour.jsx @@ -12,6 +12,7 @@ import '../../../scss/settings/react-color-picker-gradient-picker-custom-styles. export default class ColourSettings extends PureComponent { DefaultGradientSettings = { angle: '180', gradient: [{ colour: '#ffb032', stop: 0 }], type: 'linear' }; GradientPickerInitalState = undefined; + getMessage = (languagecode, text) => variables.language.getMessage(languagecode, text); languagecode = variables.languagecode; diff --git a/src/translations/de_DE.json b/src/translations/de_DE.json index 6b4d5324..e06b717f 100644 --- a/src/translations/de_DE.json +++ b/src/translations/de_DE.json @@ -166,6 +166,7 @@ "custom_colour": "Benutzerdefinierter Hintergrundfarbe", "upload": "Hochladen", "add_colour": "Farbe hinzufügen", + "add_background": "Add background", "disabled": "Deaktiviert", "loop_video": "Video schleife", "mute_video": "Video stumm", diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index bc85bfe7..20dff25b 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -166,6 +166,7 @@ "custom_colour": "Custom background colour", "upload": "Upload", "add_colour": "Add colour", + "add_background": "Add background", "disabled": "Disabled", "loop_video": "Loop video", "mute_video": "Mute video", diff --git a/src/translations/en_US.json b/src/translations/en_US.json index b6761775..adb2bfa5 100644 --- a/src/translations/en_US.json +++ b/src/translations/en_US.json @@ -166,6 +166,7 @@ "custom_colour": "Custom background color", "upload": "Upload", "add_colour": "Add color", + "add_background": "Add background", "disabled": "Disabled", "loop_video": "Loop video", "mute_video": "Mute video", diff --git a/src/translations/es.json b/src/translations/es.json index fc6d6451..616e0531 100644 --- a/src/translations/es.json +++ b/src/translations/es.json @@ -166,6 +166,7 @@ "custom_colour": "Color del fondo personalizado", "upload": "Subir", "add_colour": "Añadir color", + "add_background": "Add background", "disabled": "Desactivado", "loop_video": "Vídeo en bucle", "mute_video": "Silenciar video", diff --git a/src/translations/fr.json b/src/translations/fr.json index 6e69a8cb..9fa354cd 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -166,6 +166,7 @@ "custom_colour": "Couleur d'arrière-plan personnalisée", "upload": "Ajouter", "add_colour": "Ajouter une couleur", + "add_background": "Add background", "disabled": "Disabled", "loop_video": "Boucle vidéo", "mute_video": "Mettre la vidéo en sourdine", diff --git a/src/translations/nl.json b/src/translations/nl.json index 11cdb57c..45911d3c 100644 --- a/src/translations/nl.json +++ b/src/translations/nl.json @@ -166,6 +166,7 @@ "custom_colour": "Aangepaste achtergrondkleur", "upload": "Uploaden", "add_colour": "Kleur toevoegen", + "add_background": "Add background", "disabled": "Uitgeschakeld", "loop_video": "Loop video", "mute_video": "Mute video", diff --git a/src/translations/no.json b/src/translations/no.json index 5095e102..a1afba02 100644 --- a/src/translations/no.json +++ b/src/translations/no.json @@ -166,6 +166,7 @@ "custom_colour": "Personlig Bakgrunn Farge", "upload": "Upload", "add_colour": "Legg til farge", + "add_background": "Add background", "disabled": "Disabled", "loop_video": "Loop video", "mute_video": "Mute video", diff --git a/src/translations/ru.json b/src/translations/ru.json index 0d9d867d..d9735329 100644 --- a/src/translations/ru.json +++ b/src/translations/ru.json @@ -166,6 +166,7 @@ "custom_colour": "Пользовательский цвет фон", "upload": "Загрузить", "add_colour": "Добавить цвет", + "add_background": "Add background", "disabled": "Выключен", "loop_video": "Loop video", "mute_video": "Mute video", diff --git a/src/translations/zh_CN.json b/src/translations/zh_CN.json index bdd83775..70ae7f97 100644 --- a/src/translations/zh_CN.json +++ b/src/translations/zh_CN.json @@ -166,6 +166,7 @@ "custom_colour": "自定义背景颜色", "upload": "上传", "add_colour": "添加颜色", + "add_background": "Add background", "disabled": "已禁用", "loop_video": "循环播放", "mute_video": "静音",