Skip to main content

Module center_button

Module center_button 

Source
Expand description

NotificationCenterButton — bell icon with an unread-count badge that opens a NotificationLog popover when clicked.

Composed as a ZStack { PopoverIconButton(bell), Badge }. The badge shows the current unread count and is hit-transparent so clicks always reach the bell beneath. On popover close the archive’s mark_all_read is called and the badge resets — matching the GitHub / Slack / JetBrains convention. Most apps mount this in a StatusBar or TitleBar trailing slot; all popover behaviour is self-managed with no further wiring.

§Accessibility

The inner IconButton carries the bell Role::Button label; the outer container is set_hidden (presentational). The badge count is not separately announced — the button label and badge label together convey the state to sighted users; AT users interact through the button itself.

// Typical setup — archive comes from install_toast_default():
let archive: Rc<NotificationArchiveModel> = ctx.app_state().unwrap();
let bell = NotificationCenterButton::new(archive)
    .on_action_invoked(|_entry, action, ctx| {
        if let Some(name) = &action.intent_name {
            ctx.send_intent(teksilo_core::Intent::new(name));
        }
    });

Structs§

NotificationCenterButton
Bell-icon trigger + unread-count badge + popover that contains a NotificationLog. On popover open the archive’s mark_all_read runs (the user is presumed to have seen the toasts now).