Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix(jb): misc UI issues w/ inline edit #2735

Merged
merged 5 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extensions/intellij/.run/Run Continue.run.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Continue" type="CompoundRunConfigurationType">
<toRun name="Run Extension" type="GradleRunConfiguration" />
<toRun name="Start Core Dev Server" type="NodeJSConfigurationType" />
<toRun name="Prompt Logs" type="ShConfigurationType" />
<toRun name="Start Core Dev Server" type="Unknown" />
<toRun name="Start GUI Dev Server" type="ShConfigurationType" />
<method v="2" />
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fun makeTextArea(): JTextArea {
isOpaque = false
background = GetTheme().getSecondaryDark()
maximumSize = Dimension(400, Short.MAX_VALUE.toInt())
margin = JBUI.insets(6, 4, 6, 4)
margin = JBUI.insets(6, 8, 6, 4)
font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, MAIN_FONT_SIZE)
preferredSize = Dimension(400, 75)
}
Expand Down Expand Up @@ -398,13 +398,32 @@ class CustomPanel(
isEditable = true
background = defaultBackground
foreground = Color(128, 128, 128, 200)
font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 11)
border = EmptyBorder(2, 4, 2, 4)
font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 12)
border = EmptyBorder(8, 8, 8, 8)
isOpaque = false
isEditable = false
cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)
renderer =
DefaultListCellRenderer().apply { horizontalAlignment = SwingConstants.LEFT }
preferredSize = Dimension(200, 30)

renderer = object : DefaultListCellRenderer() {
override fun getListCellRendererComponent(
list: JList<*>?,
value: Any?,
index: Int,
isSelected: Boolean,
cellHasFocus: Boolean
): Component {
val component =
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus)
if (component is JLabel) {
component.border = EmptyBorder(4, 6, 4, 6)
}
return component
}
}.apply {
horizontalAlignment = SwingConstants.LEFT
}

selectedIndex =
continueSettingsService.continueState.lastSelectedInlineEditModel?.let {
if (modelTitles.isEmpty()) -1
Expand All @@ -430,19 +449,16 @@ class CustomPanel(
border = EmptyBorder(2, 6, 2, 6)
}

val rightPanel =
JPanel(MigLayout("insets 0, fillx")).apply {
isOpaque = false
border = EmptyBorder(0, 0, 0, 0)
add(dropdown, "align right")
add(rightButton, "align right")
}
val rightPanel = JPanel(MigLayout("insets 0, fillx")).apply {
isOpaque = false
add(rightButton, "align right")
}

border = EmptyBorder(0, 0, 16, 12)
isOpaque = false

add(dropdown, "align left")
add(rightPanel, "align right, split 2")
isOpaque = false
add(rightPanel, "align right")

cursor = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)
}
Expand Down Expand Up @@ -620,18 +636,7 @@ class CustomButton(text: String, onClick: () -> Unit) : JLabel(text, CENTER) {
cornerRadius.toFloat(),
cornerRadius.toFloat()
)
if (isHovered) {
val brightenFactor = 1.1f
val brighterColor =
Color(
(background.red * brightenFactor).coerceIn(0f, 255f).toInt(),
(background.green * brightenFactor).coerceIn(0f, 255f).toInt(),
(background.blue * brightenFactor).coerceIn(0f, 255f).toInt()
)
g2.color = brighterColor
} else {
g2.color = background
}
g2.color = background
g2.fill(roundRect)
g2.color = foreground
g2.drawString(
Expand All @@ -653,7 +658,7 @@ class CustomTextArea(rows: Int, columns: Int) : JXTextArea("") {
if (text.isEmpty()) {
g.color = Color(128, 128, 128, 255)
g.font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, MAIN_FONT_SIZE)
g.drawString("Enter instructions...", 3, 20)
g.drawString("Enter instructions...", 8, 20)
}

super.paintComponent(g)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class VerticalDiffBlock(
)

acceptButton.setBounds(
x + rejectButton.width + 5,
x + rejectButton.width + 2,
y,
acceptButton.preferredSize.width,
acceptButton.preferredSize.height
Expand Down Expand Up @@ -215,18 +215,17 @@ class VerticalDiffBlock(
val g2 = g.create() as Graphics2D
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
g2.color = backgroundColor
g2.fillRoundRect(0, 0, width - 1, height - 1, 8, 8)
g2.fillRoundRect(0, 0, width - 1, height - 1, 4, 4)
super.paintComponent(g2)
g2.dispose()
}
}.apply {
// This isn't working currently, font color is transparent
foreground = JBColor.WHITE
foreground = Color(240, 240, 240)
font = Font("Arial", Font.BOLD, 9)
isContentAreaFilled = false
isOpaque = false
border = null
preferredSize = Dimension(preferredSize.width, 16)
border = BorderFactory.createEmptyBorder(4, 2, 4, 2)
preferredSize = Dimension(preferredSize.width - 30, 14)
cursor = Cursor(Cursor.HAND_CURSOR)
}
}
Expand Down
19 changes: 19 additions & 0 deletions extensions/intellij/src/main/resources/webview/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@@ -1,18 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/play_button.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Continue</title>
<script type="module" crossorigin src="/assets/index.js"></script>
<link rel="stylesheet" href="/assets/index.css" />
</head>
<body>
<div id="root"></div>

<script>
localStorage.setItem("ide", '"jetbrains"');
</script>
</body>
</html>
7 changes: 3 additions & 4 deletions gui/src/pages/gui/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import { History } from "../../components/History";

export default function GUI() {
return (
<div className="flex overflow-scroll">
<aside className="4xl:block border-vsc-input-border hidden w-96 overflow-y-auto border-0 border-r border-solid">
<div className="flex overflow-hidden">
<aside className="4xl:block border-vsc-input-border scrollbar-hide hidden w-96 overflow-y-auto border-0 border-r border-solid">
<History />
</aside>

<main className="flex flex-1 flex-col overflow-y-auto">
<main className="scrollbar-hide flex flex-1 flex-col overflow-y-auto">
<Chat />
</main>
</div>
Expand Down
Loading