From e88cd0b7653d5fb2707a0b0b7a955605d1cdc045 Mon Sep 17 00:00:00 2001 From: Vicente <33096355+Vicente015@users.noreply.github.com> Date: Sat, 1 May 2021 21:32:38 +0100 Subject: [PATCH 1/2] fix: remove Unsplash text from photo packs --- src/components/widgets/background/PhotoInformation.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/widgets/background/PhotoInformation.jsx b/src/components/widgets/background/PhotoInformation.jsx index a7e76e52..b781aa3e 100644 --- a/src/components/widgets/background/PhotoInformation.jsx +++ b/src/components/widgets/background/PhotoInformation.jsx @@ -36,7 +36,7 @@ export default function PhotoInformation(props) { let photo = language.credit; // unsplash - if (props.info.photographerURL !== '' && !props.info.offline) { + if (props.info.photographerURL && props.info.photographerURL !== '' && !props.info.offline) { photo = {language.credit}; credit = <>{photographer} {language.unsplash}; } From af335adc238d3bc1262ed9c852862ddb96e51e36 Mon Sep 17 00:00:00 2001 From: Vicente <33096355+Vicente015@users.noreply.github.com> Date: Sat, 1 May 2021 21:35:41 +0100 Subject: [PATCH 2/2] feat: Add photo location in photo packs --- src/components/widgets/background/Background.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index 45a6fc8c..7f6f2fd3 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -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', } }); }