mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-30 14:08:40 +03:00
Using prettier for linting
This commit is contained in:
@@ -1,69 +1,71 @@
|
||||
import React from 'react'
|
||||
import React from "react";
|
||||
|
||||
export default class Notification extends React.Component {
|
||||
constructor (props) {
|
||||
super()
|
||||
constructor(props) {
|
||||
super();
|
||||
this.state = {
|
||||
isExtended: false
|
||||
}
|
||||
isExtended: false,
|
||||
};
|
||||
}
|
||||
|
||||
toggleDetails () {
|
||||
this.setState({ isExtended: !this.state.isExtended })
|
||||
toggleDetails() {
|
||||
this.setState({ isExtended: !this.state.isExtended });
|
||||
}
|
||||
|
||||
renderItems (items) {
|
||||
if (!items) return ''
|
||||
renderItems(items) {
|
||||
if (!items) return "";
|
||||
return (
|
||||
<div>
|
||||
{items.map((item) => {
|
||||
if (item.error) {
|
||||
return (<p>{item.error.message}</p>)
|
||||
return <p>{item.error.message}</p>;
|
||||
}
|
||||
return ''
|
||||
return "";
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
renderNotificationContent (notification) {
|
||||
let { type, message, items } = notification
|
||||
renderNotificationContent(notification) {
|
||||
const { type, message, items } = notification;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={`message ${type}`}>
|
||||
{message}
|
||||
</div>
|
||||
<div className={`message ${type}`}>{message}</div>
|
||||
<div className={`details ${this.state.isExtended}`}>
|
||||
{(items !== null) ? this.renderItems(items) : ''}
|
||||
{items !== null ? this.renderItems(items) : ""}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render () {
|
||||
if (!this.props.notifications) return null
|
||||
const notificationsToRender = this.props.notifications.filter(n => !('isRead' in n && n.isRead))
|
||||
render() {
|
||||
if (!this.props.notifications) return null;
|
||||
const notificationsToRender = this.props.notifications.filter(
|
||||
(n) => !("isRead" in n && n.isRead)
|
||||
);
|
||||
if (notificationsToRender.length > 0) {
|
||||
return (
|
||||
<div className={`notification-wrapper`}>
|
||||
<div className="notification-wrapper">
|
||||
{this.props.notifications.map((notification) => {
|
||||
return (
|
||||
<div className='notification' onClick={() => this.toggleDetails()}>
|
||||
<div
|
||||
className="notification"
|
||||
onClick={() => this.toggleDetails()}
|
||||
>
|
||||
<button
|
||||
onClick={this.props.onToggle}
|
||||
className='side-menu-burg over-white is-active'
|
||||
className="side-menu-burg over-white is-active"
|
||||
>
|
||||
<span />
|
||||
</button>
|
||||
{this.renderNotificationContent(notification)}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
return (<div />)
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user