Skip to content

Commit 69fd27b

Browse files
committed
feat(ui): conditionally add header for multiple file patches #257
Add header action to the UI only when there are multiple file patches. This improves the user experience by avoiding unnecessary UI elements when not needed
1 parent 82ab3d7 commit 69fd27b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/patch/DiffLangSketch.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ class DiffLangSketch(private val myProject: Project, private var patchContent: S
5353
private val filePatches: MutableList<TextFilePatch> = myReader.textPatches
5454

5555
init {
56-
// val header = createHeaderAction()
57-
// myHeaderPanel.add(header, BorderLayout.EAST)
58-
mainPanel.add(myHeaderPanel)
56+
if (filePatches.size > 1) {
57+
val header = createHeaderAction()
58+
myHeaderPanel.add(header, BorderLayout.EAST)
59+
mainPanel.add(myHeaderPanel)
60+
}
61+
5962
mainPanel.border = JBUI.Borders.compound(JBUI.Borders.empty(0, 10))
6063

6164
ApplicationManager.getApplication().invokeAndWait {

0 commit comments

Comments
 (0)