Skip to content

Commit 71b11ed

Browse files
feat: add donate footer to updater dialog
1 parent 3aedafa commit 71b11ed

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed

Diff for: arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-dialog.tsx

+45
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,50 @@ export class IDEUpdaterDialog extends ReactDialog<UpdateInfo | undefined> {
165165
goToDownloadPageButton.focus();
166166
}
167167

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+
168212
private openDownloadPage(): void {
169213
this.openExternal('https://www.arduino.cc/en/software');
170214
this.close();
@@ -187,6 +231,7 @@ export class IDEUpdaterDialog extends ReactDialog<UpdateInfo | undefined> {
187231
downloadStarted: true,
188232
});
189233
this.clearButtons();
234+
this.appendDonateFooter();
190235
this.updater.downloadUpdate();
191236
}
192237

Loading

Diff for: arduino-ide-extension/src/browser/style/ide-updater-dialog.css

+32
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,37 @@
3434
min-width: 0;
3535
}
3636

37+
.ide-updater-dialog--footer {
38+
display: inline-block;
39+
margin-top: -16px;
40+
padding: 12px 0 24px 0;
41+
border-top: 1px solid var(--theia-editorWidget-border);
42+
}
43+
.ide-updater-dialog--footer-content {
44+
float: right;
45+
}
46+
47+
.ide-updater-dialog--footer-link {
48+
display: inline-block;
49+
color: var(--theia-textLink-foreground);
50+
font-weight: 500;
51+
line-height: 13px;
52+
}
53+
.ide-updater-dialog--footer-link:hover {
54+
color: var(--theia-textLink-foreground);
55+
cursor: pointer;
56+
}
57+
.ide-updater-dialog--footer-link-icon {
58+
display: inline-block;
59+
-webkit-mask: url(../icons/link-open-icon.svg) center no-repeat;
60+
background-color: var(--theia-textLink-foreground);
61+
height: 12px;
62+
width: 12px;
63+
cursor: pointer;
64+
transform: translateY(2px);
65+
margin-left: 4px;
66+
}
67+
3768
.ide-updater-dialog .changelog {
3869
color: var(--theia-editor-foreground);
3970
background-color: var(--theia-editor-background);
@@ -109,6 +140,7 @@
109140
max-height: 100%;
110141
overflow: hidden;
111142
display: flex;
143+
padding-bottom: 20px !important;
112144
}
113145

114146
#ide-updater-dialog-container .skip-version-button {

Diff for: i18n/en.json

+3
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@
275275
"checkForUpdates": "Check for Arduino IDE Updates",
276276
"closeAndInstallButton": "Close and Install",
277277
"closeToInstallNotice": "Close the software and install the update on your machine.",
278+
"donateLinkIconTitle": "open donation page",
279+
"donateLinkText": "donate to support us",
280+
"donateText": "Open source is love, {0}",
278281
"downloadButton": "Download",
279282
"downloadingNotice": "Downloading the latest version of the Arduino IDE.",
280283
"errorCheckingForUpdates": "Error while checking for Arduino IDE updates.\n{0}",

0 commit comments

Comments
 (0)