feat: Add photo location in photo packs

This commit is contained in:
Vicente
2021-05-01 21:35:41 +01:00
parent e88cd0b765
commit af335adc23

View File

@@ -224,11 +224,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,
photoInfo: {
hidden: false,
credit: randomPhoto.photographer
credit: randomPhoto.photographer,
location: photoLocation !== ' ' && photoLocation !== '???' ? randomPhoto.location : 'N/A',
}
});
}