symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony
https://ux.symfony.com/
MIT License
824 stars 298 forks source link

[Notify] Allow "body" and possibly other Notification Options #349

Open weaverryan opened 2 years ago

weaverryan commented 2 years ago

The Notify component currently does this in JavaScript:

new Notification(content);

But, Notification has a 2nd options argument - https://developer.mozilla.org/en-US/docs/Web/API/Notification/Notification#parameters - where various other options can be passed, mostly notably body.

At the very least, we could pass the content from a Notifier object to this. So, in php:

$notification = new Notification($message, ['chat/custom_mercure_chatter_transport']);
$notification->content('I will now show up as the body');
$notifier->send($notification);

The JavaScript Notification has many other options, e.g. actions and icon. I'm not sure how/if we can support/send these from Symfony's Notifier or not.

Any thoughts @mtarld?

mtarld commented 2 years ago

Indeed, that's a great idea! I think we can leverage the MercureOptions of symfony/mercure-notifier in order to add such options. But IMHO, we might have to find a way to avoid mixing up mercure-related stuff and notification-related stuff WDYT?

ernie76 commented 8 months ago

I would like to have this feature. but i don't know where _notify in controller.js get his content. And if I use {{ stream_notifications(nummern, {'data-controller': 'mynotify'} ) }} then, _notify in my mynotify-controller.js are not used.

carsonbot commented 2 months ago

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot commented 1 month ago

Friendly ping? Should this still be open? I will close if I don't hear anything.

lmeyer commented 1 month ago

@carsonbot please keep this issue open, I'm interessed by this possible feature.