From a071d1f0df06fd3e63c63b16831b1e57b33c1efc Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 19 Feb 2026 04:46:42 -0600 Subject: [PATCH] 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. --- .../Components/PatchVisualizer/DomLabel.lua | 4 +- .../App/Components/PatchVisualizer/init.lua | 5 - plugin/src/App/StatusPages/Confirming.lua | 139 ++++++++++++++++++ src/syncback/mod.rs | 2 +- vscode-rojo | 2 +- 5 files changed, 143 insertions(+), 9 deletions(-) diff --git a/plugin/src/App/Components/PatchVisualizer/DomLabel.lua b/plugin/src/App/Components/PatchVisualizer/DomLabel.lua index f8e4872a..268e1c0d 100644 --- a/plugin/src/App/Components/PatchVisualizer/DomLabel.lua +++ b/plugin/src/App/Components/PatchVisualizer/DomLabel.lua @@ -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, }, { diff --git a/plugin/src/App/Components/PatchVisualizer/init.lua b/plugin/src/App/Components/PatchVisualizer/init.lua index 7d7b8c70..6c90f328 100644 --- a/plugin/src/App/Components/PatchVisualizer/init.lua +++ b/plugin/src/App/Components/PatchVisualizer/init.lua @@ -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 diff --git a/plugin/src/App/StatusPages/Confirming.lua b/plugin/src/App/StatusPages/Confirming.lua index abf48793..fc828b8a 100644 --- a/plugin/src/App/StatusPages/Confirming.lua +++ b/plugin/src/App/StatusPages/Confirming.lua @@ -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", diff --git a/src/syncback/mod.rs b/src/syncback/mod.rs index 667db2c7..85feb3a9 100644 --- a/src/syncback/mod.rs +++ b/src/syncback/mod.rs @@ -419,7 +419,7 @@ pub fn syncback_loop_with_stats( } e.file_name() .to_str() - .map_or(true, |n| !n.starts_with('.') || n == ".gitkeep") + .is_none_or(|n| !n.starts_with('.') || n == ".gitkeep") }) .flatten() { diff --git a/vscode-rojo b/vscode-rojo index 08a8e230..6ad86728 160000 --- a/vscode-rojo +++ b/vscode-rojo @@ -1 +1 @@ -Subproject commit 08a8e230435011ddaf32668a099bf610ef5d22e5 +Subproject commit 6ad86728c1b14af55e725e5f0698e8b5b94dfe9a