feat(esx_notify): Add a configurable position#1694
Conversation
There was a problem hiding this comment.
Thanks for the PR!
Could you adjust the implementation slightly? Specifically:
Add a new position parameter to the function Notify.
(Please keep in mind that we also have ESX.ShowNotification in the core.
If position is provided and matches one of the supported positions, use it.
Otherwise, fall back to your new Config.position.
This will make the function more flexible while keeping the config value as a default. Let me know if you have any questions!
Zykem
left a comment
There was a problem hiding this comment.
Please add the parameter in ESX:ShowNotification (es_extended/client/functions.lua) too, and looks good to go.
|
Also, if you don't mind, please also add these parameters in the |
Zykem
left a comment
There was a problem hiding this comment.
One last change: add title param to self.showNotification in the player class and this PR is good to go. (Make sure its in the right order, so title first, then position.
Zykem
left a comment
There was a problem hiding this comment.
I've noticed during testing that the positioning logic currently sets the position on the root container rather than on each individual notification. This causes an issue when multiple notifications are triggered in different positions.
For example, if a notification is triggered in the bottom-right, and another one is triggered a second later in the bottom-left, both notifications end up in the same (latest) position, instead of maintaining their independent positions.
Please update the implementation so that each notification is positioned individually based on its position param, without affecting the position of the entire container. The container should support multiple positions at the same time.
|
Defining the position Each notification individually will require creating containers for each position in order to keep the effect of stacking notifications. I thought more that the position was going to be set once in the config and no longer moved. Its for that I had not changed ESX.shownotification and the player class. I go on vacation but I make the changes as soon as I return, if this is what you want. |
|
That would be the expected result. Take your time, enjoy your vacation! |
…ons. Update to the readme too.
Description
Add in the Config.lua a possibility to configure where do we want the notify to go (top-right, top-left, top-middle, bottom-right, bottom-left, bottom-middle, middle-left, middle-right)
Motivation
On my server an interface was on the right so we can't see the notify, now we can put it in 8 different position
Implementation Details
Add a line into the Config.lua to choose the position that we want
In the Notify.lua pass the Config.position when i notification is sent to the NUI
In the script.js add the class that we choose in the Config.position to the #root element because he's the one that control the position of the notify
In the style.css add all the variation of position and keyframes animation for the #root element
Fallback in the Notify.lua to "middle-right" when the Config.position is not set, same into the script.js
Usage Example
Same usage as usual
PR Checklist