chore(intellisense): improve parameter annotations and add missing comments

Touched up incorrect or missing Intellisense parameter annotations across several functions. Added some missing descriptions to improve editor support. Still more to do, but this is a small step forward for overall developer workflow. Also small fix in picklexp
This commit is contained in:
MrNewb committed 2025-06-07 22:50:13 -04:00
1 parent 866283162b
commit c71a261115
88 files changed
+339 -286

No files matched your search

+3 -2
View File
@@ -2,7 +2,8 @@ local resourceName = "ox_lib"
local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Menus = Menus or {}
--- Converts a QB menu to an Ox menu.
---Converts a QB menu to an Ox menu.
---@param id string The menu ID.
---@param menu table The QB menu data.
---@return table The Ox menu data.
@@ -50,4 +51,4 @@ OpenMenu = function(id, data, useQBinput)
lib.registerContext(data)
lib.showContext(id)
return data
end
end
+2 -2
View File
@@ -1,8 +1,8 @@
local resourceName = "qb-menu"
local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Loading QB Menu")
--- Converts an Ox menu to a QB menu.
---Converts an Ox menu to a QB menu.
---@param id string The menu ID.
---@param menu table The Ox menu data.
---@return table The QB menu data.
+5 -92
View File
@@ -1,7 +1,7 @@
Menus = Menus or {}
Menu = {}
--- Opens a menu based on the configuration.
---Opens a menu based on the configuration.
---@param data table The menu data.
---@param useQb boolean Whether to use QB menu syntax.
---@return id string The menu ID.
@@ -12,9 +12,9 @@ function Menu.Open(data, useQb)
return id
end
--- Event to handle callback from menu selection.
--- @param _args table The arguments passed to the callback.
--- @return nil
---Event to handle callback from menu selection.
---@param _args table The arguments passed to the callback.
---@return nil
RegisterNetEvent('community_bridge:client:MenuCallback', function(_args)
local id = _args.id
local onSelect = _args.onSelect
@@ -23,91 +23,4 @@ RegisterNetEvent('community_bridge:client:MenuCallback', function(_args)
onSelect(args)
end)
return Menu
--[[
--Unit Tests
local qbMenu = {
{
header = 'QBCore Test Menu',
icon = 'fas fa-code',
isMenuHeader = true, -- Set to true to make a nonclickable title
},
{
header = 'First Button',
txt = 'Open a secondary menu!',
icon = 'fas fa-code-pull-request',
-- disabled = false, -- optional, non-clickable and grey scale
-- hidden = true, -- optional, hides the button completely
params = {
-- isServer = false, -- optional, specify event type
event = 'community_bridge:client:TestEvent',
args = {
number = 1,
}
}
},
{
header = 'Second Button',
txt = 'Open a secondary menu!',
icon = 'fas fa-code-pull-request',
params = {
event = 'community_bridge:client:TestEvent',
args = {
number = 2,
}
}
}
}
local oxMenu = {
id = "test",
title = "Test Menu",
options = {
{
title = "First Button",
description = "Open a secondary menu!",
icon = "fas fa-code-pull-request",
args = {
number = 1,
},
onSelect = function(selected, secondary, args)
print("Selected", json.encode(selected))
end
},
{
title = "Second Button",
description = "Open a secondary menu!",
icon = "fas fa-code-pull-request",
args = {
number = 2,
},
onSelect = function(selected, secondary, args)
print("Selected", json.encode(selected))
end
}
}
}
RegisterCommand("testmenu-qbtoox", function()
Menu.Open(qbMenu, true)
end)
RegisterCommand("testmenu-oxtoqb", function()
Menu.Open(oxMenu, false)
end)
RegisterCommand("testmenu-oxtoox", function()
Menu.Open(oxMenu, false)
end)
RegisterCommand("testmenu-qbtoqb", function()
Menu.Open(qbMenu, true)
end)
RegisterNetEvent('community_bridge:client:TestEvent', function(args)
print("Test Event", json.encode(args))
end)
--]]
return Menu