Compare commits

...

2 Commits

Author SHA1 Message Date
Gabriel Tofvesson
31f53ef521 Add more status info to details page 2024-10-11 22:49:03 +02:00
Gabriel Tofvesson
f6c9801635 Add constants for orientations 2024-10-11 22:48:52 +02:00
2 changed files with 32 additions and 11 deletions

View File

@ -22,4 +22,7 @@ function Orientation:with(elementType)
return elementType return elementType
end end
Orientation.VERTICAL = true
Orientation.HORIZONTAL = false
return Orientation return Orientation

View File

@ -132,7 +132,7 @@ local function itemList(groups, wBudget, hBudget, savedState, onClick, setPage,
padImport, padImport,
padNext padNext
}, },
[Orientation:getId()] = false [Orientation:getId()] = Orientation.HORIZONTAL
} }
local bgColors = { local bgColors = {
@ -179,7 +179,7 @@ local function itemList(groups, wBudget, hBudget, savedState, onClick, setPage,
paddedText, paddedText,
countLabel countLabel
}, },
[Orientation:getId()] = false, [Orientation:getId()] = Orientation.HORIZONTAL,
onClick = onClick and function(element, x, y, source) onClick = onClick and function(element, x, y, source)
return onClick(element, x, y, source, group) return onClick(element, x, y, source, group)
end or nil end or nil
@ -196,7 +196,7 @@ local function itemList(groups, wBudget, hBudget, savedState, onClick, setPage,
return List:new{ return List:new{
[Children:getId()] = entries, [Children:getId()] = entries,
[Orientation:getId()] = true [Orientation:getId()] = Orientation.VERTICAL
}, state }, state
end end
@ -297,10 +297,7 @@ local PAGES = {
end end
local title = Text:new{ local title = Text:new{
text = "Detail: "..group:getSimpleName(), text = "Detail: "..group:getSimpleName(),
parent = state.monitor, bgColor = colors.gray
onClick = function(e, x, y, s)
state:setPage("MAIN")
end
} }
local paddedTitle = Padding:new{ local paddedTitle = Padding:new{
@ -308,16 +305,37 @@ local PAGES = {
left = 1, left = 1,
right = 1, right = 1,
bottom = 1, bottom = 1,
element = title element = title,
bgColor = colors.gray
} }
local itemCount = Text:new{
text = "Count: "..tostring(group:getItemCount()),
}
local itemSlots = Text:new{
text = "Slots: "..tostring(group:getStackCount())
}
local infoElements = List:new{
[Children:getId()] = {
paddedTitle,
itemCount,
itemSlots
},
[Orientation:getId()] = Orientation.VERTICAL,
width = state.width
}
local stuffContainer = Container:new{ local stuffContainer = Container:new{
[Children:getId()] = { [Children:getId()] = {
paddedTitle infoElements
}, },
width = state.width, width = state.width,
height = state.height, height = state.height,
parent = state.monitor parent = state.monitor,
onClick = function(e, x, y, s)
state:setPage("MAIN")
end
} }
return renderDefault(state, stuffContainer) return renderDefault(state, stuffContainer)