Apply prettier formatting
This commit is contained in:
parent
bfd081337b
commit
1417c52007
8 changed files with 18 additions and 18 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "newsreader",
|
"name": "newsreader",
|
||||||
"version": "0.4.4",
|
"version": "0.5.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "newsreader",
|
"name": "newsreader",
|
||||||
"version": "0.4.4",
|
"version": "0.5.3",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^5.15.2",
|
"@fortawesome/fontawesome-free": "^5.15.2",
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ import React from 'react';
|
||||||
class Messages extends React.Component {
|
class Messages extends React.Component {
|
||||||
state = { messages: this.props.messages };
|
state = { messages: this.props.messages };
|
||||||
|
|
||||||
close = (index) => {
|
close = index => {
|
||||||
const newMessages = this.state.messages.filter((message, currentIndex) => {
|
const newMessages = this.state.messages.filter((message, currentIndex) => {
|
||||||
return currentIndex != index;
|
return currentIndex != index;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState({ messages: newMessages });
|
this.setState({ messages: newMessages });
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const messages = this.state.messages.map((message, index) => {
|
const messages = this.state.messages.map((message, index) => {
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ class Selector {
|
||||||
selectAllInput.onchange = this.onClick;
|
selectAllInput.onchange = this.onClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick = (e) => {
|
onClick = e => {
|
||||||
const targetValue = e.target.checked;
|
const targetValue = e.target.checked;
|
||||||
|
|
||||||
this.inputs.forEach(input => {
|
this.inputs.forEach(input => {
|
||||||
input.checked = targetValue;
|
input.checked = targetValue;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Selector;
|
export default Selector;
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,15 @@ class App extends React.Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
selectCategory = (categoryId) => {
|
selectCategory = categoryId => {
|
||||||
this.setState({ selectedCategoryId: categoryId });
|
this.setState({ selectedCategoryId: categoryId });
|
||||||
}
|
};
|
||||||
|
|
||||||
deselectCategory = () => {
|
deselectCategory = () => {
|
||||||
this.setState({ selectedCategoryId: null });
|
this.setState({ selectedCategoryId: null });
|
||||||
}
|
};
|
||||||
|
|
||||||
deleteCategory = (categoryId) => {
|
deleteCategory = categoryId => {
|
||||||
const url = `/api/categories/${categoryId}/`;
|
const url = `/api/categories/${categoryId}/`;
|
||||||
const options = {
|
const options = {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
|
|
@ -56,7 +56,7 @@ class App extends React.Component {
|
||||||
text: 'Unable to remove category, try again later',
|
text: 'Unable to remove category, try again later',
|
||||||
};
|
};
|
||||||
return this.setState({ selectedCategoryId: null, message: message });
|
return this.setState({ selectedCategoryId: null, message: message });
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { categories } = this.state;
|
const { categories } = this.state;
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,13 @@ class PostModal extends React.Component {
|
||||||
window.removeEventListener('click', this.modalListener);
|
window.removeEventListener('click', this.modalListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
modalListener = (e) => {
|
modalListener = e => {
|
||||||
const targetClassName = e.target.className;
|
const targetClassName = e.target.className;
|
||||||
|
|
||||||
if (this.props.post && targetClassName == 'modal post-modal') {
|
if (this.props.post && targetClassName == 'modal post-modal') {
|
||||||
this.props.unSelectPost();
|
this.props.unSelectPost();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const post = this.props.post;
|
const post = this.props.post;
|
||||||
|
|
@ -66,7 +66,7 @@ class PostModal extends React.Component {
|
||||||
<div className="post__actions">
|
<div className="post__actions">
|
||||||
<button
|
<button
|
||||||
className={`button read-button ${readButtonDisabled &&
|
className={`button read-button ${readButtonDisabled &&
|
||||||
'button--disabled'}`}
|
'button--disabled'}`}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
!readButtonDisabled && this.props.markPostRead(post, token)
|
!readButtonDisabled && this.props.markPostRead(post, token)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export default class ScrollTop extends React.Component {
|
||||||
showTop: postList.scrollTop > window.innerHeight,
|
showTop: postList.scrollTop > window.innerHeight,
|
||||||
showBottom: !elementEnd,
|
showBottom: !elementEnd,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const postList = this.props.postListNode;
|
const postList = this.props.postListNode;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class PostList extends React.Component {
|
||||||
this.observer.disconnect();
|
this.observer.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleIntersect = (entries) => {
|
handleIntersect = entries => {
|
||||||
entries.every(entry => {
|
entries.every(entry => {
|
||||||
if (entry.isIntersecting) {
|
if (entry.isIntersecting) {
|
||||||
this.observer.unobserve(entry.target);
|
this.observer.unobserve(entry.target);
|
||||||
|
|
@ -43,7 +43,7 @@ class PostList extends React.Component {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
paginate() {
|
paginate() {
|
||||||
if (this.props.selected.type === SAVED_TYPE) {
|
if (this.props.selected.type === SAVED_TYPE) {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ class ReadButton extends React.Component {
|
||||||
if (this.props.selected.unread > 0) {
|
if (this.props.selected.unread > 0) {
|
||||||
this.props.markRead({ ...this.props.selected }, token);
|
this.props.markRead({ ...this.props.selected }, token);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue