fix(Echo): 🐛 re-implement nojs Echo buttons

This commit is contained in:
alistair3149 2024-05-06 15:28:56 -04:00
parent de315b2e1d
commit 76a93e962f
No known key found for this signature in database
4 changed files with 25 additions and 4 deletions

View file

@ -341,6 +341,14 @@ class SkinHooks implements
* @param array &$links * @param array &$links
*/ */
private static function updateNotificationsMenu( &$links ) { private static function updateNotificationsMenu( &$links ) {
$iconMap = [
'notifications-alert' => 'bell',
'notifications-notice' => 'tray'
];
self::mapIconsToMenuItems( $links, 'notifications', $iconMap );
self::addIconsToMenuItems( $links, 'notifications' );
/** /**
* Echo has styles that control icons rendering in places we don't want them. * Echo has styles that control icons rendering in places we don't want them.
* Based on fixEcho() from Vector, see T343838 * Based on fixEcho() from Vector, see T343838
@ -351,7 +359,8 @@ class SkinHooks implements
$linkClass = $item['link-class'] ?? []; $linkClass = $item['link-class'] ?? [];
$newLinkClass = [ $newLinkClass = [
// Allows Echo to react to clicks // Allows Echo to react to clicks
'mw-echo-notification-badge-nojs' 'mw-echo-notification-badge-nojs',
'citizen-header__button'
]; ];
if ( in_array( 'mw-echo-unseen-notifications', $linkClass ) ) { if ( in_array( 'mw-echo-unseen-notifications', $linkClass ) ) {
$newLinkClass[] = 'mw-echo-unseen-notifications'; $newLinkClass[] = 'mw-echo-unseen-notifications';

View file

@ -74,6 +74,11 @@
opacity: var( --opacity-icon-base--active ); opacity: var( --opacity-icon-base--active );
} }
} }
// Disable default padding when menu item is used as header button
.citizen-menu .mw-list-item & {
padding: 0;
}
} }
&__logo { &__logo {
@ -135,6 +140,13 @@
gap: var( --space-xxs ); gap: var( --space-xxs );
align-items: center; align-items: center;
} }
// Echo badge styles do not load before init in 1.39
.mw-echo-notification-badge-nojs {
.citizen-ui-icon + span {
.mixin-screen-reader-text;
}
}
} }
#p-personal { #p-personal {

View file

@ -381,7 +381,7 @@
"+ext.dismissableSiteNotice.styles": "skinStyles/extensions/DismissableSiteNotice/ext.dismissableSiteNotice.less", "+ext.dismissableSiteNotice.styles": "skinStyles/extensions/DismissableSiteNotice/ext.dismissableSiteNotice.less",
"+ext.echo.ui.desktop": "skinStyles/extensions/Echo/ext.echo.ui.desktop.less", "+ext.echo.ui.desktop": "skinStyles/extensions/Echo/ext.echo.ui.desktop.less",
"+ext.echo.ui": "skinStyles/extensions/Echo/ext.echo.ui.less", "+ext.echo.ui": "skinStyles/extensions/Echo/ext.echo.ui.less",
"+ext.echo.styles.badge": "skinStyles/extensions/Echo/ext.echo.styles.badge.less", "ext.echo.styles.badge": "skinStyles/extensions/Echo/ext.echo.styles.badge.less",
"+ext.echo.styles.notifications": "skinStyles/extensions/Echo/ext.echo.styles.notifications.less", "+ext.echo.styles.notifications": "skinStyles/extensions/Echo/ext.echo.styles.notifications.less",
"+ext.echo.styles.alert": "skinStyles/extensions/Echo/ext.echo.styles.alert.less", "+ext.echo.styles.alert": "skinStyles/extensions/Echo/ext.echo.styles.alert.less",
"+ext.echo.special": "skinStyles/extensions/Echo/ext.echo.special.less", "+ext.echo.special": "skinStyles/extensions/Echo/ext.echo.special.less",

View file

@ -3,9 +3,9 @@
* *
* SkinStyles for Extension:Echo * SkinStyles for Extension:Echo
* Module: ext.echo.styles.badge * Module: ext.echo.styles.badge
* Version: REL1_35 347c30e * Version: REL1_39
* *
* Date: 2021-08-11 * Date: 2024-05-06
*/ */
.mw-echo-notifications-badge { .mw-echo-notifications-badge {