import Component from 'flarum/Component'; import icon from 'flarum/helpers/icon'; import NotificationList from 'flarum/components/NotificationList'; export default class NotificationsDropdown extends Component { constructor(...args) { super(...args); /** * Whether or not the notifications dropdown is visible. * * @type {Boolean} */ this.showing = false; } view() { const user = app.session.user; const unread = user.unreadNotificationsCount(); return (
{unread || icon('bell')} {app.trans('core.notifications')}
{this.showing ? NotificationList.component() : ''}
); } onclick() { if (app.drawer.isOpen()) { m.route(app.route('notifications')); } else { this.showing = true; } } }