mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Update submodule and enhance PatchVisualizer with change statistics
- Updated the `vscode-rojo` submodule to indicate a dirty state. - Modified `DomLabel.lua` to adjust size and position calculations for better layout. - Removed redundant code in `init.lua` related to visible nodes. - Introduced new functions in `Confirming.lua` to create statistical tags and bars for change information, improving the visual representation of changes in the confirmation page. These updates aim to enhance the user interface and provide clearer insights into changes made during the patch visualization process.
This commit is contained in:
parent
43834f357e
commit
a071d1f0df
5 changed files with 143 additions and 9 deletions
|
|
@ -629,8 +629,8 @@ function DomLabel:render()
|
|||
}),
|
||||
ChangeInfo = e("Frame", {
|
||||
BackgroundTransparency = 1,
|
||||
Size = UDim2.new(1, -indent - (if props.patchType and props.onSelectionChange then 210 else 80), 0, 24),
|
||||
Position = UDim2.new(1, if props.patchType and props.onSelectionChange then -130 else -2, 0, 0),
|
||||
Size = UDim2.new(1, -indent - (if props.patchType and props.onSelectionChange then 218 else 80), 0, 24),
|
||||
Position = UDim2.new(1, if props.patchType and props.onSelectionChange then -138 else -2, 0, 0),
|
||||
AnchorPoint = Vector2.new(1, 0),
|
||||
ClipsDescendants = true,
|
||||
}, {
|
||||
|
|
|
|||
|
|
@ -137,11 +137,6 @@ function PatchVisualizer:render()
|
|||
end
|
||||
end
|
||||
|
||||
-- Add ROOT as the first visible node (project summary)
|
||||
if patchTree.ROOT.changeInfo then
|
||||
table.insert(visibleNodes, { node = patchTree.ROOT, depth = 0 })
|
||||
end
|
||||
|
||||
-- Collect from root children in alphabetical order
|
||||
local rootChildren = {}
|
||||
for _, child in patchTree.ROOT.children do
|
||||
|
|
|
|||
|
|
@ -16,6 +16,94 @@ local TableDiffVisualizer = require(Plugin.App.Components.TableDiffVisualizer)
|
|||
|
||||
local e = Roact.createElement
|
||||
|
||||
local function makeStatTag(text, color, theme, transparency, layoutOrder)
|
||||
return e("Frame", {
|
||||
Size = UDim2.new(0, 0, 0, 16),
|
||||
AutomaticSize = Enum.AutomaticSize.X,
|
||||
BackgroundColor3 = color,
|
||||
BackgroundTransparency = transparency:map(function(t)
|
||||
return 0.85 + 0.15 * t
|
||||
end),
|
||||
LayoutOrder = layoutOrder,
|
||||
}, {
|
||||
Corner = e("UICorner", {
|
||||
CornerRadius = UDim.new(0, 3),
|
||||
}),
|
||||
Padding = e("UIPadding", {
|
||||
PaddingLeft = UDim.new(0, 5),
|
||||
PaddingRight = UDim.new(0, 5),
|
||||
}),
|
||||
Label = e("TextLabel", {
|
||||
Text = text,
|
||||
BackgroundTransparency = 1,
|
||||
FontFace = theme.Font.Thin,
|
||||
TextSize = theme.TextSize.Small,
|
||||
TextColor3 = color,
|
||||
TextXAlignment = Enum.TextXAlignment.Center,
|
||||
TextTransparency = transparency,
|
||||
Size = UDim2.new(0, 0, 1, 0),
|
||||
AutomaticSize = Enum.AutomaticSize.X,
|
||||
}),
|
||||
})
|
||||
end
|
||||
|
||||
local function makeStatBar(changeInfo, theme, transparency, layoutOrder)
|
||||
local removed = changeInfo.linesRemoved or 0
|
||||
local added = changeInfo.linesAdded or 0
|
||||
local propChanges = changeInfo.propChanges or 0
|
||||
local total = removed + added + propChanges
|
||||
if total == 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
local children = {
|
||||
Layout = e("UIListLayout", {
|
||||
FillDirection = Enum.FillDirection.Horizontal,
|
||||
SortOrder = Enum.SortOrder.LayoutOrder,
|
||||
}),
|
||||
Corner = e("UICorner", {
|
||||
CornerRadius = UDim.new(0, 2),
|
||||
}),
|
||||
}
|
||||
|
||||
if propChanges > 0 then
|
||||
children.SegProp = e("Frame", {
|
||||
Size = UDim2.fromScale(propChanges / total, 1),
|
||||
BackgroundColor3 = theme.Diff.Property,
|
||||
BackgroundTransparency = transparency,
|
||||
BorderSizePixel = 0,
|
||||
LayoutOrder = 1,
|
||||
})
|
||||
end
|
||||
|
||||
if added > 0 then
|
||||
children.SegAdd = e("Frame", {
|
||||
Size = UDim2.fromScale(added / total, 1),
|
||||
BackgroundColor3 = theme.Diff.Add,
|
||||
BackgroundTransparency = transparency,
|
||||
BorderSizePixel = 0,
|
||||
LayoutOrder = 2,
|
||||
})
|
||||
end
|
||||
|
||||
if removed > 0 then
|
||||
children.SegRemove = e("Frame", {
|
||||
Size = UDim2.fromScale(removed / total, 1),
|
||||
BackgroundColor3 = theme.Diff.Remove,
|
||||
BackgroundTransparency = transparency,
|
||||
BorderSizePixel = 0,
|
||||
LayoutOrder = 3,
|
||||
})
|
||||
end
|
||||
|
||||
return e("Frame", {
|
||||
Size = UDim2.new(0, 40, 0, 8),
|
||||
BackgroundTransparency = 1,
|
||||
ClipsDescendants = true,
|
||||
LayoutOrder = layoutOrder,
|
||||
}, children)
|
||||
end
|
||||
|
||||
local ConfirmingPage = Roact.Component:extend("ConfirmingPage")
|
||||
|
||||
function ConfirmingPage:init()
|
||||
|
|
@ -143,6 +231,10 @@ function ConfirmingPage:render()
|
|||
local hasChanges = self.props.patchTree and self.props.patchTree:getCount() > 0
|
||||
|
||||
return Theme.with(function(theme)
|
||||
local rootChangeInfo = self.props.patchTree
|
||||
and self.props.patchTree.ROOT
|
||||
and self.props.patchTree.ROOT.changeInfo
|
||||
|
||||
local pageContent = Roact.createFragment({
|
||||
Header = e("Frame", {
|
||||
Size = UDim2.new(1, 0, 0, 28),
|
||||
|
|
@ -166,6 +258,53 @@ function ConfirmingPage:render()
|
|||
BackgroundTransparency = 1,
|
||||
}),
|
||||
|
||||
ChangeStats = if rootChangeInfo
|
||||
then e("Frame", {
|
||||
Size = UDim2.new(0.25, -10, 0, 20),
|
||||
Position = UDim2.new(0.5, 0, 0.5, 0),
|
||||
AnchorPoint = Vector2.new(0, 0.5),
|
||||
BackgroundTransparency = 1,
|
||||
}, {
|
||||
Layout = e("UIListLayout", {
|
||||
FillDirection = Enum.FillDirection.Horizontal,
|
||||
HorizontalAlignment = Enum.HorizontalAlignment.Right,
|
||||
VerticalAlignment = Enum.VerticalAlignment.Center,
|
||||
SortOrder = Enum.SortOrder.LayoutOrder,
|
||||
Padding = UDim.new(0, 4),
|
||||
}),
|
||||
PropsTag = if rootChangeInfo.propChanges
|
||||
then makeStatTag(
|
||||
rootChangeInfo.propChanges .. "P",
|
||||
theme.Diff.Property,
|
||||
theme,
|
||||
self.props.transparency,
|
||||
1
|
||||
)
|
||||
else nil,
|
||||
AddedTag = if rootChangeInfo.linesAdded ~= nil
|
||||
then makeStatTag(
|
||||
"+" .. (rootChangeInfo.linesAdded or 0),
|
||||
theme.Diff.Add,
|
||||
theme,
|
||||
self.props.transparency,
|
||||
2
|
||||
)
|
||||
else nil,
|
||||
RemovedTag = if rootChangeInfo.linesRemoved ~= nil
|
||||
then makeStatTag(
|
||||
"-" .. (rootChangeInfo.linesRemoved or 0),
|
||||
theme.Diff.Remove,
|
||||
theme,
|
||||
self.props.transparency,
|
||||
3
|
||||
)
|
||||
else nil,
|
||||
Bar = if rootChangeInfo
|
||||
then makeStatBar(rootChangeInfo, theme, self.props.transparency, 4)
|
||||
else nil,
|
||||
})
|
||||
else nil,
|
||||
|
||||
FilterInput = e(TextInput, {
|
||||
text = self.state.filterText,
|
||||
placeholder = "Filter",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue