(nativeLink: HTMLAnchorElement)
| 71 | } |
| 72 | |
| 73 | async function addButton(nativeLink: HTMLAnchorElement): Promise<void> { |
| 74 | const classes = getClasses(nativeLink); |
| 75 | const button = ( |
| 76 | <button |
| 77 | type="button" |
| 78 | onClick={openUnreadNotifications} |
| 79 | // Show pointer cursor even when disabled |
| 80 | style={{width: 15, cursor: 'pointer'}} |
| 81 | className="rounded-left-0 border-left-0 d-block p-0 tmp-p-0" |
| 82 | > |
| 83 | <ArrowUpRightIcon className="mb-2 tmp-mb-2" style={{marginLeft: -1}} /> |
| 84 | </button> |
| 85 | ); |
| 86 | |
| 87 | // Reverse order so that the new button is painted below the "unread indicator" |
| 88 | // Also has an rgh- class so that it can be targeted via CSS and deduplicated |
| 89 | wrap(nativeLink, <div className="d-flex flex-row-reverse rgh-unread-anywhere-wrapper" />); |
| 90 | |
| 91 | nativeLink.before(button); |
| 92 | nativeLink.style.width = '30px'; // Reduce width of native button |
| 93 | button.setAttribute('data-variant', 'invisible'); // Enables hover style |
| 94 | button.classList.add(...classes); |
| 95 | removeNotificationIndicator(button); |
| 96 | |
| 97 | addTooltip({ |
| 98 | label: 'Open unread notifications', |
| 99 | shortcut: 'g u', |
| 100 | direction: 'sw', |
| 101 | }, button); |
| 102 | } |
| 103 | |
| 104 | // No signal, created once per load |
| 105 | function initOnce(): void { |
nothing calls this directly
no test coverage detected