diff --git a/.gitignore b/.gitignore index a547bf3..90be861 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ node_modules dist dist-ssr *.local +.github/workflows/.secrets # Editor directories and files .vscode/* @@ -21,4 +22,4 @@ dist-ssr *.ntvs* *.njsproj *.sln -*.sw? +*.sw? \ No newline at end of file diff --git a/src/components/sidebar.tsx b/src/components/sidebar.tsx index 7581263..f097609 100644 --- a/src/components/sidebar.tsx +++ b/src/components/sidebar.tsx @@ -29,6 +29,7 @@ export function AppSidebar() { const { open } = useSidebar(); const { downloadAndInstallAppUpdate } = useAppUpdater(); const [showBadge, setShowBadge] = useState(false); + const [showUpdateCard, setShowUpdateCard] = useState(false); const topItems: Array = [ { @@ -61,9 +62,11 @@ export function AppSidebar() { if (open) { timeout = setTimeout(() => { setShowBadge(true); + setShowUpdateCard(true); }, 300); } else { setShowBadge(false); + setShowUpdateCard(false); } return () => { @@ -153,13 +156,14 @@ export function AppSidebar() { )} - {appUpdate && open && ( - + {appUpdate && open && showUpdateCard && ( + Update Available (v{appUpdate.version}) - A new version of {config.appName} is available. Please update to the latest version for the best experience. + A newer version of {config.appName} is available. Please update to the latest version for the best experience. + ✨ Read Changelog diff --git a/src/helpers/use-app-updater.ts b/src/helpers/use-app-updater.ts index 4c8c7a5..4238860 100644 --- a/src/helpers/use-app-updater.ts +++ b/src/helpers/use-app-updater.ts @@ -31,15 +31,16 @@ export default function useAppUpdater() { switch (event.event) { case 'Started': contentLength = event.data.contentLength; - console.log(`started downloading ${event.data.contentLength} bytes`); + console.log(`started downloading app update of ${event.data.contentLength} bytes`); break; case 'Progress': downloaded += event.data.chunkLength; - setDownloadProgress(downloaded / (contentLength || 0)); - console.log(`downloaded ${downloaded} from ${contentLength}`); + const progress = (downloaded / (contentLength || 1)) * 100; + setDownloadProgress(Math.round(progress * 10) / 10); + console.log(`downloaded ${downloaded} bytes from ${contentLength} bytes of app update`); break; case 'Finished': - console.log('download finished'); + console.log('app update download finished'); setIsUpdating(false); break; }