refactor: cleanup

This commit is contained in:
David Ralph
2021-03-23 13:10:34 +00:00
parent b4e1d00633
commit b773f256a4
33 changed files with 110 additions and 336 deletions

View File

@@ -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,

View File

@@ -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: '',

View File

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

View File

@@ -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
};

View File

@@ -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: ''
};

View File

@@ -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') || ''
};

View File

@@ -11,8 +11,8 @@ import './quote.scss';
export default class Quote extends React.PureComponent {
constructor(...args) {
super(...args);
constructor() {
super();
this.state = {
quote: '',
author: '',

View File

@@ -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>
);

View File

@@ -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 = {

View File

@@ -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: ''
};