Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resource/interface/client/alert.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ local alertId = 0
---@param timeout? number Force the window to timeout after `x` milliseconds.
---@return 'cancel' | 'confirm' | nil
function lib.alertDialog(data, timeout)
lib.closeAllNui('alert')
if alert then return end

local id = alertId + 1
Expand Down
1 change: 1 addition & 0 deletions resource/interface/client/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ end

---@param id string
function lib.showContext(id)
lib.closeAllNui('context')
if not contextMenus[id] then error('No context menu of such id found.') end

local data = contextMenus[id]
Expand Down
1 change: 1 addition & 0 deletions resource/interface/client/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ local input
---@param options InputDialogOptionsProps[]?
---@return string[] | number[] | boolean[] | nil
function lib.inputDialog(heading, rows, options)
lib.closeAllNui('input')
if input then return end
input = promise.new()

Expand Down
18 changes: 18 additions & 0 deletions resource/interface/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,21 @@ function lib.resetNuiFocus()
SetNuiFocus(false, false)
SetNuiFocusKeepInput(keepInput)
end

function lib.closeAllNui(except)
if except ~= 'context' and lib.getOpenContextMenu() then
lib.hideContext(false)
end
if except ~= 'menu' and lib.getOpenMenu() then
lib.hideMenu(false)
end
if except ~= 'input' then
lib.closeInputDialog()
end
if except ~= 'alert' then
lib.closeAlertDialog()
end
if except ~= 'radial' then
lib.hideRadial()
end
end
1 change: 1 addition & 0 deletions resource/interface/client/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ end
---@param id string
---@param startIndex? number
function lib.showMenu(id, startIndex)
lib.closeAllNui('menu')
local menu = registeredMenus[id]
if not menu then
error(('No menu with id %s was found'):format(id))
Expand Down