Skip to content

Refactor LiveblogNotifications#15594

Draft
JamieB-gu wants to merge 2 commits intomainfrom
refactor-liveblog-notifications-button
Draft

Refactor LiveblogNotifications#15594
JamieB-gu wants to merge 2 commits intomainfrom
refactor-liveblog-notifications-button

Conversation

@JamieB-gu
Copy link
Contributor

@JamieB-gu JamieB-gu commented Mar 25, 2026

We want to expand usage of the notifications button to include subscribing to football match events. This refactor makes the button more generic and testable, to facilitate this.

Firstly the component has been renamed to NotificationsToggle, so that it can be reused for both liveblog notifications (new content) and football notifications (match events such as goals). This component contains the logic for user events, calling Bridget, and synchronising UI with the subscription state.

The UI of the button itself is handled in a new, presentational component called ToggleButton, which replaces
FollowNotificationsButton and is more suitable for customisation to the new football design. FollowNotificationsButton will soon be deleted, as its only other usage is in the process of being deprecated in a separate change (#15558).

Wrapping NotificationsToggle is a lightweight island component that dependency-injects the Bridget client. This allows us to use a "live" implementation of this client in production, and a mock implementation in tests and stories. As a result, this change also adds a story containing UI tests that make use of a mock Bridget client.

The type describing the API of the Notifications Bridget client has been simplified to make dependency injection and mocking simpler. A similar type can be rolled out for the other Bridget clients in a future change.

Part of #14905.

We want to expand usage of the notifications button to include
subscribing to football match events. This refactor makes the button
more generic and testable, to facilitate this.

Firstly the component has been renamed to `NotificationsToggle`, so that
it can be reused for both liveblog notifications (new content) and
football notifications (match events such as goals). This component
contains the logic for user events, calling Bridget, and synchronising
UI with the subscription state.

The UI of the button itself is handled in a new, presentational
component called `ToggleButton`, which replaces
`FollowNotificationsButton` and is more suitable for customisation to
the new football design. `FollowNotificationsButton` will soon be
deleted, as its only other usage is in the process of being deprecated
in a separate change.

Wrapping `NotificationsToggle` is a lightweight island component that
dependency-injects the Bridget client. This allows us to use a "live"
implementation of this client in production, and a mock implementation
in tests and stories. As a result, this change also adds a story
containing UI tests that make use of a mock Bridget client.

The type describing the API of the `Notifications` Bridget client has
been simplified to make dependency injection and mocking simpler. A
similar type can be rolled out for the other Bridget clients in a future
change.
@JamieB-gu JamieB-gu requested review from a team and aracho1 March 25, 2026 18:44
@arelra
Copy link
Member

arelra commented Mar 25, 2026

.importable.tsx -> .island.tsx

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.

2 participants