Skip to content

Commit 0f978d0

Browse files
committed
refactor(plan-ui): simplify layout and improve task rendering #331
- Replace `BorderLayout` with `FlowLayout` for better task alignment. - Remove redundant `isOpaque` settings and simplify label styling. - Update task status rendering to use consistent HTML formatting.
1 parent 230f795 commit 0f978d0

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/AutoDevPlanerToolWindowFactory.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.unitmesh.devti.gui
22

3+
import cc.unitmesh.devti.inline.fullWidth
34
import cc.unitmesh.devti.observer.plan.AgentTaskEntry
45
import cc.unitmesh.devti.observer.plan.MarkdownPlanParser
56
import cc.unitmesh.devti.observer.plan.PlanUpdateListener
@@ -83,7 +84,9 @@ class AutoDevPlanerTooWindow(val project: Project) : SimpleToolWindowPanel(true,
8384
init {
8485
val planPanel = panel {
8586
row {
86-
cell(planSketch).resizableColumn()
87+
cell(planSketch)
88+
.fullWidth()
89+
.resizableColumn()
8790
}
8891
}.apply {
8992
border = JBUI.Borders.compound(

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/plan/PlanSketch.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ class PlanSketch(
8383
) : JBPanel<PlanSketch>(BorderLayout(JBUI.scale(8), 0)), ExtensionLangSketch {
8484
private val contentPanel = JPanel().apply {
8585
layout = BoxLayout(this, BoxLayout.Y_AXIS)
86-
border = JBEmptyBorder(JBUI.insets(4))
8786
}
8887

8988
private val toolbarFactory = PlanToolbarFactory(project)
@@ -97,6 +96,8 @@ class PlanSketch(
9796

9897
planController.renderPlan()
9998
add(contentPanel, BorderLayout.CENTER)
99+
100+
background = JBUI.CurrentTheme.ToolWindow.background()
100101
}
101102

102103
override fun getExtensionName(): String = "ThoughtPlan"

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/plan/SectionPanel.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class SectionPanel(
3030

3131
init {
3232
layout = BoxLayout(this, BoxLayout.Y_AXIS)
33+
background = JBUI.CurrentTheme.ToolWindow.background()
3334
val titlePanel = createSectionTitlePanel()
3435
add(titlePanel)
3536

@@ -46,9 +47,9 @@ class SectionPanel(
4647
private fun createSectionTitlePanel(): JPanel {
4748
val titlePanel = JBPanel<JBPanel<*>>(FlowLayout(FlowLayout.LEFT, 2, 0)).apply {
4849
border = JBUI.Borders.empty(2)
50+
background = JBUI.CurrentTheme.ToolWindow.background()
4951
}
5052

51-
// Add execute button for todo sections
5253
if (planItem.status == TaskStatus.TODO && !planItem.completed) {
5354
titlePanel.add(createExecuteSectionButton())
5455
}
@@ -76,9 +77,10 @@ class SectionPanel(
7677
private fun createExecuteSectionButton(): JButton {
7778
return JButton(AllIcons.Actions.Execute).apply {
7879
border = BorderFactory.createEmptyBorder()
79-
isOpaque = true
80+
8081
preferredSize = Dimension(20, 20)
8182
toolTipText = "Execute Task"
83+
background = JBUI.CurrentTheme.ToolWindow.background()
8284

8385
addActionListener {
8486
AutoDevToolWindowFactory.Companion.sendToSketchToolWindow(project, ChatActionType.SKETCH) { ui, _ ->

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/plan/TaskPanel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class TaskPanel(
3131

3232
init {
3333
border = JBUI.Borders.empty(4, 16, 4, 0)
34+
background = JBUI.CurrentTheme.ToolWindow.background()
3435
taskLabel = createStyledTaskLabel()
3536

3637
val statusIcon = createStatusIcon()

0 commit comments

Comments
 (0)