mirror of
https://github.com/mue/mue.git
synced 2026-06-13 03:58:49 +02:00
stuff
This commit is contained in:
@@ -27,7 +27,8 @@ export default class MainModal extends React.PureComponent {
|
||||
document.getElementById('center').classList.toggle('backgroundEffects');
|
||||
|
||||
this.setState({
|
||||
tab: this.tabs.settings, currentTab: 'settings'
|
||||
tab: this.tabs.settings,
|
||||
currentTab: 'settings'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ export default class Checkbox extends React.PureComponent {
|
||||
|
||||
handleChange(name) {
|
||||
SettingsFunctions.setItem(name);
|
||||
|
||||
this.setState({
|
||||
checked: (this.state.checked === true) ? false : true
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ export default class Section extends React.PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
let extraHTML, expandMore, slider, noDropdown;
|
||||
let extraHTML, expandMore;
|
||||
|
||||
if (this.props.children) {
|
||||
extraHTML = (
|
||||
@@ -44,19 +44,11 @@ export default class Section extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
if (this.props.slider !== false) {
|
||||
slider = <Slider name={this.props.name} />;
|
||||
}
|
||||
|
||||
if (this.props.dropdown === false) {
|
||||
noDropdown = 'nodropdown';
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='section'>
|
||||
<h4 className={noDropdown} onClick={() => this.toggleSection()}>{this.props.title}</h4>
|
||||
<h4 className={(this.props.dropdown === false) ? 'nodropdown' : null} onClick={() => this.toggleSection()}>{this.props.title}</h4>
|
||||
{expandMore}
|
||||
{slider}
|
||||
{(this.props.slider !== false) ? <Slider name={this.props.name} /> : null}
|
||||
{extraHTML}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -10,8 +10,10 @@ export default class Slider extends React.PureComponent {
|
||||
};
|
||||
}
|
||||
|
||||
handleChange(name) {
|
||||
SettingsFunctions.setItem(name);
|
||||
handleChange() {
|
||||
let setText = (this.props.override) ? this.props.override : this.props.name;
|
||||
|
||||
SettingsFunctions.setItem(setText);
|
||||
|
||||
this.setState({
|
||||
checked: (this.state.checked === true) ? false : true
|
||||
@@ -19,11 +21,9 @@ export default class Slider extends React.PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
let setText = (this.props.override) ? this.props.override : this.props.name;
|
||||
|
||||
return (
|
||||
<label className='switch'>
|
||||
<input type='checkbox' checked={this.state.checked} onChange={() => this.handleChange(setText)} />
|
||||
<input type='checkbox' checked={this.state.checked} onChange={() => this.handleChange()} />
|
||||
<span className='slider'></span>
|
||||
</label>
|
||||
);
|
||||
|
||||
@@ -20,6 +20,7 @@ export default class GreetingSettings extends React.PureComponent {
|
||||
this.setState({
|
||||
greetingName: ''
|
||||
});
|
||||
|
||||
toast(this.props.toastLanguage.reset);
|
||||
}
|
||||
|
||||
@@ -29,6 +30,7 @@ export default class GreetingSettings extends React.PureComponent {
|
||||
}
|
||||
|
||||
localStorage.setItem('birthday', data);
|
||||
|
||||
this.setState({
|
||||
birthday: data
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ export default class SearchSettings extends React.PureComponent {
|
||||
resetSearch() {
|
||||
localStorage.removeItem('customSearchEngine');
|
||||
document.getElementById('customSearchEngine').value = '';
|
||||
|
||||
toast(this.props.toastLanguage.reset);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,13 +56,22 @@ export default class Marketplace extends React.PureComponent {
|
||||
break;
|
||||
|
||||
case 'item':
|
||||
let info;
|
||||
let info; // get item info
|
||||
try {
|
||||
info = await (await fetch(`${Constants.MARKETPLACE_URL}/item/${type2}/${data}`)).json();
|
||||
} catch (e) {
|
||||
return toast(this.props.toastLanguage.error);
|
||||
}
|
||||
|
||||
// check if already installed
|
||||
let button = this.buttons.install;
|
||||
|
||||
const installed = JSON.parse(localStorage.getItem('installed'));
|
||||
|
||||
if (installed.some(item => item.name === data)) {
|
||||
button = this.buttons.uninstall;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
current_data: { type: type2, name: data, content: info },
|
||||
item_data: {
|
||||
@@ -72,19 +81,8 @@ export default class Marketplace extends React.PureComponent {
|
||||
updated: info.updated,
|
||||
version: info.data.version,
|
||||
icon: info.data.screenshot_url
|
||||
}
|
||||
});
|
||||
|
||||
let button = this.buttons.install;
|
||||
|
||||
const installed = JSON.parse(localStorage.getItem('installed'));
|
||||
|
||||
if (installed.some(item => item.name === data)) {
|
||||
button = this.buttons.uninstall;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
button: button
|
||||
},
|
||||
button: button
|
||||
});
|
||||
|
||||
document.getElementById('marketplace').style.display = 'none';
|
||||
@@ -101,7 +99,7 @@ export default class Marketplace extends React.PureComponent {
|
||||
}
|
||||
|
||||
async getItems() {
|
||||
const { data }= await (await fetch(Constants.MARKETPLACE_URL + '/all')).json();
|
||||
const { data } = await (await fetch(Constants.MARKETPLACE_URL + '/all')).json();
|
||||
const featured = await (await fetch(Constants.MARKETPLACE_URL + '/featured')).json();
|
||||
|
||||
this.setState({
|
||||
|
||||
Reference in New Issue
Block a user