Update Echo to use MobileFrontend IconButton.js

Bug: T340262
Depends-on: I186e3d22aa9c2b331a80d35514d578949a4b9e86
Change-Id: I415f5092df5b757576a67b612a7691e9038a696f
This commit is contained in:
bwang 2023-07-26 15:43:26 -05:00 committed by Bernard Wang
parent 24d6ddcc1b
commit d002532295
2 changed files with 10 additions and 7 deletions

View file

@ -1,9 +1,10 @@
var
mobile = mw.mobileFrontend.require( 'mobile.startup' ),
View = mobile.View,
Icon = mobile.Icon,
notificationIcon = new Icon( {
name: 'bellOutline-base20',
IconButton = mobile.IconButton,
notificationIconButton = new IconButton( {
icon: 'bellOutline-base20',
tagName: 'a',
glyphPrefix: 'wikimedia'
} );
@ -34,14 +35,15 @@ function NotificationBadge( options ) {
options.hasUnseenNotifications = $el.find( '.notification-unseen' ).length > 0;
options.hasNotifications = options.hasUnseenNotifications;
$notificationAnchor = $el.find( 'a' );
options.title = $notificationAnchor.attr( 'title' );
options.title = $notificationAnchor.children().first().text();
options.url = $notificationAnchor.attr( 'href' );
count = Number( $el.find( '[data-notification-count]' ).data( 'notification-count' ) );
}
View.call( this,
$.extend( {
notificationIconClass: notificationIcon.getClassName(),
notificationButtonClass: notificationIconButton.getClassName(),
notificationIconClass: notificationIconButton.getIcon().getClassName(),
hasNotifications: false,
hasUnseenNotifications: false,
notificationCountRaw: 0

View file

@ -1,7 +1,8 @@
{{^hasNotifications}}
<a href="{{url}}" title="{{title}}"
class="{{notificationIconClass}} mw-echo-notification-badge-nojs user-button" id="user-notifications" data-event-name="ui.notifications">
{{title}}
class="{{notificationButtonClass}} mw-echo-notification-badge-nojs user-button" id="user-notifications" data-event-name="ui.notifications">
<span class="{{notificationIconClass}}"></span>
<span>{{title}}</span>
</a>
{{/hasNotifications}}
{{#hasNotifications}}