fun DtNotificationsButton()

in hot-reload-devtools/src/main/kotlin/org/jetbrains/compose/devtools/sidecar/DtNotificationsWindow.kt [51:77]


fun DtNotificationsButton() {
    val controller = LocalDtNotificationsWindowController.current
    val notifications = NotificationsUIState.composeValue()

    LaunchedEffect(notifications) {
        if (notifications.notifications.isEmpty()) {
            controller.close()
        }
    }

    if (notifications.notifications.isNotEmpty()) {
        DtIconButton(
            onClick = { controller.requestFocus() },
            tooltip = "Show notifications",
            tag = Tag.NotificationsButton,
        ) {
            DtImage(
                image = notifications.correspondingIcon,
                modifier = Modifier.size(DtSizes.logoSize).scale(0.75f),
            )
        }
    }

    if (controller.isOpen.value) {
        DtNotificationsWindow { controller.close() }
    }
}