fix: es_419 locale, run prettier, remove unused line

This commit is contained in:
David Ralph 2022-11-26 21:32:50 +00:00 committed by GitHub
parent 8035b35436
commit e161b82ad3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 65 additions and 54 deletions

View File

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

View File

@ -78,7 +78,7 @@ export default class Create extends PureComponent {
'birthday',
'location',
'greetingName',
'backgroundStartTime'
'backgroundStartTime',
];
Object.keys(data).forEach((key) => {
if (ignore.includes(key)) {

View File

@ -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 (
<div>
<FormControl>

View File

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

View File

@ -76,7 +76,11 @@ export default class LanguageSettings extends PureComponent {
{variables.getMessage('modals.main.settings.sections.language.quote')}
</span>
<div className="languageSettings">
<Radio name="quoteLanguage" options={this.state.quoteLanguages.map(l => l.name)} category="quote" />
<Radio
name="quoteLanguage"
options={this.state.quoteLanguages.map((l) => l.name)}
category="quote"
/>
</div>
</>
);

View File

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

View File

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

View File

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

View File

@ -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') {

View File

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

View File

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

View File

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

View File

@ -1,8 +1,9 @@
const testImage = 'AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAAFCbWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAFBETmF2aWYAAAAADnBpdG0AAAAAAAEAAAAsaWxvYwAAAABEAAACAAEAAAABAAACRgAAABgAAgAAAAEAAAFqAAAA3AAAAEFpaW5mAAAAAAACAAAAGmluZmUCAAAAAAEAAGF2MDFDb2xvcgAAAAAZaW5mZQIAAAEAAgAARXhpZkV4aWYAAAAAGmlyZWYAAAAAAAAADmNkc2MAAgABAAEAAAB5aXBycAA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AAQAAAAEAAAABAAAAcGFpbnQubmV0IDQuMy4xMgAABQAAkAcABAAAADAyMzABoAMAAQAAAAEAAAACoAQAAQAAAAEAAAADoAQAAQAAAAEAAAAFoAQAAQAAALoAAAAAAAAAAgABAAIABAAAAFI5OAACAAcABAAAADAxMDAAAAAAEgAKBxgABpgIaA0yCxJABBEAEADG1FkX';
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);
});
});

View File

@ -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"
}
]

View File

@ -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": {