style: code changes etc

This commit is contained in:
David Ralph
2021-05-05 15:44:39 +01:00
parent fa19570c36
commit 260d1928d8
2 changed files with 15 additions and 10 deletions

View File

@@ -25,14 +25,14 @@ const widget_name = {
date: settings.time.date.title
};
const SortableItem = sortableElement(({value}) => (
const SortableItem = sortableElement(({ value }) => (
<li className='sortableitem' style={{ display: enabled(value) ? 'block' : 'none' }}>
<DragHandleIcon style={{'verticalAlign': 'middle'}} />
{widget_name[value]}
</li>
));
const SortableContainer = sortableContainer(({children}) => {
const SortableContainer = sortableContainer(({ children }) => {
return <ul className='sortablecontainer'>{children}</ul>;
});
@@ -65,10 +65,10 @@ export default class OrderSettings extends React.PureComponent {
return newArray;
}
onSortEnd = ({oldIndex, newIndex}) => {
this.setState(({items}) => ({
items: this.arrayMove(items, oldIndex, newIndex)
}));
onSortEnd = ({ oldIndex, newIndex }) => {
this.setState({
items: this.arrayMove(this.state.items, oldIndex, newIndex)
});
}
reset = () => {

View File

@@ -146,7 +146,7 @@ export default class Background extends React.PureComponent {
requestURL = `${window.constants.UNSPLASH_URL}/getImage`;
break;
case 'pexels':
requestURL = `${window.constants.PEXELS_URL}/getImage`;
requestURL = `${window.constants.PEXELS_URL}/images/random`;
break;
// Defaults to Mue
default:
@@ -162,8 +162,13 @@ export default class Background extends React.PureComponent {
}
let credit = data.photographer;
if (backgroundAPI === 'unsplash') credit = data.photographer + ` ${this.language.unsplash}`;
else if (backgroundAPI === 'pexels') credit = data.photographer + ` ${this.language.pexels}`;
if (backgroundAPI === 'unsplash') {
credit = data.photographer + ` ${this.language.unsplash}`;
} else if (backgroundAPI === 'pexels') {
credit = data.photographer + ` ${this.language.pexels}`;
}
const location = data.location.replace(/[null]+/g, '');
this.setState({
url: data.file,
@@ -172,7 +177,7 @@ export default class Background extends React.PureComponent {
photoInfo: {
hidden: false,
credit: credit,
location: (data.location.replace(/[null]+/g, '') !== ' ') ? data.location : 'N/A',
location: (location !== ' ' && location !== ', ') ? data.location : 'N/A',
camera: data.camera,
resolution: data.resolution,
url: data.file,