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.
94 lines
2.4 KiB
94 lines
2.4 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';
|
||
8 years ago
|
import NotificationFollow from './follow';
|
||
8 years ago
|
|
||
8 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,
|
||
8 years ago
|
};
|
||
|
|
||
8 years ago
|
render () {
|
||
7 years ago
|
const {
|
||
|
hidden,
|
||
|
notification,
|
||
|
onMoveDown,
|
||
|
onMoveUp,
|
||
|
onMention,
|
||
|
} = this.props;
|
||
|
|
||
8 years ago
|
switch(notification.get('type')) {
|
||
8 years ago
|
case 'follow':
|
||
7 years ago
|
return (
|
||
|
<NotificationFollow
|
||
|
hidden={hidden}
|
||
|
id={notification.get('id')}
|
||
|
account={notification.get('account')}
|
||
|
notification={notification}
|
||
|
onMoveDown={onMoveDown}
|
||
|
onMoveUp={onMoveUp}
|
||
|
onMention={onMention}
|
||
|
/>
|
||
|
);
|
||
8 years ago
|
case 'mention':
|
||
7 years ago
|
return (
|
||
|
<StatusContainer
|
||
|
containerId={notification.get('id')}
|
||
|
hidden={hidden}
|
||
|
id={notification.get('status')}
|
||
|
notification={notification}
|
||
|
onMoveDown={onMoveDown}
|
||
|
onMoveUp={onMoveUp}
|
||
|
onMention={onMention}
|
||
|
withDismiss
|
||
|
/>
|
||
|
);
|
||
8 years ago
|
case 'favourite':
|
||
7 years ago
|
return (
|
||
|
<StatusContainer
|
||
|
containerId={notification.get('id')}
|
||
|
hidden={hidden}
|
||
|
id={notification.get('status')}
|
||
|
account={notification.get('account')}
|
||
|
prepend='favourite'
|
||
|
muted
|
||
|
notification={notification}
|
||
|
onMoveDown={onMoveDown}
|
||
|
onMoveUp={onMoveUp}
|
||
|
onMention={onMention}
|
||
|
withDismiss
|
||
|
/>
|
||
|
);
|
||
8 years ago
|
case 'reblog':
|
||
7 years ago
|
return (
|
||
|
<StatusContainer
|
||
|
containerId={notification.get('id')}
|
||
|
hidden={hidden}
|
||
|
id={notification.get('status')}
|
||
|
account={notification.get('account')}
|
||
|
prepend='reblog'
|
||
|
muted
|
||
|
notification={notification}
|
||
|
onMoveDown={onMoveDown}
|
||
|
onMoveUp={onMoveUp}
|
||
|
onMention={onMention}
|
||
|
withDismiss
|
||
|
/>
|
||
|
);
|
||
7 years ago
|
default:
|
||
|
return null;
|
||
8 years ago
|
}
|
||
|
}
|
||
|
|
||
8 years ago
|
}
|