mirror of
https://github.com/mue/mue.git
synced 2026-07-10 14:04:32 +02:00
refactor: cleanup
This commit is contained in:
@@ -9,8 +9,8 @@ import Favourite from './background/Favourite';
|
||||
import Date from './time/Date';
|
||||
|
||||
export default class Widgets extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
// widgets we can re-order
|
||||
this.widgets = {
|
||||
time: this.enabled('time') ? <Clock/> : null,
|
||||
|
||||
@@ -5,8 +5,8 @@ import PhotoInformation from './PhotoInformation';
|
||||
import './scss/index.scss';
|
||||
|
||||
export default class Background extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
style: '',
|
||||
url: '',
|
||||
|
||||
@@ -4,8 +4,8 @@ import StarIcon from '@material-ui/icons/Star';
|
||||
import StarIcon2 from '@material-ui/icons/StarBorder';
|
||||
|
||||
export default class Favourite extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
favourited: (localStorage.getItem('favourite')) ? <StarIcon onClick={() => this.favourite()} /> : <StarIcon2 onClick={() => this.favourite()} />
|
||||
};
|
||||
|
||||
@@ -3,8 +3,8 @@ import React from 'react';
|
||||
import FullscreenIcon from '@material-ui/icons/Fullscreen';
|
||||
|
||||
export default class View extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
hidden: false
|
||||
};
|
||||
|
||||
@@ -5,8 +5,8 @@ import dtf from '@eartharoid/dtf';
|
||||
import './greeting.scss';
|
||||
|
||||
export default class Greeting extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
greeting: ''
|
||||
};
|
||||
|
||||
@@ -7,8 +7,8 @@ import NotesIcon from '@material-ui/icons/AssignmentRounded';
|
||||
import Pin from './Pin';
|
||||
|
||||
export default class Notes extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
notes: localStorage.getItem('notes') || ''
|
||||
};
|
||||
|
||||
@@ -11,8 +11,8 @@ import './quote.scss';
|
||||
|
||||
|
||||
export default class Quote extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
quote: '',
|
||||
author: '',
|
||||
|
||||
@@ -8,8 +8,8 @@ import './search.scss';
|
||||
const searchEngines = require('./search_engines.json');
|
||||
|
||||
export default class Search extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
url: '',
|
||||
query: '',
|
||||
@@ -18,7 +18,7 @@ export default class Search extends React.PureComponent {
|
||||
this.language = window.language.widgets.search;
|
||||
}
|
||||
|
||||
startSpeechRecognition() {
|
||||
startSpeechRecognition = () => {
|
||||
const voiceSearch = new window.webkitSpeechRecognition();
|
||||
voiceSearch.start();
|
||||
|
||||
@@ -35,7 +35,7 @@ export default class Search extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
searchButton() {
|
||||
searchButton = () => {
|
||||
const value = document.getElementById('searchtext').value || 'mue fast';
|
||||
window.location.href = this.state.url + `?${this.state.query}=` + value;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export default class Search extends React.PureComponent {
|
||||
}
|
||||
|
||||
if (localStorage.getItem('voiceSearch') === 'true') {
|
||||
microphone = <MicIcon className='micIcon' onClick={() => this.startSpeechRecognition()}/>;
|
||||
microphone = <MicIcon className='micIcon' onClick={this.startSpeechRecognition}/>;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
@@ -72,7 +72,7 @@ export default class Search extends React.PureComponent {
|
||||
return (
|
||||
<form action={this.state.url} className='searchBar'>
|
||||
{this.state.microphone}
|
||||
<SearchIcon onClick={() => this.searchButton()}/>
|
||||
<SearchIcon onClick={this.searchButton}/>
|
||||
<input type='text' placeholder={this.language} name={this.state.query} id='searchtext'/>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -5,8 +5,8 @@ import Analog from 'react-clock';
|
||||
import './clock.scss';
|
||||
|
||||
export default class Clock extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.timer = undefined;
|
||||
this.state = {
|
||||
|
||||
@@ -3,8 +3,8 @@ import React from 'react';
|
||||
import dtf from '@eartharoid/dtf';
|
||||
|
||||
export default class DateWidget extends React.PureComponent {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
date: ''
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user