Add mit-alert-banner component for NDE banner display - #69
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new standalone Angular component (mit-alert-banner) intended to display a configurable/translatable alert banner above the NDE header via the existing custom-element mapping mechanism.
Changes:
- Added
MitAlertBannerComponentthat reads banner HTML fromTranslateServiceand conditionally renders it via Angular control flow. - Added unit tests covering creation, show/hide behavior, language-change updates, and
@Inputkey override behavior. - Wired the component into the custom-component selector mapping so it renders before the header.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/mit-alert-banner/mit-alert-banner.component.ts | Implements the banner’s translation lookup/reactivity and exposes an overridable label key. |
| src/app/mit-alert-banner/mit-alert-banner.component.html | Conditionally renders banner HTML when non-empty. |
| src/app/mit-alert-banner/mit-alert-banner.component.scss | Adds (currently empty) stylesheet entry for the banner component. |
| src/app/mit-alert-banner/mit-alert-banner.component.spec.ts | Adds unit tests for render/hide and language-change update behavior. |
| src/app/custom1-module/customComponentMappings.ts | Registers the banner to render before the header (nde-header-before). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ea2142e to
c17551c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/app/mit-alert-banner/mit-alert-banner.component.ts:24
bannerTextonly recomputes whenonLangChangeemits; changing thelabelKeyinput at runtime won’t update the banner (even though the component API/comment says it can be overridden via binding). IncludelabelKeychanges in the reactive pipeline so the banner updates when either the language or the key changes.
bannerText = toSignal(
this.translate.onLangChange.pipe(
startWith(null),
map(() => this.translate.instant(this.labelKey()).trim()),
),
Why these changes are being introduced: We wanted to add a customizeable alert banner to NDE. How this addresses that need: Created a new standalone Angular component (mit-alert-banner) that: * Fetches translated banner text from the 'mit.alertBanner' label via TranslateService * Displays HTML markup via [innerHTML] binding * Conditionally renders above the Header using @if, hiding when label empty string (by setting mit.alertBanner to NOT_DEFINED) * Reactively updates when language changes via onLangChange observable * Includes comprehensive unit tests with detailed comments for maintainability Side effects of this change: * Requires 'mit.alertBanner' label to be configured in Alma's Custom Defined Labels table * Component is hidden when label is set to NOT_DEFINED or returns empty string Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/NDE-162
c17551c to
ad509f3
Compare
|
@adamshire123 Styles and markup adjustments for the alert banner are committed! We can start reviewing whenever. |
|
I deployed to our NDE_DEV view in production for review https://mit.primo.exlibrisgroup.com/nde/home?vid=01MIT_INST:NDE_DEV&lang=en |
|
@djanelle-mit This looks good to me, thanks for working on it. |
|
@adamshire123 This looks good to me, too. I'll review the official PR |
Why these changes are being introduced:
We wanted to add a customizeable alert banner to NDE.
How this addresses that need:
Created a new standalone Angular component (mit-alert-banner) that:
Side effects of this change:
Relevant ticket(s):