1
0
mirror of https://github.com/flarum/core.git synced 2025-08-03 15:07:53 +02:00

forum: add notifications page (used in mobile)

This commit is contained in:
David Sevilla Martin
2020-04-15 17:47:32 -04:00
parent 58164b680a
commit 84d977f819
3 changed files with 33 additions and 1 deletions

View File

@@ -31,7 +31,7 @@ export default class NotificationsDropdown extends Dropdown {
const unread = this.getUnreadCount();
return [
icon(this.props.icon, { className: 'Button-icon' }),
icon(this.props.icon!, { className: 'Button-icon' }),
unread ? <span className="NotificationsDropdown-unread">{unread}</span> : '',
<span className="Button-label">{this.props.label}</span>,
];

View File

@@ -0,0 +1,30 @@
import app from '../app';
import Page from './Page';
import NotificationList from './NotificationList';
/**
* The `NotificationsPage` component shows the notifications list. It is only
* used on mobile devices where the notifications dropdown is within the drawer.
*/
export default class NotificationsPage extends Page {
list = (<NotificationList />);
oninit(vnode) {
super.oninit(vnode);
app.history.push('notifications');
this.bodyClass = 'App--notifications';
}
oncreate(vnode) {
super.oncreate(vnode);
m.redraw();
}
view() {
return <div className="NotificationsPage">{this.list}</div>;
}
}

View File

@@ -3,6 +3,7 @@ import DiscussionPage from './components/DiscussionPage';
import PostsUserPage from './components/PostsUserPage';
import DiscussionsUserPage from './components/DiscussionsUserPage';
import SettingsPage from './components/SettingsPage';
import NotificationsPage from './components/NotificationsPage';
import Discussion from '../common/models/Discussion';
import Post from '../common/models/Post';
@@ -20,6 +21,7 @@ export default (app) => {
'user.discussions': { path: '/u/:username/discussions', component: DiscussionsUserPage },
settings: { path: '/settings', component: SettingsPage },
notifications: { path: '/notifications', component: NotificationsPage },
'index.filter': { path: '/:filter', component: IndexPage },
};