Skip to content

feat(esx_notify): Add a configurable position#1694

Merged
Zykem merged 7 commits into
esx-framework:devfrom
alexistb2904:esx_notify-position
Aug 23, 2025
Merged

feat(esx_notify): Add a configurable position#1694
Zykem merged 7 commits into
esx-framework:devfrom
alexistb2904:esx_notify-position

Conversation

@alexistb2904

@alexistb2904 alexistb2904 commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

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

ESX.ShowNotification('No Waypoint Set.', true, false, 140)

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

@Zykem Zykem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@alexistb2904 alexistb2904 requested a review from Zykem August 8, 2025 10:02

@Zykem Zykem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the parameter in ESX:ShowNotification (es_extended/client/functions.lua) too, and looks good to go.

@Zykem

Zykem commented Aug 9, 2025

Copy link
Copy Markdown
Member

Also, if you don't mind, please also add these parameters in the player class (es_extended/server/classes/player.lua.showNotification)

@alexistb2904 alexistb2904 requested a review from Zykem August 9, 2025 13:40

@Zykem Zykem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@alexistb2904 alexistb2904 requested a review from Zykem August 9, 2025 18:36

@Zykem Zykem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@alexistb2904

Copy link
Copy Markdown
Contributor Author

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.

@Zykem

Zykem commented Aug 15, 2025

Copy link
Copy Markdown
Member

That would be the expected result. Take your time, enjoy your vacation!

@Kenshiin13 Kenshiin13 marked this pull request as draft August 16, 2025 12:28
@alexistb2904 alexistb2904 marked this pull request as ready for review August 21, 2025 19:49
@alexistb2904 alexistb2904 requested a review from Zykem August 21, 2025 19:49
@alexistb2904 alexistb2904 changed the title Add a configurable position for the esx_notify feat(esx_notify): Add a configurable position Aug 21, 2025

@Zykem Zykem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@Zykem

Zykem commented Aug 23, 2025

Copy link
Copy Markdown
Member

@Zykem Zykem merged commit f75aab4 into esx-framework:dev Aug 23, 2025
1 check passed
@alexistb2904 alexistb2904 deleted the esx_notify-position branch August 23, 2025 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants