-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In-app toasts for electron-updater notifications (#3902)
* Add custom updater model back after electron migration Fixes #3872 * Enable release builds (temp) * Lint & clean up * Change approach to no user input, heads up with toast * Re-enable prod builds * Working toasts * Only one toast * Add missing type * Clean up before review * New toast design test * Clean up * Use theme colors, add link to changelog --------- Co-authored-by: Frank Noirot <[email protected]>
- Loading branch information
1 parent
2263958
commit 8b0b5a0
Showing
5 changed files
with
98 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import toast from 'react-hot-toast' | ||
import { ActionButton } from './ActionButton' | ||
import { openExternalBrowserIfDesktop } from 'lib/openWindow' | ||
|
||
export function ToastUpdate({ | ||
version, | ||
onRestart, | ||
}: { | ||
version: string | ||
onRestart: () => void | ||
}) { | ||
return ( | ||
<div className="inset-0 z-50 grid place-content-center rounded bg-chalkboard-110/50 shadow-md"> | ||
<div className="max-w-3xl min-w-[35rem] p-8 rounded bg-chalkboard-10 dark:bg-chalkboard-90"> | ||
<div className="my-4 flex items-baseline"> | ||
<span | ||
className="px-3 py-1 text-xl rounded-full bg-primary text-chalkboard-10" | ||
data-testid="update-version" | ||
> | ||
v{version} | ||
</span> | ||
<span className="ml-4 text-md text-bold"> | ||
A new update has downloaded and will be available next time you | ||
start the app. You can view the release notes{' '} | ||
<a | ||
onClick={openExternalBrowserIfDesktop( | ||
`https://github.com/KittyCAD/modeling-app/releases/tag/v${version}` | ||
)} | ||
href={`https://github.com/KittyCAD/modeling-app/releases/tag/v${version}`} | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
here on GitHub. | ||
</a> | ||
</span> | ||
</div> | ||
<div className="flex justify-between gap-8"> | ||
<ActionButton | ||
Element="button" | ||
iconStart={{ | ||
icon: 'arrowRotateRight', | ||
}} | ||
name="Restart app now" | ||
onClick={onRestart} | ||
> | ||
Restart app now | ||
</ActionButton> | ||
<ActionButton | ||
Element="button" | ||
iconStart={{ | ||
icon: 'checkmark', | ||
}} | ||
name="Got it" | ||
onClick={() => { | ||
toast.dismiss() | ||
}} | ||
> | ||
Got it | ||
</ActionButton> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters