eslint fixes
This commit is contained in:
parent
15f512efef
commit
d51a22c5a9
4 changed files with 46 additions and 47 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
/* global $ */
|
||||||
import GlobalUI from './index'
|
import GlobalUI from './index'
|
||||||
|
|
||||||
const Notifications = {
|
const Notifications = {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import Notification from '../Notification'
|
||||||
import Loading from '../Loading'
|
import Loading from '../Loading'
|
||||||
|
|
||||||
class NotificationBox extends Component {
|
class NotificationBox extends Component {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
notifications: PropTypes.array,
|
notifications: PropTypes.array,
|
||||||
fetchNotifications: PropTypes.func.isRequired,
|
fetchNotifications: PropTypes.func.isRequired,
|
||||||
|
|
|
@ -3,31 +3,31 @@ import PropTypes from 'prop-types'
|
||||||
|
|
||||||
// based on https://www.npmjs.com/package/react-loading-animation
|
// based on https://www.npmjs.com/package/react-loading-animation
|
||||||
|
|
||||||
const loading_style = {
|
const loadingStyle = {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
margin: '0 auto',
|
margin: '0 auto',
|
||||||
width: '30px',
|
width: '30px',
|
||||||
height: '30px',
|
height: '30px'
|
||||||
}
|
}
|
||||||
|
|
||||||
const svg_style = {
|
const svgStyle = {
|
||||||
animation: 'rotate 2s linear infinite',
|
animation: 'rotate 2s linear infinite',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
transformOrigin: 'center center',
|
transformOrigin: 'center center',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
margin: 'auto'
|
margin: 'auto'
|
||||||
}
|
}
|
||||||
|
|
||||||
const circle_style = {
|
const circleStyle = {
|
||||||
strokeDasharray: '1,200',
|
strokeDasharray: '1,200',
|
||||||
strokeDashoffset: '0',
|
strokeDashoffset: '0',
|
||||||
animation: 'dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite',
|
animation: 'dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite',
|
||||||
strokeLinecap: 'round'
|
strokeLinecap: 'round'
|
||||||
}
|
}
|
||||||
|
|
||||||
const animation = `@keyframes rotate {
|
const animation = `@keyframes rotate {
|
||||||
|
@ -59,34 +59,34 @@ const animation = `@keyframes rotate {
|
||||||
}`
|
}`
|
||||||
|
|
||||||
class Loading extends React.Component {
|
class Loading extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
width: PropTypes.string,
|
width: PropTypes.string,
|
||||||
height: PropTypes.string,
|
height: PropTypes.string,
|
||||||
margin: PropTypes.string
|
margin: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
style: {},
|
style: {},
|
||||||
width: '30px',
|
width: '30px',
|
||||||
height: '30px',
|
height: '30px',
|
||||||
margin: '0 auto'
|
margin: '0 auto'
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render() {
|
||||||
let { width, height, margin, style } = this.props
|
let { width, height, margin, style } = this.props
|
||||||
|
|
||||||
loading_style.width = width
|
loadingStyle.width = width
|
||||||
loading_style.height = height
|
loadingStyle.height = height
|
||||||
loading_style.margin = margin
|
loadingStyle.margin = margin
|
||||||
|
|
||||||
return <div style={Object.assign({}, loading_style, style)}>
|
return <div style={Object.assign({}, loadingStyle, style)}>
|
||||||
<style>{animation}</style>
|
<style>{animation}</style>
|
||||||
<svg style={svg_style} viewBox="25 25 50 50">
|
<svg style={svgStyle} viewBox="25 25 50 50">
|
||||||
<circle style={circle_style} cx="50" cy="50" r="20" fill="none" strokeWidth="4" strokeMiterlimit="10"/>
|
<circle style={circleStyle} cx="50" cy="50" r="20" fill="none" strokeWidth="4" strokeMiterlimit="10"/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Loading
|
export default Loading
|
||||||
|
|
|
@ -3,7 +3,6 @@ import PropTypes from 'prop-types'
|
||||||
import outdent from 'outdent'
|
import outdent from 'outdent'
|
||||||
|
|
||||||
class Notification extends Component {
|
class Notification extends Component {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
markAsRead: PropTypes.func,
|
markAsRead: PropTypes.func,
|
||||||
markAsUnread: PropTypes.func,
|
markAsUnread: PropTypes.func,
|
||||||
|
@ -32,7 +31,7 @@ class Notification extends Component {
|
||||||
let map, topic, topic1, topic2
|
let map, topic, topic1, topic2
|
||||||
let result = `<div class='in-bold'>${notification.actor.name}</div>`
|
let result = `<div class='in-bold'>${notification.actor.name}</div>`
|
||||||
|
|
||||||
switch(notification.type) {
|
switch (notification.type) {
|
||||||
case 'ACCESS_APPROVED':
|
case 'ACCESS_APPROVED':
|
||||||
map = notification.data.map
|
map = notification.data.map
|
||||||
result += outdent`granted your request to edit map
|
result += outdent`granted your request to edit map
|
||||||
|
@ -77,8 +76,8 @@ class Notification extends Component {
|
||||||
|
|
||||||
getDate = () => {
|
getDate = () => {
|
||||||
const { notification: {created_at} } = this.props
|
const { notification: {created_at} } = this.props
|
||||||
const months = ['Jan','Feb','Mar','Apr','May','Jun',
|
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
||||||
'Jul','Aug','Sep','Oct','Nov','Dec']
|
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||||||
const created = new Date(created_at)
|
const created = new Date(created_at)
|
||||||
return `${months[created.getMonth()]} ${created.getDate()}`
|
return `${months[created.getMonth()]} ${created.getDate()}`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue