diff --git a/lua/wikis/commons/Role/Util.lua b/lua/wikis/commons/Role/Util.lua index 7cbafd93112..c172dc2b272 100644 --- a/lua/wikis/commons/Role/Util.lua +++ b/lua/wikis/commons/Role/Util.lua @@ -12,6 +12,9 @@ local String = Lua.import('Module:StringUtils') local Roles = Lua.import('Module:Roles') +local IconFa = Lua.import('Module:Widget/Image/Icon/Fontawesome') +local Icon = Lua.import('Module:Widget/Image/Icon/Image') + --- TODO: In the future this should be moved to role data entry local POSITION_ICON_DATA = Lua.requireIfExists('Module:PositionIcon/data', {loadData = true}) @@ -21,11 +24,14 @@ local RoleUtil = {} ---@field display string ---@field category string ---@field sortOrder integer? +---@field iconFa string? +---@field icon string? +---@field iconDark string? ---@class RoleData: RoleBaseData ---@field key string? ---@field type RoleTypes ----@field icon string? +---@field icon Renderable? ---@enum RoleTypes RoleUtil.ROLE_TYPE = { @@ -86,7 +92,15 @@ function RoleUtil._createRoleData(roleKey) key = key, type = roleType(), sortOrder = roleData.sortOrder, - icon = POSITION_ICON_DATA and POSITION_ICON_DATA[key] or nil, + icon = roleData.iconFa and IconFa{iconName = roleData.iconFa, hover = roleData.display} + or roleData.icon and Icon{ + imageLight = roleData.icon, + imageDark = roleData.iconDark, + size = '16px', + alt = roleData.display, + } + or POSITION_ICON_DATA and POSITION_ICON_DATA[key] + or nil, } end