diff --git a/src/components/helpers/sharemodal/ShareModal.jsx b/src/components/helpers/sharemodal/ShareModal.jsx index d199eab4..e9e26347 100644 --- a/src/components/helpers/sharemodal/ShareModal.jsx +++ b/src/components/helpers/sharemodal/ShareModal.jsx @@ -10,8 +10,6 @@ import { toast } from 'react-toastify'; import './sharemodal.scss'; function ShareModal({ modalClose, data }) { - const url = variables.constants.MARKETPLACE_URL + '/share/' + (btoa(data.api_name) || ''); - const copyLink = () => { navigator.clipboard.writeText(data); toast(variables.getMessage('modals.share.copy_link')); diff --git a/src/components/modals/main/marketplace/sections/Create.jsx b/src/components/modals/main/marketplace/sections/Create.jsx index 2a91f0ad..ca22c302 100644 --- a/src/components/modals/main/marketplace/sections/Create.jsx +++ b/src/components/modals/main/marketplace/sections/Create.jsx @@ -78,7 +78,7 @@ export default class Create extends PureComponent { 'birthday', 'location', 'greetingName', - 'backgroundStartTime' + 'backgroundStartTime', ]; Object.keys(data).forEach((key) => { if (ignore.includes(key)) { diff --git a/src/components/modals/main/settings/ChipSelect.jsx b/src/components/modals/main/settings/ChipSelect.jsx index 8d1ff703..ab1a601c 100644 --- a/src/components/modals/main/settings/ChipSelect.jsx +++ b/src/components/modals/main/settings/ChipSelect.jsx @@ -9,22 +9,19 @@ import Select from '@mui/material/Select'; import Chip from '@mui/material/Chip'; function ChipSelect({ label, options, name }) { - let start = (localStorage.getItem('apiCategories') || "").split(','); - if (start[0] === "") start = []; + let start = (localStorage.getItem('apiCategories') || '').split(','); + if (start[0] === '') start = []; const [optionsSelected, setoptionsSelected] = useState(start); - + const handleChange = (event) => { const { target: { value }, } = event; - setoptionsSelected( - typeof value === 'string' ? value.split(',') : value, - ); - localStorage.setItem('apiCategories', value) + setoptionsSelected(typeof value === 'string' ? value.split(',') : value); + localStorage.setItem('apiCategories', value); }; - return (
diff --git a/src/components/modals/main/settings/FileUpload.jsx b/src/components/modals/main/settings/FileUpload.jsx index 24ca2b55..f74d2587 100644 --- a/src/components/modals/main/settings/FileUpload.jsx +++ b/src/components/modals/main/settings/FileUpload.jsx @@ -34,7 +34,7 @@ export default class FileUpload extends PureComponent { compressAccurately(file, { size: 450, - accuracy: 0.9 + accuracy: 0.9, }).then(async (res) => { if (settingsSize + res.size > 4850000) { return toast(variables.getMessage('toasts.no_storage')); diff --git a/src/components/modals/main/settings/sections/Language.jsx b/src/components/modals/main/settings/sections/Language.jsx index 39dc780d..3c560f3f 100644 --- a/src/components/modals/main/settings/sections/Language.jsx +++ b/src/components/modals/main/settings/sections/Language.jsx @@ -76,7 +76,11 @@ export default class LanguageSettings extends PureComponent { {variables.getMessage('modals.main.settings.sections.language.quote')}
- l.name)} category="quote" /> + l.name)} + category="quote" + />
); diff --git a/src/components/modals/main/settings/sections/Overview.jsx b/src/components/modals/main/settings/sections/Overview.jsx index 1c4d1267..084e5914 100644 --- a/src/components/modals/main/settings/sections/Overview.jsx +++ b/src/components/modals/main/settings/sections/Overview.jsx @@ -106,12 +106,15 @@ export default class OrderSettings extends PureComponent { async getNews() { const data = await (await fetch(variables.constants.API_URL + '/news')).json(); - data.date = new window.Date(data.date).toLocaleDateString(variables.languagecode.replace('_', '-'), { - year: 'numeric', - month: 'long', - day: 'numeric', - }); - + data.date = new window.Date(data.date).toLocaleDateString( + variables.languagecode.replace('_', '-'), + { + year: 'numeric', + month: 'long', + day: 'numeric', + }, + ); + this.setState({ news: data, newsDone: true, diff --git a/src/components/modals/main/settings/sections/background/Custom.jsx b/src/components/modals/main/settings/sections/background/Custom.jsx index e254cffe..a6f66419 100644 --- a/src/components/modals/main/settings/sections/background/Custom.jsx +++ b/src/components/modals/main/settings/sections/background/Custom.jsx @@ -164,7 +164,7 @@ export default class CustomSettings extends PureComponent { compressAccurately(file, { size: 450, - accuracy: 0.9 + accuracy: 0.9, }).then(async (res) => { if (settingsSize + res.size > 4850000) { return toast(variables.getMessage('toasts.no_storage')); diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index 89bb3f73..e2008cb1 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -36,9 +36,9 @@ export default class Background extends PureComponent { } async setBackground() { - // clean up the previous image to prevent a memory leak + // clean up the previous image to prevent a memory leak if (this.state.blob) URL.revokeObjectURL(this.state.blob); - + const backgroundImage = document.getElementById('backgroundImage'); if (this.state.url !== '') { @@ -99,7 +99,7 @@ export default class Background extends PureComponent { backgroundExclude = []; } if (currentPun) { - backgroundExclude.push(currentPun) + backgroundExclude.push(currentPun); } let requestURL, data; @@ -194,13 +194,16 @@ export default class Background extends PureComponent { return this.setState(offlineBackground('api')); } - // API background - let data = JSON.parse(localStorage.getItem('nextImage')) || await this.getAPIImageData(); + // API background + let data = JSON.parse(localStorage.getItem('nextImage')) || (await this.getAPIImageData()); localStorage.setItem('nextImage', null); if (data) { this.setState(data); localStorage.setItem('currentBackground', JSON.stringify(data)); - localStorage.setItem('nextImage', JSON.stringify(await this.getAPIImageData(data.photoInfo.pun))); // pre-fetch data about the next image + localStorage.setItem( + 'nextImage', + JSON.stringify(await this.getAPIImageData(data.photoInfo.pun)), + ); // pre-fetch data about the next image } break; diff --git a/src/components/widgets/background/Favourite.jsx b/src/components/widgets/background/Favourite.jsx index 4e1098ea..7a5cab55 100644 --- a/src/components/widgets/background/Favourite.jsx +++ b/src/components/widgets/background/Favourite.jsx @@ -53,10 +53,10 @@ export default class Favourite extends PureComponent { if (url.startsWith('blob:')) { const reader = new FileReader(); - url = await new Promise(async resolve => { + url = await new Promise(async (resolve) => { reader.onloadend = () => resolve(reader.result); reader.readAsDataURL(await (await fetch(url)).blob()); - }) + }); } if (type === 'custom') { diff --git a/src/components/widgets/background/scss/_photoinformation.scss b/src/components/widgets/background/scss/_photoinformation.scss index 268c4c40..2d146c0d 100644 --- a/src/components/widgets/background/scss/_photoinformation.scss +++ b/src/components/widgets/background/scss/_photoinformation.scss @@ -62,20 +62,20 @@ } .mapOn { - width: 100%; - height: 150px; - display: flex; - justify-content: center; - align-items: center; - overflow: hidden; - img { - flex-shrink: 0; - min-width: 100%; - min-height: 100%; - } - svg { - display: none; - } + width: 100%; + height: 150px; + display: flex; + justify-content: center; + align-items: center; + overflow: hidden; + img { + flex-shrink: 0; + min-width: 100%; + min-height: 100%; + } + svg { + display: none; + } } .photoInformation-legacy { @@ -370,4 +370,4 @@ 100% { opacity: 1; } -} \ No newline at end of file +} diff --git a/src/components/widgets/quote/Quote.jsx b/src/components/widgets/quote/Quote.jsx index 35f53b1e..0429d1bc 100644 --- a/src/components/widgets/quote/Quote.jsx +++ b/src/components/widgets/quote/Quote.jsx @@ -272,15 +272,15 @@ export default class Quote extends PureComponent { // First we try and get a quote from the API... try { - let data = JSON.parse(localStorage.getItem('nextQuote')) || await getAPIQuoteData(); + let data = JSON.parse(localStorage.getItem('nextQuote')) || (await getAPIQuoteData()); localStorage.setItem('nextQuote', null); if (data) { this.setState(data); localStorage.setItem('currentQuote', JSON.stringify(data)); localStorage.setItem('nextQuote', JSON.stringify(await getAPIQuoteData())); // pre-fetch data about the next quote } else { - this.doOffline(); - } + this.doOffline(); + } } catch (e) { // ...and if that fails we load one locally this.doOffline(); diff --git a/src/index.jsx b/src/index.jsx index b1b11994..c4cbafca 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -31,6 +31,7 @@ variables.language = new I18n(variables.languagecode, { en_GB: translations.en_GB, en_US: translations.en_US, es: translations.es, + es_419: translations.es_419, fr: translations.fr, nl: translations.nl, no: translations.no, diff --git a/src/modules/helpers/background/avif.js b/src/modules/helpers/background/avif.js index e2074b12..f477446d 100644 --- a/src/modules/helpers/background/avif.js +++ b/src/modules/helpers/background/avif.js @@ -1,8 +1,9 @@ -const testImage = 'AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAFCbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAFBETmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAACRgAAABgAAgAAA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EAAAAAAAAAAQABBQECg4SFAAAA/G1kYXQAAAAASUkqAAgAAAAGABIBAwABAAAAAQAAABoBBQABAAAAVgAAABsBBQABAAAAXgAAACgBAwABAAAAAgAAADEBAgARAAAAZgAAAGmHBAABAAAAeAAAAAAAAAABAAAAAQAAAAEAAAABAAAAcGFpbnQubmV0IDQuMy4xMgAABQAAkAcABAAAADAyMzABoAMAAQAAAAEAAAACoAQAAQAAAAEAAAADoAQAAQAAAAEAAAAFoAQAAQAAALoAAAAAAAAAAgABAAIABAAAAFI5OAACAAcABAAAADAxMDAAAAAAEgAKBxgABpgIaA0yCxJABBEAEADG1FkX'; -export const supportsAVIF = await new Promise(resolve => { +export const supportsAVIF = await new Promise((resolve) => { const image = new Image(); image.src = `data:image/avif;base64,${testImage}`; image.onload = () => resolve(true); image.onerror = () => resolve(false); -}); \ No newline at end of file +}); diff --git a/src/modules/languages.json b/src/modules/languages.json index 66ce1ba3..71557ad0 100644 --- a/src/modules/languages.json +++ b/src/modules/languages.json @@ -15,6 +15,10 @@ "name": "Español", "value": "es" }, + { + "name": "Español (Latinoamérica)", + "value": "es_419" + }, { "name": "Français", "value": "fr" @@ -31,12 +35,12 @@ "name": "Pусский", "value": "ru" }, - { - "name": "中文 (简体)", - "value": "zh_CN" - }, { "name": "Türkçe", "value": "tr_TR" + }, + { + "name": "中文 (简体)", + "value": "zh_CN" } ] diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index c19936fc..47ee7fa0 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -25,7 +25,7 @@ "source": "Source", "category": "Category", "exclude": "Don't show again", - "exclude_confirm": "Are you sure you don't want to see this image again?\nNote: if you don't like \"{category}\" images, you can deselect the category in the background source settings." + "exclude_confirm": "Are you sure you don't want to see this image again?\nNote: if you don't like \"{category}\" images, you can deselect the category in the background source settings." }, "search": "Search", "quicklinks": { diff --git a/src/translations/es-419.json b/src/translations/es_419.json similarity index 100% rename from src/translations/es-419.json rename to src/translations/es_419.json