Skip to content

feat(phoenix-ng): add NotificationService with 4 severity levels and configurable auto-dismiss#895

Open
deveshbervar wants to merge 1 commit into
HSF:mainfrom
deveshbervar:feat/notification-service-wa1
Open

feat(phoenix-ng): add NotificationService with 4 severity levels and configurable auto-dismiss#895
deveshbervar wants to merge 1 commit into
HSF:mainfrom
deveshbervar:feat/notification-service-wa1

Conversation

@deveshbervar
Copy link
Copy Markdown
Collaborator

Summary

Adds NotificationService as part of Work Area 1 (WA1).

WA1 arc:

What this adds

notification.service.ts — Injectable Angular service:

notificationService.success('File loaded successfully.');
notificationService.info('Loading event data...');
notificationService.warning('File may be malformed.');
notificationService.error('Could not parse event file.');

Follows the same ActiveVariable pattern as ErrorMessageService.
Components subscribe via subscribeToNotifications().

Default auto-dismiss durations:

  • success — 5000ms
  • info — 5000ms
  • warning — 8000ms
  • error — 0ms (manual dismiss required)

Custom duration supported via optional second parameter.

notification.service.component.test.ts — 6 tests:

  • All 4 severity levels emit correct message and severity
  • Default durations per severity level
  • Custom duration override
  • Multiple subscribers supported

Why

PR #879 added try/catch to route IO errors through InfoLogger.
This PR adds the service layer that allows any Phoenix component
to emit user-visible notifications programmatically.

The next step (separate PR) will add the UI component that
subscribes to this service and renders toasts via MatSnackBar.

Scope

  • 2 new files in phoenix-ui-components/lib/services/
  • 1 line added to index.ts for export
  • No changes to existing files beyond the export
  • 6 tests passing locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant