feat: hot reload support for some widgets, css improvements on marketplace

Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
David Ralph
2021-04-12 18:55:02 +01:00
parent fbe6e040ea
commit b370de9ea3
17 changed files with 147 additions and 25 deletions

View File

@@ -104,7 +104,7 @@ export default class Added extends React.PureComponent {
if (this.state.installed.length === 0) {
content = (
<div className='items'>
<div className='emptyitems'>
<div className='emptyMessage'>
<LocalMallIcon/>
<h1>{this.language.empty.title}</h1>

View File

@@ -119,8 +119,7 @@ ul.sidebar {
border-radius: 12px 0 0 12px;
text-align: left;
font-size: 24px;
padding-bottom: 100%;
margin-bottom: -100%;
height: 100vh;
h1 {
text-align: center;

View File

@@ -1,5 +1,6 @@
import React from 'react';
import EventBus from '../../../../modules/helpers/eventbus';
import SettingsFunctions from '../../../../modules/helpers/settings';
import CheckboxUI from '@material-ui/core/Checkbox';
@@ -19,6 +20,8 @@ export default class Checkbox extends React.PureComponent {
this.setState({
checked: (this.state.checked === true) ? false : true
});
EventBus.dispatch('refresh', this.props.category);
}
render() {

View File

@@ -1,5 +1,7 @@
import React from 'react';
import EventBus from '../../../../modules/helpers/eventbus';
import RadioUI from '@material-ui/core/Radio';
import RadioGroup from '@material-ui/core/RadioGroup';
import FormControlLabel from '@material-ui/core/FormControlLabel';
@@ -22,6 +24,8 @@ export default class Radio extends React.PureComponent {
this.setState({
value: value
});
EventBus.dispatch('refresh', this.props.category);
}
render() {

View File

@@ -1,5 +1,7 @@
import React from 'react';
import EventBus from '../../../../modules/helpers/eventbus';
import { toast } from 'react-toastify';
export default class Slider extends React.PureComponent {
@@ -18,6 +20,8 @@ export default class Slider extends React.PureComponent {
this.setState({
value: value
});
EventBus.dispatch('refresh', this.props.category);
}
resetItem = () => {

View File

@@ -1,5 +1,6 @@
import React from 'react';
import EventBus from '../../../../modules/helpers/eventbus';
import SettingsFunctions from '../../../../modules/helpers/settings';
import SwitchUI from '@material-ui/core/Switch';
@@ -19,6 +20,8 @@ export default class Switch extends React.PureComponent {
this.setState({
checked: (this.state.checked === true) ? false : true
});
EventBus.dispatch('refresh', this.props.category);
}
render() {

View File

@@ -1,5 +1,7 @@
import React from 'react';
import EventBus from '../../../../modules/helpers/eventbus';
import { toast } from 'react-toastify';
export default class Text extends React.PureComponent {
@@ -23,6 +25,8 @@ export default class Text extends React.PureComponent {
this.setState({
value: value
});
EventBus.dispatch('refresh', this.props.category);
}
resetItem = () => {

View File

@@ -1,5 +1,7 @@
import React from 'react';
import EventBus from '../../../../../modules/helpers/eventbus';
import DragHandleIcon from '@material-ui/icons/DragIndicator';
import { sortableContainer, sortableElement } from 'react-sortable-hoc';
@@ -63,6 +65,7 @@ export default class OrderSettings extends React.PureComponent {
componentDidUpdate() {
localStorage.setItem('order', JSON.stringify(this.state.items));
EventBus.dispatch('refresh', 'order');
}
render() {

View File

@@ -10,15 +10,15 @@ export default function QuoteSettings() {
return (
<>
<h2>{quote.title}</h2>
<Switch name='quote' text={window.language.modals.main.settings.enabled} />
<Checkbox name='authorLink' text={quote.author_link}/>
<Text title={quote.custom} name='customQuote'/>
<Text title={quote.custom_author} name='customQuoteAuthor'/>
<Switch name='quote' text={window.language.modals.main.settings.enabled} category='quote' />
<Checkbox name='authorLink' text={quote.author_link} category='quote' />
<Text title={quote.custom} name='customQuote' category='quote' />
<Text title={quote.custom_author} name='customQuoteAuthor' category='quote'/>
<h3>{quote.buttons.title}</h3>
<Checkbox name='copyButton' text={quote.buttons.copy}/>
<Checkbox name='tweetButton' text={quote.buttons.tweet}/>
<Checkbox name='favouriteQuoteEnabled' text={quote.buttons.favourite}/>
<Checkbox name='copyButton' text={quote.buttons.copy} category='quote'/>
<Checkbox name='tweetButton' text={quote.buttons.tweet} category='quote'/>
<Checkbox name='favouriteQuoteEnabled' text={quote.buttons.favourite} category='quote'/>
</>
);
}

View File

@@ -4,6 +4,8 @@ import Dropdown from '../Dropdown';
import Checkbox from '../Checkbox';
import Switch from '../Switch';
import EventBus from '../../../../../modules/helpers/eventbus';
import { isChrome } from 'react-device-detect';
import { toast } from 'react-toastify';
@@ -44,6 +46,8 @@ export default class SearchSettings extends React.PureComponent {
if (this.state.customEnabled === true && this.state.customValue !== '') {
localStorage.setItem('customSearchEngine', this.state.customValue);
}
EventBus.dispatch('refresh', 'search');
}
setSearchEngine(input) {
@@ -59,6 +63,8 @@ export default class SearchSettings extends React.PureComponent {
});
localStorage.setItem('searchEngine', input);
}
EventBus.dispatch('refresh', 'search');
}
render() {
@@ -68,7 +74,7 @@ export default class SearchSettings extends React.PureComponent {
return (
<>
<h2>{search.title}</h2>
<Switch name='searchBar' text={language.enabled} />
<Switch name='searchBar' text={language.enabled} category='search' />
{isChrome ? <Checkbox name='voiceSearch' text={search.voice_search} /> : null}
<Dropdown label={search.search_engine} name='searchEngine' onChange={(value) => this.setSearchEngine(value)}>