@@ -165,6 +165,50 @@ export class IDEUpdaterDialog extends ReactDialog<UpdateInfo | undefined> {
165
165
goToDownloadPageButton . focus ( ) ;
166
166
}
167
167
168
+ private appendDonateFooter ( ) {
169
+ const footer = document . createElement ( 'div' ) ;
170
+ footer . classList . add ( 'ide-updater-dialog--footer' ) ;
171
+ const footerContent = document . createElement ( 'div' ) ;
172
+ footerContent . classList . add ( 'ide-updater-dialog--footer-content' ) ;
173
+ footer . appendChild ( footerContent ) ;
174
+
175
+ const footerLink = document . createElement ( 'a' ) ;
176
+ footerLink . innerText = nls . localize (
177
+ 'arduino/ide-updater/donateLinkText' ,
178
+ 'donate to support us'
179
+ ) ;
180
+ footerLink . classList . add ( 'ide-updater-dialog--footer-link' ) ;
181
+ footerLink . onclick = ( ) =>
182
+ this . openExternal ( 'https://www.arduino.cc/en/donate' ) ;
183
+
184
+ const footerLinkIcon = document . createElement ( 'span' ) ;
185
+ footerLinkIcon . title = nls . localize (
186
+ 'arduino/ide-updater/donateLinkIconTitle' ,
187
+ 'open donation page'
188
+ ) ;
189
+ footerLinkIcon . classList . add ( 'ide-updater-dialog--footer-link-icon' ) ;
190
+ footerLink . appendChild ( footerLinkIcon ) ;
191
+
192
+ const placeholderKey = '%%link%%' ;
193
+ const footerText = nls . localize (
194
+ 'arduino/ide-updater/donateText' ,
195
+ 'Open source is love, {0}' ,
196
+ placeholderKey
197
+ ) ;
198
+ const placeholder = footerText . indexOf ( placeholderKey ) ;
199
+ if ( placeholder !== - 1 ) {
200
+ const parts = footerText . split ( placeholderKey ) ;
201
+ footerContent . appendChild ( document . createTextNode ( parts [ 0 ] ) ) ;
202
+ footerContent . appendChild ( footerLink ) ;
203
+ footerContent . appendChild ( document . createTextNode ( parts [ 1 ] ) ) ;
204
+ } else {
205
+ footerContent . appendChild ( document . createTextNode ( footerText ) ) ;
206
+ footerContent . appendChild ( footerLink ) ;
207
+ }
208
+
209
+ this . controlPanel . insertAdjacentElement ( 'afterend' , footer ) ;
210
+ }
211
+
168
212
private openDownloadPage ( ) : void {
169
213
this . openExternal ( 'https://www.arduino.cc/en/software' ) ;
170
214
this . close ( ) ;
@@ -187,6 +231,7 @@ export class IDEUpdaterDialog extends ReactDialog<UpdateInfo | undefined> {
187
231
downloadStarted : true ,
188
232
} ) ;
189
233
this . clearButtons ( ) ;
234
+ this . appendDonateFooter ( ) ;
190
235
this . updater . downloadUpdate ( ) ;
191
236
}
192
237
0 commit comments