diff --git a/src/components/modals/main/marketplace/sections/Added.jsx b/src/components/modals/main/marketplace/sections/Added.jsx index fb201864..1945e12d 100644 --- a/src/components/modals/main/marketplace/sections/Added.jsx +++ b/src/components/modals/main/marketplace/sections/Added.jsx @@ -90,6 +90,22 @@ export default class Added extends PureComponent { } } + updateCheck() { + let updates = 0; + this.state.installed.forEach(async (item) => { + const data = await (await fetch('https://marketplace.muetab.com/item/' + item.name)).json(); + if (data.version !== item.version) { + updates++; + } + }); + + if (updates > 0) { + toast('Updates available: ' + updates); + } else { + toast('No updates available'); + } + } + componentDidMount() { this.sortAddons(localStorage.getItem('sortAddons'), false); } @@ -119,6 +135,7 @@ export default class Added extends PureComponent { +
this.toggle('item', input)} /> diff --git a/src/components/modals/main/marketplace/sections/Sideload.jsx b/src/components/modals/main/marketplace/sections/Sideload.jsx index deda6ac4..8e21b04a 100644 --- a/src/components/modals/main/marketplace/sections/Sideload.jsx +++ b/src/components/modals/main/marketplace/sections/Sideload.jsx @@ -53,7 +53,7 @@ export default class Sideload extends PureComponent { this.installAddon(JSON.parse(e.target.result))} />

{window.language.modals.main.addons.sideload}

- + this.setState({ showFailed: false })} isOpen={this.state.showFailed} className='Modal resetmodal mainModal sideloadModal' overlayClassName='Overlay resetoverlay' ariaHideApp={false}> this.setState({ showFailed: false })} reason={this.state.failedReason}/> diff --git a/src/components/modals/main/scss/marketplace/modules/_buttons.scss b/src/components/modals/main/scss/marketplace/modules/_buttons.scss index 09158d61..4b784f63 100644 --- a/src/components/modals/main/scss/marketplace/modules/_buttons.scss +++ b/src/components/modals/main/scss/marketplace/modules/_buttons.scss @@ -61,3 +61,8 @@ button.round { vertical-align: middle; padding: 10px; } + +.updateCheck { + margin-left: 300px; + position: absolute; +} diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index abb2e476..428ee827 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -158,6 +158,8 @@ export default class Background extends PureComponent { photoURL: photoURL, latitude: data.latitude || null, longitude: data.longitude || null, + // location map token from mapbox + maptoken: data.maptoken || null } }; diff --git a/src/components/widgets/background/PhotoInformation.jsx b/src/components/widgets/background/PhotoInformation.jsx index ae2bd98e..316e4ea0 100644 --- a/src/components/widgets/background/PhotoInformation.jsx +++ b/src/components/widgets/background/PhotoInformation.jsx @@ -92,18 +92,29 @@ export default function PhotoInformation({ info, url, api }) { }; const photoMap = () => { - if (localStorage.getItem('photoMap') !== 'true' || info.latitude === null || info.longitude === null) { + if (localStorage.getItem('photoMap') !== 'true' || info.latitude === (null || undefined) || info.longitude === (null || undefined)) { return null; } - const lat = lat2tile(info.latitude, 12); - const lon = lon2tile(info.longitude, 12); - const tile = `https://a.tile.openstreetmap.org/12/${lon}/${lat}.png`; + const zoom = 12; + const lat = lat2tile(info.latitude, zoom); + const lon = lon2tile(info.longitude, zoom); + const tile = `https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/${zoom}/${lon}/${lat}?access_token=${info.maptoken}`; + + let icon = 'https://res.cloudinary.com/mue/image/upload/mapbox/mapbox-logo-dark.png'; + if (document.body.classList.contains('dark')) { + icon = 'https://res.cloudinary.com/mue/image/upload/mapbox/mapbox-logo-white.png'; + } return ( - - location - + + + location + +
+ mapbox logo + © Mapbox, © OpenStreetMap. Improve this map. +
); } diff --git a/src/components/widgets/background/scss/_photoinformation.scss b/src/components/widgets/background/scss/_photoinformation.scss index 5f5b9acb..b717e7a2 100644 --- a/src/components/widgets/background/scss/_photoinformation.scss +++ b/src/components/widgets/background/scss/_photoinformation.scss @@ -55,7 +55,7 @@ padding: 2px; } - img { + .locationMap { height: 100px; object-fit: cover; width: 100%; @@ -63,6 +63,11 @@ background-repeat: no-repeat; } + .mapboxLogo { + height: 20px; + width: auto; + } + span, svg { font-size: 2em; @@ -103,4 +108,8 @@ opacity: 0.8; } } + + .mapCopyright { + font-size: 0.9em; + } } diff --git a/src/modules/helpers/background/widget.js b/src/modules/helpers/background/widget.js index f8a79425..1021d089 100644 --- a/src/modules/helpers/background/widget.js +++ b/src/modules/helpers/background/widget.js @@ -37,7 +37,6 @@ export function gradientStyleBuilder({ type, angle, gradient }) { }; } - // source: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#ECMAScript_.28JavaScript.2FActionScript.2C_etc..29 export function lon2tile(lon, zoom) { return (Math.floor((lon + 180) / 360 * Math.pow(2, zoom)));