refactor: cleanup

This commit is contained in:
David Ralph
2021-08-15 22:28:37 +01:00
parent 5e4a14ba2c
commit 4f5233fab9
44 changed files with 133 additions and 234 deletions

View File

@@ -1,13 +1,13 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { ToastContainer } from 'react-toastify';
import Background from './components/widgets/background/Background'; import Background from './components/widgets/background/Background';
import Widgets from './components/widgets/Widgets'; import Widgets from './components/widgets/Widgets';
import Modals from './components/modals/Modals'; import Modals from './components/modals/Modals';
import EventBus from './modules/helpers/eventbus';
import { loadSettings, moveSettings } from './modules/helpers/settings'; import { loadSettings, moveSettings } from './modules/helpers/settings';
import { ToastContainer } from 'react-toastify'; import EventBus from './modules/helpers/eventbus';
export default class App extends PureComponent { export default class App extends PureComponent {
componentDidMount() { componentDidMount() {

View File

@@ -1,6 +1,5 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { ErrorOutline } from '@material-ui/icons';
import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';
export default class ErrorBoundary extends PureComponent { export default class ErrorBoundary extends PureComponent {
constructor(props) { constructor(props) {
@@ -24,7 +23,7 @@ export default class ErrorBoundary extends PureComponent {
return ( return (
<div className='emptyitems'> <div className='emptyitems'>
<div className='emptyMessage'> <div className='emptyMessage'>
<ErrorOutlineIcon/> <ErrorOutline/>
<h1>{this.language.title}</h1> <h1>{this.language.title}</h1>
<p>{this.language.message}</p> <p>{this.language.message}</p>
<button className='refresh' onClick={() => window.location.reload()}>{this.language.refresh}</button> <button className='refresh' onClick={() => window.location.reload()}>{this.language.refresh}</button>

View File

@@ -1,12 +1,11 @@
import { PureComponent, Suspense, lazy } from 'react'; import { PureComponent, Suspense, lazy } from 'react';
import Modal from 'react-modal';
import EventBus from '../../modules/helpers/eventbus';
import Main from './main/Main'; import Main from './main/Main';
import Feedback from './feedback/Feedback'; import Feedback from './feedback/Feedback';
import Navbar from '../widgets/navbar/Navbar'; import Navbar from '../widgets/navbar/Navbar';
import Modal from 'react-modal'; import EventBus from '../../modules/helpers/eventbus';
// Welcome modal is lazy loaded as the user won't use it every time they open a tab // Welcome modal is lazy loaded as the user won't use it every time they open a tab
// We used to lazy load the main and feedback modals, but doing so broke the modal open animation on first click // We used to lazy load the main and feedback modals, but doing so broke the modal open animation on first click

View File

@@ -1,11 +1,9 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { ArrowBack } from '@material-ui/icons';
import Modal from 'react-modal'; import Modal from 'react-modal';
import Lightbox from './Lightbox'; import Lightbox from './Lightbox';
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
export default class Item extends PureComponent { export default class Item extends PureComponent {
constructor() { constructor() {
super(); super();
@@ -42,7 +40,7 @@ export default class Item extends PureComponent {
return ( return (
<div id='item'> <div id='item'>
<br/> <br/>
<ArrowBackIcon className='backArrow' onClick={this.props.toggleFunction}/> <ArrowBack className='backArrow' onClick={this.props.toggleFunction}/>
<br/> <br/>
<h1>{this.props.data.display_name}</h1> <h1>{this.props.data.display_name}</h1>
{this.props.button} {this.props.button}

View File

@@ -1,14 +1,13 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { LocalMall } from '@material-ui/icons';
import { toast } from 'react-toastify';
import LocalMallIcon from '@material-ui/icons/LocalMall';
import Item from '../Item'; import Item from '../Item';
import Items from '../Items'; import Items from '../Items';
import Dropdown from '../../settings/Dropdown'; import Dropdown from '../../settings/Dropdown';
import { uninstall, urlParser } from '../../../../../modules/helpers/marketplace'; import { uninstall, urlParser } from '../../../../../modules/helpers/marketplace';
import { toast } from 'react-toastify';
export default class Added extends PureComponent { export default class Added extends PureComponent {
constructor() { constructor() {
super(); super();
@@ -100,7 +99,7 @@ export default class Added extends PureComponent {
return ( return (
<div className='emptyitems'> <div className='emptyitems'>
<div className='emptyMessage'> <div className='emptyMessage'>
<LocalMallIcon/> <LocalMall/>
<h1>{this.language.empty.title}</h1> <h1>{this.language.empty.title}</h1>
<p className='description'>{this.language.empty.description}</p> <p className='description'>{this.language.empty.description}</p>
</div> </div>

View File

@@ -1,13 +1,14 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import {
import FileUpload from '../../settings/FileUpload'; SettingsRounded as Settings,
PhotoOutlined as Photos,
import Settings from '@material-ui/icons/SettingsRounded'; FormatQuoteOutlined as Quotes
import Photos from '@material-ui/icons/PhotoOutlined'; } from '@material-ui/icons';
import Quotes from '@material-ui/icons/FormatQuoteOutlined'; import { toast } from 'react-toastify';
import { saveFile } from '../../../../../modules/helpers/settings/modals'; import { saveFile } from '../../../../../modules/helpers/settings/modals';
import { toast } from 'react-toastify';
import FileUpload from '../../settings/FileUpload';
import '../../../welcome/welcome.scss'; import '../../../welcome/welcome.scss';

View File

@@ -1,7 +1,6 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { toast } from 'react-toastify';
import WifiOffIcon from '@material-ui/icons/WifiOff'; import { WifiOff, LocalMall } from '@material-ui/icons';
import LocalMallIcon from '@material-ui/icons/LocalMall';
import Item from '../Item'; import Item from '../Item';
import Items from '../Items'; import Items from '../Items';
@@ -9,8 +8,6 @@ import Dropdown from '../../settings/Dropdown';
import { install, urlParser, uninstall } from '../../../../../modules/helpers/marketplace'; import { install, urlParser, uninstall } from '../../../../../modules/helpers/marketplace';
import { toast } from 'react-toastify';
export default class Marketplace extends PureComponent { export default class Marketplace extends PureComponent {
constructor() { constructor() {
super(); super();
@@ -178,7 +175,7 @@ export default class Marketplace extends PureComponent {
if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') { if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') {
return errorMessage(<> return errorMessage(<>
<WifiOffIcon/> <WifiOff/>
<h1>{this.language.offline.title}</h1> <h1>{this.language.offline.title}</h1>
<p className='description'>{this.language.offline.description}</p> <p className='description'>{this.language.offline.description}</p>
</>); </>);
@@ -193,7 +190,7 @@ export default class Marketplace extends PureComponent {
<> <>
{featured()} {featured()}
{errorMessage(<> {errorMessage(<>
<LocalMallIcon/> <LocalMall/>
<h1>{window.language.modals.main.addons.empty.title}</h1> <h1>{window.language.modals.main.addons.empty.title}</h1>
<p className='description'>{this.language.no_items}</p> <p className='description'>{this.language.no_items}</p>
</>)} </>)}

View File

@@ -1,9 +1,9 @@
import LocalMallIcon from '@material-ui/icons/LocalMall'; import { LocalMall } from '@material-ui/icons';
import { toast } from 'react-toastify';
import FileUpload from '../../settings/FileUpload'; import FileUpload from '../../settings/FileUpload';
import { install } from '../../../../../modules/helpers/marketplace'; import { install } from '../../../../../modules/helpers/marketplace';
import { toast } from 'react-toastify';
export default function Sideload() { export default function Sideload() {
const installAddon = (input) => { const installAddon = (input) => {
@@ -16,7 +16,7 @@ export default function Sideload() {
<div className='emptyitems'> <div className='emptyitems'>
<div className='emptyMessage'> <div className='emptyMessage'>
<FileUpload id='file-input' type='settings' accept='application/json' loadFunction={(e) => installAddon(JSON.parse(e.target.result))} /> <FileUpload id='file-input' type='settings' accept='application/json' loadFunction={(e) => installAddon(JSON.parse(e.target.result))} />
<LocalMallIcon/> <LocalMall/>
<h1>{window.language.modals.main.addons.sideload}</h1> <h1>{window.language.modals.main.addons.sideload}</h1>
<button className='addToMue sideload' onClick={() => document.getElementById('file-input').click()}>{window.language.modals.main.settings.sections.background.source.upload}</button> <button className='addToMue sideload' onClick={() => document.getElementById('file-input').click()}>{window.language.modals.main.settings.sections.background.source.upload}</button>
</div> </div>

View File

@@ -106,11 +106,6 @@ ul {
} }
} }
.newFeature {
color: #ff4757;
font-size: 12px;
}
.settingsTextarea { .settingsTextarea {
font-family: Consolas !important; font-family: Consolas !important;
padding: 15px; padding: 15px;

View File

@@ -1,10 +1,8 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { Checkbox as CheckboxUI, FormControlLabel } from '@material-ui/core';
import EventBus from '../../../../modules/helpers/eventbus'; import EventBus from '../../../../modules/helpers/eventbus';
import CheckboxUI from '@material-ui/core/Checkbox';
import FormControlLabel from '@material-ui/core/FormControlLabel';
export default class Checkbox extends PureComponent { export default class Checkbox extends PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
@@ -34,19 +32,11 @@ export default class Checkbox extends PureComponent {
} }
render() { render() {
let text = this.props.text;
if (this.props.newFeature) {
text = <>{this.props.text} <span className='newFeature'> NEW</span></>;
} else if (this.props.betaFeature) {
text = <>{this.props.text} <span className='newFeature'> BETA</span></>;
}
return ( return (
<> <>
<FormControlLabel <FormControlLabel
control={<CheckboxUI name={this.props.name} color='primary' className='checkbox' checked={this.state.checked} onChange={this.handleChange} />} control={<CheckboxUI name={this.props.name} color='primary' className='checkbox' checked={this.state.checked} onChange={this.handleChange} />}
label={text} label={this.props.text}
/> />
<br/> <br/>
</> </>

View File

@@ -1,5 +1,4 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
export default class FileUpload extends PureComponent { export default class FileUpload extends PureComponent {

View File

@@ -1,13 +1,8 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { Radio as RadioUI, RadioGroup, FormControlLabel, FormControl, FormLabel } from '@material-ui/core';
import EventBus from '../../../../modules/helpers/eventbus'; 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';
import FormControl from '@material-ui/core/FormControl';
import FormLabel from '@material-ui/core/FormLabel';
export default class Radio extends PureComponent { export default class Radio extends PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);

View File

@@ -1,6 +1,4 @@
import CloseIcon from '@material-ui/icons/Close'; import { Close, Delete } from '@material-ui/icons';
import DeleteIcon from '@material-ui/icons/Delete';
import { setDefaultSettings } from '../../../../modules/helpers/settings'; import { setDefaultSettings } from '../../../../modules/helpers/settings';
export default function ResetModal(props) { export default function ResetModal(props) {
@@ -20,10 +18,10 @@ export default function ResetModal(props) {
<span>{language.information}</span> <span>{language.information}</span>
<div className='resetfooter'> <div className='resetfooter'>
<button className='round reset' style={{ marginLeft: 0 }} onClick={() => reset()}> <button className='round reset' style={{ marginLeft: 0 }} onClick={() => reset()}>
<DeleteIcon/> <Delete/>
</button> </button>
<button className='round import' style={{ marginLeft: '5px' }} onClick={props.modalClose}> <button className='round import' style={{ marginLeft: '5px' }} onClick={props.modalClose}>
<CloseIcon/> <Close/>
</button> </button>
</div> </div>
</> </>

View File

@@ -1,10 +1,9 @@
// todo: find a better method to do width of number input // todo: find a better method to do width of number input
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { toast } from 'react-toastify';
import EventBus from '../../../../modules/helpers/eventbus'; import EventBus from '../../../../modules/helpers/eventbus';
import { toast } from 'react-toastify';
export default class Slider extends PureComponent { export default class Slider extends PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);

View File

@@ -1,10 +1,8 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { Switch as SwitchUI, FormControlLabel } from '@material-ui/core';
import EventBus from '../../../../modules/helpers/eventbus'; import EventBus from '../../../../modules/helpers/eventbus';
import SwitchUI from '@material-ui/core/Switch';
import FormControlLabel from '@material-ui/core/FormControlLabel';
export default class Switch extends PureComponent { export default class Switch extends PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
@@ -34,19 +32,11 @@ export default class Switch extends PureComponent {
} }
render() { render() {
let text = this.props.text;
if (this.props.newFeature) {
text = <>{this.props.text} <span className='newFeature'> NEW</span></>;
} else if (this.props.betaFeature) {
text = <>{this.props.text} <span className='newFeature'> BETA</span></>;
}
return ( return (
<> <>
<FormControlLabel <FormControlLabel
control={<SwitchUI name={this.props.name} color='primary' checked={this.state.checked} onChange={this.handleChange} />} control={<SwitchUI name={this.props.name} color='primary' checked={this.state.checked} onChange={this.handleChange} />}
label={text} label={this.props.text}
labelPlacement='start' labelPlacement='start'
/> />
<br/> <br/>

View File

@@ -1,9 +1,8 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { toast } from 'react-toastify';
import EventBus from '../../../../modules/helpers/eventbus'; import EventBus from '../../../../modules/helpers/eventbus';
import { toast } from 'react-toastify';
export default class Text extends PureComponent { export default class Text extends PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);

View File

@@ -1,11 +1,7 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { Email, Twitter, Chat, Instagram, Facebook } from '@material-ui/icons';
import Tooltip from '../../../../helpers/tooltip/Tooltip'; import Tooltip from '../../../../helpers/tooltip/Tooltip';
import EmailIcon from '@material-ui/icons/Email';
import TwitterIcon from '@material-ui/icons/Twitter';
import ChatIcon from '@material-ui/icons/Chat';
import InstagramIcon from '@material-ui/icons/Instagram';
import FacebookIcon from '@material-ui/icons/Facebook';
const other_contributors = require('../../../../../modules/other_contributors.json'); const other_contributors = require('../../../../../modules/other_contributors.json');
@@ -94,11 +90,11 @@ export default class About extends PureComponent {
<a href={window.constants.PRIVACY_URL} className='aboutLink' target='_blank' rel='noopener noreferrer' style={{ fontSize: '1rem' }}>{window.language.modals.welcome.sections.privacy.links.privacy_policy}</a> <a href={window.constants.PRIVACY_URL} className='aboutLink' target='_blank' rel='noopener noreferrer' style={{ fontSize: '1rem' }}>{window.language.modals.welcome.sections.privacy.links.privacy_policy}</a>
<h3>{this.language.contact_us}</h3> <h3>{this.language.contact_us}</h3>
<a href={'mailto:' + window.constants.EMAIL} className='aboutIcon' target='_blank' rel='noopener noreferrer'><EmailIcon/></a> <a href={'mailto:' + window.constants.EMAIL} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Email/></a>
<a href={'https://twitter.com/' + window.constants.TWITTER_HANDLE} className='aboutIcon' target='_blank' rel='noopener noreferrer'><TwitterIcon/></a> <a href={'https://twitter.com/' + window.constants.TWITTER_HANDLE} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Twitter/></a>
<a href={'https://instagram.com/' + window.constants.INSTAGRAM_HANDLE} className='aboutIcon' target='_blank' rel='noopener noreferrer'><InstagramIcon/></a> <a href={'https://instagram.com/' + window.constants.INSTAGRAM_HANDLE} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Instagram/></a>
<a href={'https://facebook.com/' + window.constants.FACEBOOK_HANDLE} className='aboutIcon' target='_blank' rel='noopener noreferrer'><FacebookIcon/></a> <a href={'https://facebook.com/' + window.constants.FACEBOOK_HANDLE} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Facebook/></a>
<a href={'https://discord.gg/' + window.constants.DISCORD_SERVER} className='aboutIcon' target='_blank' rel='noopener noreferrer'><ChatIcon/></a> <a href={'https://discord.gg/' + window.constants.DISCORD_SERVER} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Chat/></a>
<h3>{this.language.support_mue}</h3> <h3>{this.language.support_mue}</h3>
<p> <p>

View File

@@ -1,4 +1,7 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import Modal from 'react-modal';
import { exportSettings, importSettings } from '../../../../../modules/helpers/settings/modals';
import Checkbox from '../Checkbox'; import Checkbox from '../Checkbox';
import FileUpload from '../FileUpload'; import FileUpload from '../FileUpload';
@@ -7,10 +10,6 @@ import Switch from '../Switch';
import ResetModal from '../ResetModal'; import ResetModal from '../ResetModal';
import Dropdown from '../Dropdown'; import Dropdown from '../Dropdown';
import { exportSettings, importSettings } from '../../../../../modules/helpers/settings/modals';
import Modal from 'react-modal';
const time_zones = require('../../../../widgets/time/timezones.json'); const time_zones = require('../../../../widgets/time/timezones.json');
export default class AdvancedSettings extends PureComponent { export default class AdvancedSettings extends PureComponent {

View File

@@ -1,11 +1,9 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { WifiOff } from '@material-ui/icons';
import Modal from 'react-modal'; import Modal from 'react-modal';
import Lightbox from '../../marketplace/Lightbox'; import Lightbox from '../../marketplace/Lightbox';
import WifiOffIcon from '@material-ui/icons/WifiOff';
export default class Changelog extends PureComponent { export default class Changelog extends PureComponent {
constructor() { constructor() {
super(); super();
@@ -89,7 +87,7 @@ export default class Changelog extends PureComponent {
const language = window.language.modals.main.marketplace; const language = window.language.modals.main.marketplace;
return errorMessage(<> return errorMessage(<>
<WifiOffIcon/> <WifiOff/>
<h1>{language.offline.title}</h1> <h1>{language.offline.title}</h1>
<p className='description'>{language.offline.description}</p> <p className='description'>{language.offline.description}</p>
</>); </>);

View File

@@ -1,5 +1,6 @@
import Checkbox from '../Checkbox'; import Checkbox from '../Checkbox';
import Slider from '../Slider'; import Slider from '../Slider';
import EventBus from '../../../../../modules/helpers/eventbus'; import EventBus from '../../../../../modules/helpers/eventbus';
export default function ExperimentalSettings() { export default function ExperimentalSettings() {

View File

@@ -1,12 +1,10 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { DragIndicator } from '@material-ui/icons';
import EventBus from '../../../../../modules/helpers/eventbus';
import DragHandleIcon from '@material-ui/icons/DragIndicator';
import { sortableContainer, sortableElement } from 'react-sortable-hoc'; import { sortableContainer, sortableElement } from 'react-sortable-hoc';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import EventBus from '../../../../../modules/helpers/eventbus';
const enabled = (setting) => { const enabled = (setting) => {
switch (setting) { switch (setting) {
case 'quicklinks': case 'quicklinks':
@@ -27,7 +25,7 @@ const widget_name = {
const SortableItem = sortableElement(({ value }) => ( const SortableItem = sortableElement(({ value }) => (
<li className='sortableitem' style={{ display: enabled(value) ? 'block' : 'none' }}> <li className='sortableitem' style={{ display: enabled(value) ? 'block' : 'none' }}>
<DragHandleIcon style={{ verticalAlign: 'middle' }} /> <DragIndicator style={{ verticalAlign: 'middle' }} />
{widget_name[value]} {widget_name[value]}
</li> </li>
)); ));

View File

@@ -1,4 +1,5 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { toast } from 'react-toastify';
import Dropdown from '../Dropdown'; import Dropdown from '../Dropdown';
import Checkbox from '../Checkbox'; import Checkbox from '../Checkbox';
@@ -7,8 +8,6 @@ import Radio from '../Radio';
import EventBus from '../../../../../modules/helpers/eventbus'; import EventBus from '../../../../../modules/helpers/eventbus';
import { toast } from 'react-toastify';
const searchEngines = require('../../../../widgets/search/search_engines.json'); const searchEngines = require('../../../../widgets/search/search_engines.json');
const autocompleteProviders = require('../../../../widgets/search/autocomplete_providers.json'); const autocompleteProviders = require('../../../../widgets/search/autocomplete_providers.json');

View File

@@ -1,6 +1,5 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { toast } from 'react-toastify';
import EventBus from '../../../../../../modules/helpers/eventbus';
import Checkbox from '../../Checkbox'; import Checkbox from '../../Checkbox';
import Dropdown from '../../Dropdown'; import Dropdown from '../../Dropdown';
@@ -11,7 +10,7 @@ import Radio from '../../Radio';
import ColourSettings from './Colour'; import ColourSettings from './Colour';
import { toast } from 'react-toastify'; import EventBus from '../../../../../../modules/helpers/eventbus';
export default class BackgroundSettings extends PureComponent { export default class BackgroundSettings extends PureComponent {
constructor() { constructor() {

View File

@@ -1,12 +1,10 @@
import { PureComponent, Fragment } from 'react'; import { PureComponent, Fragment } from 'react';
import { ColorPicker } from 'react-color-gradient-picker'; import { ColorPicker } from 'react-color-gradient-picker';
import { toast } from 'react-toastify';
import hexToRgb from '../../../../../../modules/helpers/background/hexToRgb'; import hexToRgb from '../../../../../../modules/helpers/background/hexToRgb';
import rgbToHex from '../../../../../../modules/helpers/background/rgbToHex'; import rgbToHex from '../../../../../../modules/helpers/background/rgbToHex';
import { toast } from 'react-toastify';
import 'react-color-gradient-picker/dist/index.css'; import 'react-color-gradient-picker/dist/index.css';
import '../../../scss/settings/react-color-picker-gradient-picker-custom-styles.scss'; import '../../../scss/settings/react-color-picker-gradient-picker-custom-styles.scss';

View File

@@ -1,9 +1,9 @@
import Tabs from './backend/Tabs';
import Added from '../marketplace/sections/Added'; import Added from '../marketplace/sections/Added';
import Sideload from '../marketplace/sections/Sideload'; import Sideload from '../marketplace/sections/Sideload';
import Create from '../marketplace/sections/Create'; import Create from '../marketplace/sections/Create';
import Tabs from './backend/Tabs';
export default function Addons() { export default function Addons() {
const addons = window.language.modals.main.addons; const addons = window.language.modals.main.addons;

View File

@@ -1,7 +1,7 @@
import MarketplaceTab from '../marketplace/sections/Marketplace';
import Tabs from './backend/Tabs'; import Tabs from './backend/Tabs';
import MarketplaceTab from '../marketplace/sections/Marketplace';
export default function Marketplace() { export default function Marketplace() {
const marketplace = window.language.modals.main.marketplace; const marketplace = window.language.modals.main.marketplace;

View File

@@ -1,3 +1,5 @@
import Tabs from './backend/Tabs';
import About from '../settings/sections/About'; import About from '../settings/sections/About';
import Language from '../settings/sections/Language'; import Language from '../settings/sections/Language';
import Search from '../settings/sections/Search'; import Search from '../settings/sections/Search';
@@ -14,8 +16,6 @@ import QuickLinks from '../settings/sections/QuickLinks';
import Weather from '../settings/sections/Weather'; import Weather from '../settings/sections/Weather';
import Stats from '../settings/sections/Stats'; import Stats from '../settings/sections/Stats';
import Tabs from './backend/Tabs';
export default function Settings() { export default function Settings() {
const { reminder, sections } = window.language.modals.main.settings; const { reminder, sections } = window.language.modals.main.settings;
const display = (localStorage.getItem('showReminder') === 'true') ? 'block' : 'none'; const display = (localStorage.getItem('showReminder') === 'true') ? 'block' : 'none';

View File

@@ -1,31 +1,27 @@
import { memo } from 'react'; import { memo } from 'react';
import {
// Navbar SettingsRounded as Settings,
import Settings from '@material-ui/icons/SettingsRounded'; Widgets as Addons,
import Addons from '@material-ui/icons/Widgets'; ShoppingBasket as Marketplace,
import Marketplace from '@material-ui/icons/ShoppingBasket'; AccessAlarm as Time,
EmojiPeopleOutlined as Greeting,
// Settings FormatQuoteOutlined as Quote,
import Time from '@material-ui/icons/AccessAlarm'; PhotoOutlined as Background,
import Greeting from '@material-ui/icons/EmojiPeopleOutlined'; Search,
import Quote from '@material-ui/icons/FormatQuoteOutlined'; FormatPaintOutlined as Appearance,
import Background from '@material-ui/icons/PhotoOutlined'; Translate as Language,
import Search from '@material-ui/icons/Search'; NewReleasesOutlined as Changelog,
import Appearance from '@material-ui/icons/FormatPaintOutlined'; InfoOutlined as About,
import Language from '@material-ui/icons/Translate'; BugReportOutlined as Experimental,
import Changelog from '@material-ui/icons/NewReleasesOutlined'; List as Order,
import About from '@material-ui/icons/InfoOutlined'; CloudOutlined as Weather,
import Experimental from '@material-ui/icons/BugReportOutlined'; SettingsOutlined as Advanced,
import Order from '@material-ui/icons/List'; Link as QuickLinks,
import Weather from '@material-ui/icons/CloudOutlined'; AssessmentOutlined as Stats,
import Advanced from '@material-ui/icons/SettingsOutlined'; Code as Sideload,
import QuickLinks from '@material-ui/icons/Link'; AddCircleOutline as Added,
import Stats from '@material-ui/icons/AssessmentOutlined'; CreateNewFolderOutlined as Create
} from '@material-ui/icons';
// Addons
import Sideload from '@material-ui/icons/Code';
import Added from '@material-ui/icons/AddCircleOutline';
import Create from '@material-ui/icons/CreateNewFolderOutlined';
function Tab(props) { function Tab(props) {
let className = 'tab-list-item'; let className = 'tab-list-item';

View File

@@ -1,14 +1,10 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { CloudUpload, AutoAwesome, LightMode, DarkMode } from '@material-ui/icons';
import Radio from '../main/settings/Radio'; import Radio from '../main/settings/Radio';
import Checkbox from '../main/settings/Checkbox'; import Checkbox from '../main/settings/Checkbox';
import FileUpload from '../main/settings/FileUpload'; import FileUpload from '../main/settings/FileUpload';
import UploadIcon from '@material-ui/icons/CloudUpload';
import AutoIcon from '@material-ui/icons/AutoAwesome';
import LightModeIcon from '@material-ui/icons/LightMode';
import DarkModeIcon from '@material-ui/icons/DarkMode';
import { loadSettings } from '../../../modules/helpers/settings'; import { loadSettings } from '../../../modules/helpers/settings';
import { importSettings } from '../../../modules/helpers/settings/modals'; import { importSettings } from '../../../modules/helpers/settings/modals';
@@ -139,16 +135,16 @@ export default class WelcomeSections extends PureComponent {
<p>{language.sections.theme.description}</p> <p>{language.sections.theme.description}</p>
<div className='themesToggleArea'> <div className='themesToggleArea'>
<div className={this.state.autoClass} onClick={() => this.changeTheme('auto')}> <div className={this.state.autoClass} onClick={() => this.changeTheme('auto')}>
<AutoIcon/> <AutoAwesome/>
<span>{appearance.theme.auto}</span> <span>{appearance.theme.auto}</span>
</div> </div>
<div className='options'> <div className='options'>
<div className={this.state.lightClass} onClick={() => this.changeTheme('light')}> <div className={this.state.lightClass} onClick={() => this.changeTheme('light')}>
<LightModeIcon/> <LightMode/>
<span>{appearance.theme.light}</span> <span>{appearance.theme.light}</span>
</div> </div>
<div className={this.state.darkClass} onClick={() => this.changeTheme('dark')}> <div className={this.state.darkClass} onClick={() => this.changeTheme('dark')}>
<DarkModeIcon/> <DarkMode/>
<span>{appearance.theme.dark}</span> <span>{appearance.theme.dark}</span>
</div> </div>
</div> </div>
@@ -163,7 +159,7 @@ export default class WelcomeSections extends PureComponent {
<h1>{language.sections.settings.title}</h1> <h1>{language.sections.settings.title}</h1>
<p>{language.sections.settings.description}</p> <p>{language.sections.settings.description}</p>
<button className='upload' onClick={() => document.getElementById('file-input').click()}> <button className='upload' onClick={() => document.getElementById('file-input').click()}>
<UploadIcon/> <CloudUpload/>
<br/> <br/>
<span>{window.language.modals.main.settings.buttons.import}</span> <span>{window.language.modals.main.settings.buttons.import}</span>
</button> </button>

View File

@@ -1,7 +1,5 @@
import { PureComponent, Fragment, Suspense, lazy } from 'react'; import { PureComponent, Fragment, Suspense, lazy } from 'react';
import EventBus from '../../modules/helpers/eventbus';
import Clock from './time/Clock'; import Clock from './time/Clock';
import Greeting from './greeting/Greeting'; import Greeting from './greeting/Greeting';
import Quote from './quote/Quote'; import Quote from './quote/Quote';
@@ -9,6 +7,8 @@ import Search from './search/Search';
import QuickLinks from './quicklinks/QuickLinks'; import QuickLinks from './quicklinks/QuickLinks';
import Date from './time/Date'; import Date from './time/Date';
import EventBus from '../../modules/helpers/eventbus';
const Weather = lazy(() => import('./weather/Weather')); const Weather = lazy(() => import('./weather/Weather'));
const renderLoader = () => <></>; const renderLoader = () => <></>;

View File

@@ -1,11 +1,11 @@
// todo: rewrite this mess // todo: rewrite this mess
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import PhotoInformation from './PhotoInformation';
import EventBus from '../../../modules/helpers/eventbus'; import EventBus from '../../../modules/helpers/eventbus';
import Interval from '../../../modules/helpers/interval'; import Interval from '../../../modules/helpers/interval';
import PhotoInformation from './PhotoInformation';
import './scss/index.scss'; import './scss/index.scss';
export default class Background extends PureComponent { export default class Background extends PureComponent {

View File

@@ -1,14 +1,12 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { Star, StarBorder } from '@material-ui/icons';
import Tooltip from '../../helpers/tooltip/Tooltip'; import Tooltip from '../../helpers/tooltip/Tooltip';
import StarIcon from '@material-ui/icons/Star';
import StarIcon2 from '@material-ui/icons/StarBorder';
export default class Favourite extends PureComponent { export default class Favourite extends PureComponent {
buttons = { buttons = {
favourited: <StarIcon onClick={() => this.favourite()} className='topicons' />, favourited: <Star onClick={() => this.favourite()} className='topicons' />,
unfavourited: <StarIcon2 onClick={() => this.favourite()} className='topicons' /> unfavourited: <StarBorder onClick={() => this.favourite()} className='topicons' />
} }
constructor() { constructor() {

View File

@@ -1,9 +1,8 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { Fullscreen } from '@material-ui/icons';
import Tooltip from '../../helpers/tooltip/Tooltip'; import Tooltip from '../../helpers/tooltip/Tooltip';
import FullscreenIcon from '@material-ui/icons/Fullscreen';
export default class Maximise extends PureComponent { export default class Maximise extends PureComponent {
constructor() { constructor() {
super(); super();
@@ -57,7 +56,7 @@ export default class Maximise extends PureComponent {
render() { render() {
return ( return (
<Tooltip title={window.language.modals.main.settings.sections.background.buttons.view}> <Tooltip title={window.language.modals.main.settings.sections.background.buttons.view}>
<FullscreenIcon onClick={this.maximise} className='topicons' /> <Fullscreen onClick={this.maximise} className='topicons' />
</Tooltip> </Tooltip>
); );
} }

View File

@@ -1,11 +1,5 @@
import { useState } from 'react'; import { useState } from 'react';
import { Info, LocationOn, PhotoCamera, Crop as Resolution, Person as Photographer, GetApp as Download } from '@material-ui/icons';
import Info from '@material-ui/icons/Info';
import Location from '@material-ui/icons/LocationOn';
import Camera from '@material-ui/icons/PhotoCamera';
import Resolution from '@material-ui/icons/Crop';
import Photographer from '@material-ui/icons/Person';
import Download from '@material-ui/icons/GetApp';
const toDataURL = async (url) => { const toDataURL = async (url) => {
const res = await fetch(url); const res = await fetch(url);
@@ -68,9 +62,9 @@ export default function PhotoInformation(props) {
<Info className='infoIcon'/> <Info className='infoIcon'/>
<h1>{language.information}</h1> <h1>{language.information}</h1>
<hr/> <hr/>
<Location/> <LocationOn/>
<span id='infoLocation'>{props.info.location || 'N/A'}</span> <span id='infoLocation'>{props.info.location || 'N/A'}</span>
<Camera/> <PhotoCamera/>
<span id='infoCamera'>{props.info.camera || 'N/A'}</span> <span id='infoCamera'>{props.info.camera || 'N/A'}</span>
<Resolution/> <Resolution/>
<span id='infoResolution'>{width}x{height}</span> <span id='infoResolution'>{width}x{height}</span>

View File

@@ -1,9 +1,8 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { utcToZonedTime } from 'date-fns-tz'; import { utcToZonedTime } from 'date-fns-tz';
import EventBus from '../../../modules/helpers/eventbus';
import dtf from '../../../modules/helpers/date'; import dtf from '../../../modules/helpers/date';
import EventBus from '../../../modules/helpers/eventbus';
import './greeting.scss'; import './greeting.scss';

View File

@@ -1,9 +1,5 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { RefreshRounded, SettingsRounded, AssignmentRounded as NotesRounded, SmsFailed as Report } from '@material-ui/icons';
import RefreshIcon from '@material-ui/icons/RefreshRounded';
import Gear from '@material-ui/icons/SettingsRounded';
import NotesIcon from '@material-ui/icons/AssignmentRounded';
import Report from '@material-ui/icons/SmsFailed';
import Notes from './Notes'; import Notes from './Notes';
import Maximise from '../background/Maximise'; import Maximise from '../background/Maximise';
@@ -33,7 +29,7 @@ export default class Navbar extends PureComponent {
{(localStorage.getItem('notesEnabled') === 'true') ? {(localStorage.getItem('notesEnabled') === 'true') ?
<div className='notes'> <div className='notes'>
<NotesIcon className='topicons'/> <NotesRounded className='topicons'/>
<Notes/> <Notes/>
</div> </div>
: null} : null}
@@ -46,12 +42,12 @@ export default class Navbar extends PureComponent {
{(localStorage.getItem('refresh') === 'true') ? {(localStorage.getItem('refresh') === 'true') ?
<Tooltip title={window.language.widgets.navbar.tooltips.refresh}> <Tooltip title={window.language.widgets.navbar.tooltips.refresh}>
<RefreshIcon className='refreshicon topicons' onClick={() => window.location.reload()}/> <RefreshRounded className='refreshicon topicons' onClick={() => window.location.reload()}/>
</Tooltip> </Tooltip>
: null} : null}
<Tooltip title={window.language.modals.main.navbar.settings}> <Tooltip title={window.language.modals.main.navbar.settings}>
<Gear className='settings-icon topicons' onClick={() => this.props.openModal('mainModal')}/> <SettingsRounded className='settings-icon topicons' onClick={() => this.props.openModal('mainModal')}/>
</Tooltip> </Tooltip>
</div> </div>
); );

View File

@@ -1,11 +1,6 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { FileCopyRounded, AssignmentRounded as NotesRounded, PushPin }from '@material-ui/icons';
import TextareaAutosize from '@material-ui/core/TextareaAutosize'; import TextareaAutosize from '@material-ui/core/TextareaAutosize';
import CopyIcon from '@material-ui/icons/FileCopyRounded';
import NotesIcon from '@material-ui/icons/AssignmentRounded';
import Pin from '@material-ui/icons/PushPin';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
export default class Notes extends PureComponent { export default class Notes extends PureComponent {
@@ -57,12 +52,12 @@ export default class Notes extends PureComponent {
return ( return (
<span id='noteContainer' className='notescontainer' style={{ visibility: this.state.visibility }}> <span id='noteContainer' className='notescontainer' style={{ visibility: this.state.visibility }}>
<div className='topbarnotes'> <div className='topbarnotes'>
<NotesIcon/> <NotesRounded/>
<h3>{this.language.title}</h3> <h3>{this.language.title}</h3>
</div> </div>
<TextareaAutosize rowsmax={50} placeholder={this.language.placeholder} value={this.state.notes} onChange={this.setNotes}/> <TextareaAutosize rowsmax={50} placeholder={this.language.placeholder} value={this.state.notes} onChange={this.setNotes}/>
<button onClick={() => this.pin()} className='pinNote'><Pin/></button> <button onClick={() => this.pin()} className='pinNote'><PushPin/></button>
<button onClick={() => this.copy()} className='copyNote'><CopyIcon/></button> <button onClick={() => this.copy()} className='copyNote'><FileCopyRounded/></button>
</span> </span>
); );
} }

View File

@@ -1,10 +1,9 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import Tooltip from '../../helpers/tooltip/Tooltip';
import { TextareaAutosize } from '@material-ui/core';
import EventBus from '../../../modules/helpers/eventbus'; import EventBus from '../../../modules/helpers/eventbus';
import Tooltip from '../../helpers/tooltip/Tooltip';
import TextareaAutosize from '@material-ui/core/TextareaAutosize';
import './quicklinks.scss'; import './quicklinks.scss';
export default class QuickLinks extends PureComponent { export default class QuickLinks extends PureComponent {
@@ -88,15 +87,9 @@ export default class QuickLinks extends PureComponent {
} }
toggleAdd = () => { toggleAdd = () => {
if (this.state.showAddLink === 'hidden') { this.setState({
this.setState({ showAddLink: (this.state.showAddLink === 'hidden') ? 'visible' : 'hidden'
showAddLink: 'visible' });
});
} else {
this.setState({
showAddLink: 'hidden'
});
}
} }
// widget zoom // widget zoom
@@ -154,9 +147,9 @@ export default class QuickLinks extends PureComponent {
} }
const tooltipEnabled = localStorage.getItem('quicklinkstooltip'); const tooltipEnabled = localStorage.getItem('quicklinkstooltip');
const useProxy = (localStorage.getItem('quicklinksddgProxy') !== 'false');
const quickLink = (item) => { const quickLink = (item) => {
const useProxy = (localStorage.getItem('quicklinksddgProxy') !== 'false');
const url = useProxy ? 'https://icons.duckduckgo.com/ip2/' : 'https://www.google.com/s2/favicons?sz=32&domain='; const url = useProxy ? 'https://icons.duckduckgo.com/ip2/' : 'https://www.google.com/s2/favicons?sz=32&domain=';
const link = ( const link = (
@@ -166,7 +159,7 @@ export default class QuickLinks extends PureComponent {
); );
if (tooltipEnabled === 'true') { if (tooltipEnabled === 'true') {
return <Tooltip title={item.name} key={item.name} draggable={false}>{link}</Tooltip>; return <Tooltip title={item.name}>{link}</Tooltip>;
} else { } else {
return link; return link;
} }

View File

@@ -1,23 +1,18 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { FilterNone as FileCopy, Twitter, Star, StarBorder } from '@material-ui/icons';
import EventBus from '../../../modules/helpers/eventbus';
import Interval from '../../../modules/helpers/interval';
import FileCopy from '@material-ui/icons/FilterNone';
import TwitterIcon from '@material-ui/icons/Twitter';
import StarIcon from '@material-ui/icons/Star';
import StarIcon2 from '@material-ui/icons/StarBorder';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import Interval from '../../../modules/helpers/interval';
import EventBus from '../../../modules/helpers/eventbus';
import './quote.scss'; import './quote.scss';
export default class Quote extends PureComponent { export default class Quote extends PureComponent {
buttons = { buttons = {
tweet: <TwitterIcon className='copyButton' onClick={() => this.tweetQuote()} />, tweet: <Twitter className='copyButton' onClick={() => this.tweetQuote()} />,
copy: <FileCopy className='copyButton' onClick={() => this.copyQuote()} />, copy: <FileCopy className='copyButton' onClick={() => this.copyQuote()} />,
unfavourited: <StarIcon2 className='copyButton' onClick={() => this.favourite()} />, unfavourited: <StarBorder className='copyButton' onClick={() => this.favourite()} />,
favourited: <StarIcon className='copyButton' onClick={() => this.favourite()} /> favourited: <Star className='copyButton' onClick={() => this.favourite()} />
} }
constructor() { constructor() {

View File

@@ -1,11 +1,9 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { Search as SearchIcon, Mic } from '@material-ui/icons';
import EventBus from '../../../modules/helpers/eventbus';
import AutocompleteInput from '../../helpers/autocomplete/Autocomplete'; import AutocompleteInput from '../../helpers/autocomplete/Autocomplete';
import SearchIcon from '@material-ui/icons/Search'; import EventBus from '../../../modules/helpers/eventbus';
import MicIcon from '@material-ui/icons/Mic';
import './search.scss'; import './search.scss';
@@ -101,7 +99,7 @@ export default class Search extends PureComponent {
} }
if (localStorage.getItem('voiceSearch') === 'true') { if (localStorage.getItem('voiceSearch') === 'true') {
microphone = <MicIcon className='micIcon' onClick={this.startSpeechRecognition}/>; microphone = <Mic className='micIcon' onClick={this.startSpeechRecognition}/>;
} }
let autocompleteURL, autocompleteQuery, autocompleteCallback; let autocompleteURL, autocompleteQuery, autocompleteCallback;

View File

@@ -1,6 +1,6 @@
import { PureComponent, Suspense, lazy } from 'react'; import { PureComponent, Suspense, lazy } from 'react';
import { utcToZonedTime } from 'date-fns-tz'; import { utcToZonedTime } from 'date-fns-tz';
import EventBus from '../../../modules/helpers/eventbus'; import EventBus from '../../../modules/helpers/eventbus';
import './clock.scss'; import './clock.scss';

View File

@@ -1,9 +1,8 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { utcToZonedTime } from 'date-fns-tz'; import { utcToZonedTime } from 'date-fns-tz';
import EventBus from '../../../modules/helpers/eventbus';
import dtf from '../../../modules/helpers/date'; import dtf from '../../../modules/helpers/date';
import EventBus from '../../../modules/helpers/eventbus';
import './date.scss'; import './date.scss';

View File

@@ -1,10 +1,10 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import { WiHumidity, WiWindy, WiBarometer, WiCloud } from 'weather-icons-react';
import EventBus from '../../../modules/helpers/eventbus';
import WeatherIcon from './WeatherIcon'; import WeatherIcon from './WeatherIcon';
import WindDirectionIcon from './WindDirectionIcon'; import WindDirectionIcon from './WindDirectionIcon';
import { WiHumidity, WiWindy, WiBarometer, WiCloud } from 'weather-icons-react';
import EventBus from '../../../modules/helpers/eventbus';
import './weather.scss'; import './weather.scss';
@@ -133,10 +133,6 @@ export default class Weather extends PureComponent {
return (localStorage.getItem(setting) === 'true'); return (localStorage.getItem(setting) === 'true');
}; };
if (enabled('offlineMode')) {
return null;
}
if (this.state.location === window.language.widgets.weather.not_found) { if (this.state.location === window.language.widgets.weather.not_found) {
return (<div className='weather'> return (<div className='weather'>
<span className='loc'>{this.state.location}</span> <span className='loc'>{this.state.location}</span>

View File

@@ -20,7 +20,6 @@ if (languagecode === 'en') {
window.languagecode = 'en_GB'; window.languagecode = 'en_GB';
} }
// these are merged so if a string is untranslated it doesn't break mue
window.language = require(`./translations/${window.languagecode}.json`); window.language = require(`./translations/${window.languagecode}.json`);
// set html language tag // set html language tag