diff --git a/src/components/helpers/autocomplete/Autocomplete.jsx b/src/components/helpers/autocomplete/Autocomplete.jsx index 355887a2..154844ab 100644 --- a/src/components/helpers/autocomplete/Autocomplete.jsx +++ b/src/components/helpers/autocomplete/Autocomplete.jsx @@ -2,7 +2,7 @@ import React from 'react'; import './autocomplete.scss'; -export default class Autocomplete extends React.Component { +export default class Autocomplete extends React.PureComponent { constructor(props) { super(props); this.state = { @@ -10,7 +10,7 @@ export default class Autocomplete extends React.Component { showList: false, input: '' }; - this.enabled = (localStorage.getItem('autocomplete') === 'true') + this.enabled = (localStorage.getItem('autocomplete') === 'true'); } onChange = (e) => { diff --git a/src/components/helpers/tooltip/Tooltip.jsx b/src/components/helpers/tooltip/Tooltip.jsx index 261d4a39..e074fd3d 100644 --- a/src/components/helpers/tooltip/Tooltip.jsx +++ b/src/components/helpers/tooltip/Tooltip.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import './tooltip.scss'; export default function Tooltip(props) { diff --git a/src/components/modals/main/marketplace/Items.jsx b/src/components/modals/main/marketplace/Items.jsx index c6637f25..2fe5d437 100644 --- a/src/components/modals/main/marketplace/Items.jsx +++ b/src/components/modals/main/marketplace/Items.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - export default function Items(props) { return (
diff --git a/src/components/modals/main/marketplace/Lightbox.jsx b/src/components/modals/main/marketplace/Lightbox.jsx index d36071ef..2b685158 100644 --- a/src/components/modals/main/marketplace/Lightbox.jsx +++ b/src/components/modals/main/marketplace/Lightbox.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - export default function Lightbox(props) { return ( <> diff --git a/src/components/modals/main/marketplace/sections/Marketplace.jsx b/src/components/modals/main/marketplace/sections/Marketplace.jsx index 4d060cfa..a2e55a06 100644 --- a/src/components/modals/main/marketplace/sections/Marketplace.jsx +++ b/src/components/modals/main/marketplace/sections/Marketplace.jsx @@ -153,6 +153,16 @@ export default class Marketplace extends React.PureComponent { ); }; + const featured = () => { + return ( +
+

{this.state.featured.title}

+

{this.state.featured.name}

+ +
+ ); + } + if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') { return errorMessage(<> @@ -166,11 +176,16 @@ export default class Marketplace extends React.PureComponent { } if (this.state.items.length === 0) { - return errorMessage(<> - -

{window.language.modals.main.addons.empty.title}

-

{this.language.no_items}

- ); + return ( + <> + {featured()} + {errorMessage(<> + +

{window.language.modals.main.addons.empty.title}

+

{this.language.no_items}

+ )} + + ) } if (this.state.item.display_name) { @@ -179,11 +194,7 @@ export default class Marketplace extends React.PureComponent { return ( <> -
-

{this.state.featured.title}

-

{this.state.featured.name}

- -
+ {featured()}
this.sortMarketplace(value)}> diff --git a/src/components/modals/main/settings/ResetModal.jsx b/src/components/modals/main/settings/ResetModal.jsx index 4552344b..6ef66cea 100644 --- a/src/components/modals/main/settings/ResetModal.jsx +++ b/src/components/modals/main/settings/ResetModal.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import SettingsFunctions from '../../../../modules/helpers/settings'; export default function ResetModal(props) { diff --git a/src/components/modals/main/settings/sections/Appearance.jsx b/src/components/modals/main/settings/sections/Appearance.jsx index 17dcc76a..d2daac6c 100644 --- a/src/components/modals/main/settings/sections/Appearance.jsx +++ b/src/components/modals/main/settings/sections/Appearance.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import { engineName } from 'react-device-detect'; import Checkbox from '../Checkbox'; diff --git a/src/components/modals/main/settings/sections/Changelog.jsx b/src/components/modals/main/settings/sections/Changelog.jsx index 61caf976..ba78379f 100644 --- a/src/components/modals/main/settings/sections/Changelog.jsx +++ b/src/components/modals/main/settings/sections/Changelog.jsx @@ -43,7 +43,7 @@ export default class Changelog extends React.PureComponent { const images = content.getElementsByTagName('img'); const links = content.getElementsByTagName('a'); - for (let img of images) { + for (const img of images) { img.draggable = false; img.onclick = () => { this.setState({ diff --git a/src/components/modals/main/settings/sections/Experimental.jsx b/src/components/modals/main/settings/sections/Experimental.jsx index 817b90c9..3f767bac 100644 --- a/src/components/modals/main/settings/sections/Experimental.jsx +++ b/src/components/modals/main/settings/sections/Experimental.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import Checkbox from '../Checkbox'; import Slider from '../Slider'; diff --git a/src/components/modals/main/settings/sections/QuickLinks.jsx b/src/components/modals/main/settings/sections/QuickLinks.jsx index 3850ed46..444604f7 100644 --- a/src/components/modals/main/settings/sections/QuickLinks.jsx +++ b/src/components/modals/main/settings/sections/QuickLinks.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import Switch from '../Switch'; import Checkbox from '../Checkbox'; diff --git a/src/components/modals/main/tabs/Addons.jsx b/src/components/modals/main/tabs/Addons.jsx index 8d2b720c..a36db66a 100644 --- a/src/components/modals/main/tabs/Addons.jsx +++ b/src/components/modals/main/tabs/Addons.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import Added from '../marketplace/sections/Added'; import Sideload from '../marketplace/sections/Sideload'; diff --git a/src/components/modals/main/tabs/Marketplace.jsx b/src/components/modals/main/tabs/Marketplace.jsx index d75cfef7..0f861382 100644 --- a/src/components/modals/main/tabs/Marketplace.jsx +++ b/src/components/modals/main/tabs/Marketplace.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import MarketplaceTab from '../marketplace/sections/Marketplace'; import Tabs from './backend/Tabs'; diff --git a/src/components/modals/main/tabs/Settings.jsx b/src/components/modals/main/tabs/Settings.jsx index d108e9ed..223849b2 100644 --- a/src/components/modals/main/tabs/Settings.jsx +++ b/src/components/modals/main/tabs/Settings.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import About from '../settings/sections/About'; import Language from '../settings/sections/Language'; import Search from '../settings/sections/Search'; diff --git a/src/components/modals/welcome/Welcome.jsx b/src/components/modals/welcome/Welcome.jsx index 754ad18b..9fa5ea69 100644 --- a/src/components/modals/welcome/Welcome.jsx +++ b/src/components/modals/welcome/Welcome.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import EmailIcon from '@material-ui/icons/Email'; import TwitterIcon from '@material-ui/icons/Twitter'; import ForumIcon from '@material-ui/icons/Forum'; diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index 431cd6cd..0974d3d6 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -243,14 +243,13 @@ export default class Background extends React.PureComponent { const photoPack = JSON.parse(localStorage.getItem('photo_packs')); if (photoPack) { const randomPhoto = photoPack[Math.floor(Math.random() * photoPack.length)]; - const photoLocation = randomPhoto.location.replace(/[null]+/g, ''); return this.setState({ url: randomPhoto.url.default, type: 'photo_pack', photoInfo: { hidden: false, credit: randomPhoto.photographer, - location: photoLocation !== ' ' && photoLocation !== '???' ? randomPhoto.location : 'N/A', + location: randomPhoto.location || 'N/A' } }); } diff --git a/src/components/widgets/background/PhotoInformation.jsx b/src/components/widgets/background/PhotoInformation.jsx index a763a828..4609882c 100644 --- a/src/components/widgets/background/PhotoInformation.jsx +++ b/src/components/widgets/background/PhotoInformation.jsx @@ -1,5 +1,3 @@ -import React from 'react'; - import Info from '@material-ui/icons/Info'; import Location from '@material-ui/icons/LocationOn'; import Camera from '@material-ui/icons/PhotoCamera'; diff --git a/src/components/widgets/navbar/Pin.jsx b/src/components/widgets/navbar/Pin.jsx index c0a49095..f525e0a8 100644 --- a/src/components/widgets/navbar/Pin.jsx +++ b/src/components/widgets/navbar/Pin.jsx @@ -14,8 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React from 'react'; - export default function Pin() { return ( diff --git a/src/components/widgets/weather/WeatherIcon.jsx b/src/components/widgets/weather/WeatherIcon.jsx index 96711f9a..8f9e5fc9 100644 --- a/src/components/widgets/weather/WeatherIcon.jsx +++ b/src/components/widgets/weather/WeatherIcon.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import { WiDaySunny, WiNightClear, WiDayCloudy, WiNightCloudy, WiCloud, WiCloudy, WiDayShowers, WiNightShowers, WiRain, WiThunderstorm, WiSnow, WiFog } from 'weather-icons-react'; export default function WeatherIcon(props) { diff --git a/src/components/widgets/weather/WindDirectionIcon.jsx b/src/components/widgets/weather/WindDirectionIcon.jsx index 6837da3f..0754f83b 100644 --- a/src/components/widgets/weather/WindDirectionIcon.jsx +++ b/src/components/widgets/weather/WindDirectionIcon.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import { WiDirectionDownLeft, WiDirectionDownRight, WiDirectionDown, WiDirectionLeft, WiDirectionRight, WiDirectionUpLeft, WiDirectionUpRight, WiDirectionUp } from 'weather-icons-react'; export default function WindDirectionIcon(props) { diff --git a/src/modules/helpers/settings.js b/src/modules/helpers/settings.js index 0b424cfc..4f2f35e0 100644 --- a/src/modules/helpers/settings.js +++ b/src/modules/helpers/settings.js @@ -186,7 +186,7 @@ export default class SettingsFunctions { localStorage.clear(); this.setDefaultSettings(); - Object.keys(settings).forEach(key => { + Object.keys(settings).forEach((key) => { localStorage.setItem(key, settings[key]); }); }