Not for polybar but you might like to look into SwayNotificationCenter, I use it as the notification daemon of my hyprland setup and it has all the previous notifications in a menu with a do-not-disturb mode. I use a keybind to open up the menu but you could add an icon to polybar that when clicked runs swaync-client -t to toggle the menu.