fix: marketplace now works, more hot reload support and fixes

Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
David Ralph
2021-04-12 20:35:17 +01:00
parent b370de9ea3
commit 90a4696114
14 changed files with 52 additions and 35 deletions

View File

@@ -30,7 +30,7 @@ export default class BackgroundSettings extends React.PureComponent {
toast(this.language.toasts.reset);
}
fileUpload(e) {
customBackground(e) {
localStorage.setItem('customBackground', e.target.result);
this.setState({
customBackground: e.target.result
@@ -58,10 +58,6 @@ export default class BackgroundSettings extends React.PureComponent {
}
}
componentDidUpdate() {
localStorage.setItem('customBackground', this.state.customBackground);
}
async getBackgroundCategories() {
const data = await (await fetch(window.constants.API_URL + '/images/categories')).json();
this.setState({
@@ -94,7 +90,7 @@ export default class BackgroundSettings extends React.PureComponent {
<br/>
<Radio title={background.source.api} options={apiOptions} name='backgroundAPI'/>
<br/>
<Dropdown label='Category' name='apiCategory'>
<Dropdown label={background.category} name='apiCategory'>
{this.state.backgroundCategories.map((category) => (
<option value={category} key={category}>{category.charAt(0).toUpperCase() + category.slice(1)}</option>
))}
@@ -106,9 +102,9 @@ export default class BackgroundSettings extends React.PureComponent {
<>
<ul>
<p>{background.source.custom_background} <span className='modalLink' onClick={this.resetCustom}>{this.language.buttons.reset}</span></p>
<input type='text' value={this.state.customBackground} onChange={(e) => this.setState({ customBackground: e.target.value })}></input>
<input type='text' value={this.state.customBackground} onChange={(e) => this.customBackground(e)}></input>
<span className='modalLink' onClick={() => document.getElementById('bg-input').click()}>{background.source.upload}</span>
<FileUpload id='bg-input' accept='image/jpeg, image/png, image/webp, image/webm, image/gif, video/mp4, video/webm, video/ogg' loadFunction={(e) => this.fileUpload(e)} />
<FileUpload id='bg-input' accept='image/jpeg, image/png, image/webp, image/webm, image/gif, video/mp4, video/webm, video/ogg' loadFunction={(e) => this.customBackground(e)} />
</ul>
{this.videoCustomSettings()}
</>