diff --git a/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-dialog.tsx b/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-dialog.tsx index 0c6abbfa..e73de643 100644 --- a/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-dialog.tsx +++ b/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-dialog.tsx @@ -165,6 +165,50 @@ export class IDEUpdaterDialog extends ReactDialog { goToDownloadPageButton.focus(); } + private appendDonateFooter() { + const footer = document.createElement('div'); + footer.classList.add('ide-updater-dialog--footer'); + const footerContent = document.createElement('div'); + footerContent.classList.add('ide-updater-dialog--footer-content'); + footer.appendChild(footerContent); + + const footerLink = document.createElement('a'); + footerLink.innerText = nls.localize( + 'arduino/ide-updater/donateLinkText', + 'donate to support us' + ); + footerLink.classList.add('ide-updater-dialog--footer-link'); + footerLink.onclick = () => + this.openExternal('https://www.arduino.cc/en/donate'); + + const footerLinkIcon = document.createElement('span'); + footerLinkIcon.title = nls.localize( + 'arduino/ide-updater/donateLinkIconTitle', + 'open donation page' + ); + footerLinkIcon.classList.add('ide-updater-dialog--footer-link-icon'); + footerLink.appendChild(footerLinkIcon); + + const placeholderKey = '%%link%%'; + const footerText = nls.localize( + 'arduino/ide-updater/donateText', + 'Open source is love, {0}', + placeholderKey + ); + const placeholder = footerText.indexOf(placeholderKey); + if (placeholder !== -1) { + const parts = footerText.split(placeholderKey); + footerContent.appendChild(document.createTextNode(parts[0])); + footerContent.appendChild(footerLink); + footerContent.appendChild(document.createTextNode(parts[1])); + } else { + footerContent.appendChild(document.createTextNode(footerText)); + footerContent.appendChild(footerLink); + } + + this.controlPanel.insertAdjacentElement('afterend', footer); + } + private openDownloadPage(): void { this.openExternal('https://www.arduino.cc/en/software'); this.close(); @@ -187,6 +231,7 @@ export class IDEUpdaterDialog extends ReactDialog { downloadStarted: true, }); this.clearButtons(); + this.appendDonateFooter(); this.updater.downloadUpdate(); } diff --git a/arduino-ide-extension/src/browser/icons/link-open-icon.svg b/arduino-ide-extension/src/browser/icons/link-open-icon.svg new file mode 100644 index 00000000..21136c80 --- /dev/null +++ b/arduino-ide-extension/src/browser/icons/link-open-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/arduino-ide-extension/src/browser/style/ide-updater-dialog.css b/arduino-ide-extension/src/browser/style/ide-updater-dialog.css index 5d5592ba..8d722c9d 100644 --- a/arduino-ide-extension/src/browser/style/ide-updater-dialog.css +++ b/arduino-ide-extension/src/browser/style/ide-updater-dialog.css @@ -34,6 +34,37 @@ min-width: 0; } +.ide-updater-dialog--footer { + display: inline-block; + margin-top: -16px; + padding: 12px 0 24px 0; + border-top: 1px solid var(--theia-editorWidget-border); +} +.ide-updater-dialog--footer-content { + float: right; +} + +.ide-updater-dialog--footer-link { + display: inline-block; + color: var(--theia-textLink-foreground); + font-weight: 500; + line-height: 13px; +} +.ide-updater-dialog--footer-link:hover { + color: var(--theia-textLink-foreground); + cursor: pointer; +} +.ide-updater-dialog--footer-link-icon { + display: inline-block; + -webkit-mask: url(../icons/link-open-icon.svg) center no-repeat; + background-color: var(--theia-textLink-foreground); + height: 12px; + width: 12px; + cursor: pointer; + transform: translateY(2px); + margin-left: 4px; +} + .ide-updater-dialog .changelog { color: var(--theia-editor-foreground); background-color: var(--theia-editor-background); @@ -109,6 +140,7 @@ max-height: 100%; overflow: hidden; display: flex; + padding-bottom: 20px !important; } #ide-updater-dialog-container .skip-version-button { diff --git a/i18n/en.json b/i18n/en.json index 17cd5554..d7bd68b4 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -275,6 +275,9 @@ "checkForUpdates": "Check for Arduino IDE Updates", "closeAndInstallButton": "Close and Install", "closeToInstallNotice": "Close the software and install the update on your machine.", + "donateLinkIconTitle": "open donation page", + "donateLinkText": "donate to support us", + "donateText": "Open source is love, {0}", "downloadButton": "Download", "downloadingNotice": "Downloading the latest version of the Arduino IDE.", "errorCheckingForUpdates": "Error while checking for Arduino IDE updates.\n{0}",