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

@@ -46,7 +46,7 @@ export default class AdvancedSettings extends React.PureComponent {
<h3>{advanced.customisation}</h3>
<Text title={advanced.custom_js} name='customjs' textarea={true}/>
<Text title={advanced.custom_css} name='customcss' textarea={true}/>
<Text title={advanced.tab_name} name='tabName' default={window.language.tabname}/>
<Text title={advanced.tab_name} name='tabName' default={window.language.tabname} category='other'/>
<h3>{this.language.sections.experimental.title}</h3>
<p>{advanced.experimental_warning}</p>

View File

@@ -29,7 +29,7 @@ export default function AppearanceSettings() {
return (
<>
<h2>{appearance.title}</h2>
<Radio name='theme' title={appearance.theme.title} options={themeOptions} />
<Radio name='theme' title={appearance.theme.title} options={themeOptions} category='other' />
<h3>{appearance.navbar.title}</h3>
<Checkbox name='notesEnabled' text={appearance.navbar.notes} />

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()}
</>