Skip to content

Commit ffa75cd

Browse files
committed
update review button
1 parent 4ddec68 commit ffa75cd

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

content.js

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,24 @@
8989
return true;
9090
}
9191

92-
// Create the button
92+
// Create the button - icon only with play icon
9393
const button = document.createElement('button');
9494
button.id = 'copilot-request-review-btn';
95-
button.className = 'btn btn-sm';
96-
button.style.marginLeft = '8px';
97-
button.innerHTML = `
98-
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" style="display:inline-block;vertical-align:text-bottom;">
99-
<path fill="currentColor" d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm7.25-3.25v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7.25 8V4.75a.75.75 0 0 1 1.5 0Z"></path>
95+
button.className = 'Button Button--iconOnly Button--secondary Button--small';
96+
button.type = 'button';
97+
button.style.cssText = 'margin-left: 4px; position: relative; top: -4px;';
98+
button.title = 'Request Copilot review for draft PR';
99+
const playIcon = `
100+
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" width="16" class="octicon">
101+
<path fill="currentColor" d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path>
100102
</svg>
101-
Request Review
102103
`;
103-
button.title = 'Request Copilot review for draft PR';
104+
button.innerHTML = playIcon;
104105

105106
// Add click handler
106107
button.addEventListener('click', async function(e) {
107108
e.preventDefault();
108109

109-
// Save original button content
110-
const originalText = button.innerHTML;
111-
112110
// Try to find the review request form/button
113111
// GitHub's UI typically has a button or action to request reviews
114112
// We'll try to find and click it programmatically
@@ -137,45 +135,42 @@
137135

138136
// Visual feedback - success
139137
button.innerHTML = `
140-
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" style="display:inline-block;vertical-align:text-bottom;">
138+
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" width="16" class="octicon" style="color: #1a7f37;">
141139
<path fill="currentColor" d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path>
142140
</svg>
143-
Requested!
144141
`;
145142
button.style.color = '#1a7f37';
146143

147144
setTimeout(() => {
148-
button.innerHTML = originalText;
145+
button.innerHTML = playIcon;
149146
button.style.color = '';
150147
}, 2000);
151148
} else {
152149
// Fallback: provide feedback that manual action is needed
153150
button.innerHTML = `
154-
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" style="display:inline-block;vertical-align:text-bottom;">
151+
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" width="16" class="octicon" style="color: #db6d28;">
155152
<path fill="currentColor" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path>
156153
</svg>
157-
Use Reviewers section
158154
`;
159155
button.style.color = '#db6d28';
160156
button.title = 'Could not find review request button. Please use the Reviewers section manually.';
161157
setTimeout(() => {
162-
button.innerHTML = originalText;
158+
button.innerHTML = playIcon;
163159
button.style.color = '';
164160
button.title = 'Request Copilot review for draft PR';
165161
}, 3000);
166162
}
167163
} else {
168164
// Could not find reviewers section
169165
button.innerHTML = `
170-
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" style="display:inline-block;vertical-align:text-bottom;">
166+
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" width="16" class="octicon" style="color: #db6d28;">
171167
<path fill="currentColor" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path>
172168
</svg>
173-
Use Reviewers section
174169
`;
175170
button.style.color = '#db6d28';
176171
button.title = 'Could not find Reviewers section. Please request review manually.';
177172
setTimeout(() => {
178-
button.innerHTML = originalText;
173+
button.innerHTML = playIcon;
179174
button.style.color = '';
180175
button.title = 'Request Copilot review for draft PR';
181176
}, 3000);

0 commit comments

Comments
 (0)