|
89 | 89 | return true; |
90 | 90 | } |
91 | 91 |
|
92 | | - // Create the button |
| 92 | + // Create the button - icon only with play icon |
93 | 93 | const button = document.createElement('button'); |
94 | 94 | 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> |
100 | 102 | </svg> |
101 | | - Request Review |
102 | 103 | `; |
103 | | - button.title = 'Request Copilot review for draft PR'; |
| 104 | + button.innerHTML = playIcon; |
104 | 105 |
|
105 | 106 | // Add click handler |
106 | 107 | button.addEventListener('click', async function(e) { |
107 | 108 | e.preventDefault(); |
108 | 109 |
|
109 | | - // Save original button content |
110 | | - const originalText = button.innerHTML; |
111 | | - |
112 | 110 | // Try to find the review request form/button |
113 | 111 | // GitHub's UI typically has a button or action to request reviews |
114 | 112 | // We'll try to find and click it programmatically |
|
137 | 135 |
|
138 | 136 | // Visual feedback - success |
139 | 137 | 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;"> |
141 | 139 | <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> |
142 | 140 | </svg> |
143 | | - Requested! |
144 | 141 | `; |
145 | 142 | button.style.color = '#1a7f37'; |
146 | 143 |
|
147 | 144 | setTimeout(() => { |
148 | | - button.innerHTML = originalText; |
| 145 | + button.innerHTML = playIcon; |
149 | 146 | button.style.color = ''; |
150 | 147 | }, 2000); |
151 | 148 | } else { |
152 | 149 | // Fallback: provide feedback that manual action is needed |
153 | 150 | 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;"> |
155 | 152 | <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> |
156 | 153 | </svg> |
157 | | - Use Reviewers section |
158 | 154 | `; |
159 | 155 | button.style.color = '#db6d28'; |
160 | 156 | button.title = 'Could not find review request button. Please use the Reviewers section manually.'; |
161 | 157 | setTimeout(() => { |
162 | | - button.innerHTML = originalText; |
| 158 | + button.innerHTML = playIcon; |
163 | 159 | button.style.color = ''; |
164 | 160 | button.title = 'Request Copilot review for draft PR'; |
165 | 161 | }, 3000); |
166 | 162 | } |
167 | 163 | } else { |
168 | 164 | // Could not find reviewers section |
169 | 165 | 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;"> |
171 | 167 | <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> |
172 | 168 | </svg> |
173 | | - Use Reviewers section |
174 | 169 | `; |
175 | 170 | button.style.color = '#db6d28'; |
176 | 171 | button.title = 'Could not find Reviewers section. Please request review manually.'; |
177 | 172 | setTimeout(() => { |
178 | | - button.innerHTML = originalText; |
| 173 | + button.innerHTML = playIcon; |
179 | 174 | button.style.color = ''; |
180 | 175 | button.title = 'Request Copilot review for draft PR'; |
181 | 176 | }, 3000); |
|
0 commit comments