You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.1 KiB
89 lines
2.1 KiB
7 years ago
|
// Package imports.
|
||
8 years ago
|
import React from 'react';
|
||
7 years ago
|
import PropTypes from 'prop-types';
|
||
8 years ago
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||
8 years ago
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||
8 years ago
|
|
||
7 years ago
|
// Our imports,
|
||
7 years ago
|
import StatusContainer from 'flavours/glitch/containers/status_container';
|
||
7 years ago
|
import NotificationFollow from './follow';
|
||
7 years ago
|
|
||
7 years ago
|
export default class Notification extends ImmutablePureComponent {
|
||
8 years ago
|
|
||
8 years ago
|
static propTypes = {
|
||
8 years ago
|
notification: ImmutablePropTypes.map.isRequired,
|
||
7 years ago
|
hidden: PropTypes.bool,
|
||
|
onMoveUp: PropTypes.func.isRequired,
|
||
|
onMoveDown: PropTypes.func.isRequired,
|
||
|
onMention: PropTypes.func.isRequired,
|
||
7 years ago
|
settings: ImmutablePropTypes.map.isRequired,
|
||
8 years ago
|
};
|
||
|
|
||
7 years ago
|
renderFollow () {
|
||
|
const { notification } = this.props;
|
||
8 years ago
|
return (
|
||
7 years ago
|
<NotificationFollow
|
||
|
id={notification.get('id')}
|
||
7 years ago
|
account={notification.get('account')}
|
||
7 years ago
|
notification={notification}
|
||
7 years ago
|
/>
|
||
8 years ago
|
);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
7 years ago
|
renderMention () {
|
||
|
const { notification } = this.props;
|
||
7 years ago
|
return (
|
||
|
<StatusContainer
|
||
|
id={notification.get('status')}
|
||
7 years ago
|
notification={notification}
|
||
7 years ago
|
withDismiss
|
||
|
/>
|
||
|
);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
7 years ago
|
renderFavourite () {
|
||
|
const { notification } = this.props;
|
||
8 years ago
|
return (
|
||
7 years ago
|
<StatusContainer
|
||
|
id={notification.get('status')}
|
||
|
account={notification.get('account')}
|
||
|
prepend='favourite'
|
||
|
muted
|
||
7 years ago
|
notification={notification}
|
||
7 years ago
|
withDismiss
|
||
|
/>
|
||
8 years ago
|
);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
7 years ago
|
renderReblog () {
|
||
|
const { notification } = this.props;
|
||
8 years ago
|
return (
|
||
7 years ago
|
<StatusContainer
|
||
|
id={notification.get('status')}
|
||
|
account={notification.get('account')}
|
||
|
prepend='reblog'
|
||
|
muted
|
||
7 years ago
|
notification={notification}
|
||
7 years ago
|
withDismiss
|
||
|
/>
|
||
8 years ago
|
);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
8 years ago
|
render () {
|
||
7 years ago
|
const { notification } = this.props;
|
||
8 years ago
|
switch(notification.get('type')) {
|
||
8 years ago
|
case 'follow':
|
||
7 years ago
|
return this.renderFollow();
|
||
8 years ago
|
case 'mention':
|
||
7 years ago
|
return this.renderMention();
|
||
8 years ago
|
case 'favourite':
|
||
7 years ago
|
return this.renderFavourite();
|
||
8 years ago
|
case 'reblog':
|
||
7 years ago
|
return this.renderReblog();
|
||
|
default:
|
||
|
return null;
|
||
8 years ago
|
}
|
||
|
}
|
||
|
|
||
8 years ago
|
}
|