Skip to content

Commit

Permalink
feat(gui): add welcome panel with features description and context-aw…
Browse files Browse the repository at this point in the history
…are code generation introduction.

This commit introduces a new welcome panel to the GUI, providing a clear and concise introduction to the features of AutoDev. The panel includes a list of welcome items, each describing a feature using messages from the `AutoDevBundle`. It also includes a link to learn more about AutoDev, which opens a web page in the user's default browser. The welcome panel is designed with a clean layout and appropriate margins to ensure a good user experience.
  • Loading branch information
phodal committed Mar 8, 2024
1 parent 927561b commit c5ae948
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pluginGroup = com.phodal.autodev
pluginName = AutoDev
pluginRepositoryUrl = https://github.com/unit-mesh/auto-dev
# SemVer format -> https://semver.org
pluginVersion = 1.7.0
pluginVersion = 1.7.1-SNAPSHOT

# Supported IDEs: idea, pycharm
baseIDE=idea
Expand Down
7 changes: 4 additions & 3 deletions src/main/kotlin/cc/unitmesh/devti/gui/chat/ChatCodingPanel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import cc.unitmesh.devti.counit.view.WebBlock
import cc.unitmesh.devti.counit.view.WebBlockView
import cc.unitmesh.devti.fullHeight
import cc.unitmesh.devti.fullWidth
import cc.unitmesh.devti.gui.chat.welcome.WelcomePanel
import cc.unitmesh.devti.provider.ContextPrompter
import cc.unitmesh.devti.settings.AutoDevSettingsState
import com.intellij.ide.BrowserUtil
import com.intellij.lang.html.HTMLLanguage
import com.intellij.openapi.Disposable
import com.intellij.openapi.diagnostic.logger
Expand All @@ -24,12 +24,10 @@ import com.intellij.temporary.gui.block.SimpleMessage
import com.intellij.temporary.gui.block.whenDisposed
import com.intellij.ui.Gray
import com.intellij.ui.JBColor
import com.intellij.ui.components.ActionLink
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.JBScrollPane
import com.intellij.ui.components.panels.VerticalLayout
import com.intellij.ui.dsl.builder.panel
import com.intellij.ui.dsl.gridLayout.UnscaledGapsY
import com.intellij.util.ui.JBFont
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
Expand Down Expand Up @@ -62,6 +60,9 @@ class ChatCodingPanel(private val chatCodingService: ChatCodingService, val disp
}
}

val panel = WelcomePanel()
myList.add(panel)

myTitle.foreground = JBColor.namedColor("Label.infoForeground", JBColor(Gray.x80, Gray.x8C))
myTitle.font = JBFont.label()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package cc.unitmesh.devti.gui.chat.welcome

data class WelcomeItem(val text: String) {
}
45 changes: 45 additions & 0 deletions src/main/kotlin/cc/unitmesh/devti/gui/chat/welcome/WelcomePanel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package cc.unitmesh.devti.gui.chat.welcome

import cc.unitmesh.devti.AutoDevBundle
import cc.unitmesh.devti.AutoDevIcons
import com.intellij.ui.Gray
import com.intellij.ui.dsl.builder.RightGap
import com.intellij.ui.dsl.builder.panel
import java.awt.BorderLayout
import javax.swing.JLabel
import javax.swing.JPanel

class WelcomePanel: JPanel(BorderLayout()) {
val welcomeItems: List<WelcomeItem> = listOf(
WelcomeItem(AutoDevBundle.message("settings.welcome.feature.context")),
WelcomeItem(AutoDevBundle.message("settings.welcome.feature.lifecycle")),
WelcomeItem(AutoDevBundle.message("settings.welcome.feature.custom.action")),
WelcomeItem(AutoDevBundle.message("settings.welcome.feature.custom.agent")),
)

init {
background = Gray.x00


val panel = panel {
row {
text(AutoDevBundle.message("settings.welcome.message"))
}
welcomeItems.forEachIndexed { index, it ->
row {
// icon
icon(AutoDevIcons.AI_COPILOT).gap(RightGap.SMALL)
text(it.text)
}
}
row {
text(AutoDevBundle.message("settings.welcome.feature.features"))
}
}.apply {
// set margin 20
border = javax.swing.BorderFactory.createEmptyBorder(20, 20, 20, 20)
}

add(panel, BorderLayout.CENTER)
}
}
7 changes: 7 additions & 0 deletions src/main/resources/messages/AutoDevBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ settings.autodev.coder.refactorCode=Refactor code
settings.autodev.coder.fixIssueCode=Fix issue
settings.autodev.coder.generateTest=Generate test

settings.welcome.message=Welcome to use AutoDev
settings.welcome.feature.context=Precise context-aware code generate and chat
settings.welcome.feature.lifecycle=Full DevOps lifecycle design, development and testing
settings.welcome.feature.custom.action=Custom personal prompt and Team AI
settings.welcome.feature.custom.agent=Integrate with AI agent with your enterprise AI platform
settings.welcome.feature.features=<a href="https://ide.unitmesh.cc/">Learn more</a>

# status bar
autodev.statusbar.name=AutoDev Status Bar
autodev.statusbar.toolTipText=AutoDev
Expand Down

0 comments on commit c5ae948

Please sign in to comment.