diff --git a/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-component.tsx b/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-component.tsx index 091e0a06a..6a844f3fe 100644 --- a/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-component.tsx +++ b/arduino-ide-extension/src/browser/dialogs/ide-updater/ide-updater-component.tsx @@ -4,6 +4,7 @@ import React from '@theia/core/shared/react'; import type { Options } from 'react-markdown'; import { ProgressInfo, UpdateInfo } from '../../../common/protocol/ide-updater'; import ProgressBar from '../../components/ProgressBar'; +import { createPortal } from '@theia/core/shared/react-dom'; const ReactMarkdown = React.lazy>( // @ts-expect-error see above @@ -21,6 +22,8 @@ export interface IDEUpdaterComponentProps { updateInfo: UpdateInfo; updateProgress: UpdateProgress; openExternal: (url: string) => undefined; + hasControls: boolean; + controlPanel: HTMLDivElement; } export const IDEUpdaterComponent = ({ @@ -32,6 +35,8 @@ export const IDEUpdaterComponent = ({ error, }, openExternal, + hasControls, + controlPanel, }: IDEUpdaterComponentProps): React.ReactElement => { const { version, releaseNotes } = updateInfo; const [changelog, setChangelog] = React.useState(''); @@ -139,17 +144,60 @@ export const IDEUpdaterComponent = ({ ); + const DonateFooter = ( +
+
+ + {nls.localize( + 'arduino/ide-updater/donate-preface', + 'Open source is love, ' + )} + openExternal('https://www.arduino.cc/en/donate/')} + > + {nls.localize( + 'arduino/ide-updater/donate-link-text', + 'donate to support us' + )} +
+ + +
+ ); + + const DonateFooterToRender = + hasControls && controlPanel.parentElement + ? createPortal(DonateFooter, controlPanel.parentElement) + : DonateFooter; + + const isPreDownload = !error && !downloadFinished && !downloadStarted; return (
- {!!error ? ( - - ) : downloadFinished ? ( - - ) : downloadStarted ? ( - - ) : ( - - )} +
+ {!!error ? ( + + ) : downloadFinished ? ( + + ) : downloadStarted ? ( + + ) : ( + + )} + {isPreDownload ? null : DonateFooterToRender} +
); }; 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 0c6abbfaa..8203837a8 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 @@ -69,12 +69,17 @@ export class IDEUpdaterDialog extends ReactDialog { } protected render(): React.ReactNode { + const hasControls = !!this.controlPanel.firstChild; + const controlPanel = this.controlPanel; + return ( this.updateInfo && ( ) ); 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 000000000..21136c806 --- /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 5d5592baf..f435dc8cb 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,44 @@ min-width: 0; } +.ide-updater-dialog--content--child--footer { + margin: 16px 0px 16px 0px; +} + +.ide-updater-dialog--content--child--footer-with-controls { + margin: -16px 0px 16px 0px; +} + +.ide-updater-dialog--content--child--footer > span, +.ide-updater-dialog--content--child--footer-with-controls > span { + float: right; + display: flex; + justify-content: space-between; + align-items: center; +} + +.donate-link { + margin-left: 6px; + display: flex; + flex-direction: row; + align-items: center; + color: var(--theia-textLink-foreground); + font-weight: 500; +} + +.donate-link:hover { + color: var(--theia-textLink-foreground); + cursor: pointer; +} + +.donate-link-icon { + -webkit-mask: url(../icons/link-open-icon.svg) center no-repeat; + background-color: var(--theia-textLink-foreground); + height: 24px; + width: 24px; + cursor: pointer; +} + .ide-updater-dialog .changelog { color: var(--theia-editor-foreground); background-color: var(--theia-editor-background); diff --git a/arduino-ide-extension/src/electron-main/ide-updater/ide-updater-impl.ts b/arduino-ide-extension/src/electron-main/ide-updater/ide-updater-impl.ts index 8d51a64c2..5cd8a8e8b 100644 --- a/arduino-ide-extension/src/electron-main/ide-updater/ide-updater-impl.ts +++ b/arduino-ide-extension/src/electron-main/ide-updater/ide-updater-impl.ts @@ -62,7 +62,7 @@ export class IDEUpdaterImpl implements IDEUpdater { await this.updater.checkForUpdates(); this.cancellationToken = cancellationToken; - if (this.updater.currentVersion.compare(updateInfo.version) === -1) { + if (true) { /* 'latest.txt' points to the latest changelog that has been generated by the CI, so we need to make a first GET request to get the filename of the changelog diff --git a/i18n/en.json b/i18n/en.json index 37c90e2e6..e67e63c34 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -286,7 +286,9 @@ "notNowButton": "Not now", "skipVersionButton": "Skip Version", "updateAvailable": "Update Available", - "versionDownloaded": "Arduino IDE {0} has been downloaded." + "versionDownloaded": "Arduino IDE {0} has been downloaded.", + "donate-prefix": "Open source is love,", + "donate-link-text": "donate to support us" }, "installable": { "libraryInstallFailed": "Failed to install library: '{0}{1}'.",