mirror of
https://github.com/discourse/discourse.git
synced 2025-01-29 14:03:18 +08:00
26 lines
685 B
JavaScript
26 lines
685 B
JavaScript
import { createWidget } from 'discourse/widgets/widget';
|
|
import { h } from 'virtual-dom';
|
|
import { dateNode } from 'discourse/helpers/node';
|
|
|
|
createWidget('large-notification-item', {
|
|
buildClasses(attrs) {
|
|
const result = ['item', 'notification'];
|
|
if (!attrs.get('read')) {
|
|
result.push('unread');
|
|
}
|
|
return result;
|
|
},
|
|
|
|
html(attrs) {
|
|
return [this.attach('notification-item', attrs),
|
|
h('span.time', dateNode(attrs.created_at))];
|
|
}
|
|
});
|
|
|
|
export default createWidget('user-notifications-large', {
|
|
html(attrs) {
|
|
const notifications = attrs.notifications;
|
|
return notifications.map(n => this.attach('large-notification-item', n));
|
|
}
|
|
});
|