setIsExpanded(!isExpanded)}>
🖋️
- {filename || "patch"}
+ {filename}
{isComplete && hasError && ✗}
{isComplete && !hasError && ✓}
@@ -109,7 +355,7 @@ function PatchTool({
{isExpanded && (
- {isComplete && !hasError && diff && (
+ {isComplete && !hasError && displayData && (
{executionTime && (
@@ -117,27 +363,13 @@ function PatchTool({
{executionTime}
)}
-
- {lines.map((line, idx) => {
- // Determine line type for styling
- let className = "patch-diff-line";
- if (line.startsWith("+") && !line.startsWith("+++")) {
- className += " patch-diff-addition";
- } else if (line.startsWith("-") && !line.startsWith("---")) {
- className += " patch-diff-deletion";
- } else if (line.startsWith("@@")) {
- className += " patch-diff-hunk";
- } else if (line.startsWith("---") || line.startsWith("+++")) {
- className += " patch-diff-header";
- }
-
- return (
-
- {line || " "}
-
- );
- })}
-
+
+ {/* Monaco diff editor */}
+
)}
@@ -147,7 +379,7 @@ function PatchTool({
Error:
{executionTime &&
{executionTime}}
-
{diff || "Patch failed"}
+
{errorMessage || "Patch failed"}
)}
@@ -158,6 +390,46 @@ function PatchTool({
)}
)}
+
+ {/* Comment dialog */}
+ {showCommentDialog && onCommentTextChange && (
+
+
Add Comment (Line {showCommentDialog.line})
+ {showCommentDialog.selectedText && (
+
{showCommentDialog.selectedText}
+ )}
+
+ )}
);
}
diff --git a/ui/src/styles.css b/ui/src/styles.css
index 0f6f68ca9faa85ef1b4f560281482fa33cb0de57..4cf12073b92eb616137e0ac9ce293e2be9fc8d8e 100644
--- a/ui/src/styles.css
+++ b/ui/src/styles.css
@@ -1217,66 +1217,126 @@ button {
font-weight: normal;
}
-.patch-tool-diff {
+.patch-tool-error-message {
font-family: var(--font-mono);
font-size: 0.875rem;
- background: var(--bg-base);
+ background: var(--bg-tertiary);
border: 1px solid var(--border);
border-radius: 0.25rem;
padding: 0.75rem;
margin: 0;
overflow-x: auto;
- line-height: 1.4;
+ white-space: pre-wrap;
+ word-break: break-word;
+ color: var(--text-secondary);
}
-.patch-diff-line {
- white-space: pre;
- display: block;
+/* Patch Tool Monaco Editor */
+.patch-tool-monaco-editor {
+ border: 1px solid var(--border);
+ border-radius: 0.25rem;
+ overflow: hidden;
}
-.patch-diff-addition {
- background: rgba(34, 197, 94, 0.1);
- color: #16a34a;
+/* Patch Tool Comment Dialog */
+.patch-tool-comment-dialog {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ background: var(--bg-base);
+ border: 1px solid var(--border);
+ border-radius: 0.5rem;
+ padding: 1rem;
+ z-index: 1000;
+ max-width: 500px;
+ width: 90%;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
-.dark .patch-diff-addition {
- background: rgba(34, 197, 94, 0.15);
- color: #86efac;
+.dark .patch-tool-comment-dialog {
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
-.patch-diff-deletion {
- background: rgba(239, 68, 68, 0.1);
- color: #dc2626;
+.patch-tool-comment-dialog h4 {
+ margin: 0 0 0.75rem 0;
+ font-size: 0.875rem;
+ font-weight: 600;
+ color: var(--text-primary);
}
-.dark .patch-diff-deletion {
- background: rgba(239, 68, 68, 0.15);
- color: #fca5a5;
+.patch-tool-selected-text {
+ font-family: var(--font-mono);
+ font-size: 0.75rem;
+ background: var(--bg-tertiary);
+ border: 1px solid var(--border);
+ border-radius: 0.25rem;
+ padding: 0.5rem;
+ margin: 0 0 0.75rem 0;
+ overflow-x: auto;
+ max-height: 100px;
+ white-space: pre;
+ color: var(--text-secondary);
}
-.patch-diff-hunk {
- color: var(--text-secondary);
- background: var(--bg-tertiary);
- font-weight: 500;
+.patch-tool-comment-input {
+ width: 100%;
+ min-height: 80px;
+ padding: 0.5rem;
+ border: 1px solid var(--border);
+ border-radius: 0.25rem;
+ background: var(--bg-base);
+ color: var(--text-primary);
+ font-family: inherit;
+ font-size: 0.875rem;
+ resize: vertical;
+ box-sizing: border-box;
}
-.patch-diff-header {
- color: var(--text-tertiary);
- font-style: italic;
+.patch-tool-comment-input:focus {
+ outline: none;
+ border-color: var(--primary);
+ box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
-.patch-tool-error-message {
- font-family: var(--font-mono);
+.patch-tool-comment-actions {
+ display: flex;
+ gap: 0.5rem;
+ justify-content: flex-end;
+ margin-top: 0.75rem;
+}
+
+.patch-tool-btn {
+ padding: 0.5rem 1rem;
+ border-radius: 0.25rem;
font-size: 0.875rem;
+ font-weight: 500;
+ cursor: pointer;
+ border: none;
+ transition: background-color 0.15s;
+}
+
+.patch-tool-btn-primary {
+ background: var(--primary);
+ color: white;
+}
+
+.patch-tool-btn-primary:hover:not(:disabled) {
+ background: var(--primary-dark);
+}
+
+.patch-tool-btn-primary:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+
+.patch-tool-btn-secondary {
background: var(--bg-tertiary);
- border: 1px solid var(--border);
- border-radius: 0.25rem;
- padding: 0.75rem;
- margin: 0;
- overflow-x: auto;
- white-space: pre-wrap;
- word-break: break-word;
- color: var(--text-secondary);
+ color: var(--text-primary);
+}
+
+.patch-tool-btn-secondary:hover {
+ background: var(--bg-secondary);
}
/* Screenshot Tool */