diff --git a/package.json b/package.json index d1ed122..d9439df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "macos-task-manager", - "version": "1.0.4", + "version": "1.0.5", "description": "", "type": "module", "scripts": { diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 7c4b2b3..e88adf8 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2009,7 +2009,7 @@ dependencies = [ [[package]] name = "macos-task-manager" -version = "1.0.4" +version = "1.0.5" dependencies = [ "serde", "serde_json", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index bacb17f..584bbc8 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "macos-task-manager" -version = "1.0.4" +version = "1.0.5" description = "A Tauri App" authors = ["you"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 68355cc..32b3ad2 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "NeoHtop", - "version": "1.0.4" + "version": "1.0.5" }, "tauri": { "allowlist": { diff --git a/src/lib/components/AppInfo.svelte b/src/lib/components/AppInfo.svelte index 21733e2..fd73db2 100644 --- a/src/lib/components/AppInfo.svelte +++ b/src/lib/components/AppInfo.svelte @@ -6,7 +6,9 @@ import Fa from "svelte-fa"; let version = ""; + let latestVersion = ""; let showInfo = false; + let hasUpdate = false; const ASCII_ART = ` ███╗ ██╗███████╗ ██████╗ ██╗ ██╗████████╗ ██████╗ ██████╗ @@ -24,31 +26,55 @@ stack: ["Tauri", "Rust", "Svelte", "TypeScript"], }; + async function checkLatestVersion() { + try { + const response = await fetch( + "https://api.github.com/repos/abdenasser/neohtop/releases/latest", + ); + const data = await response.json(); + latestVersion = data.tag_name.replace("v", ""); + hasUpdate = version && latestVersion && version !== latestVersion; + } catch (error) { + console.error("Failed to check latest version:", error); + } + } + onMount(async () => { version = await getVersion(); + await checkLatestVersion(); });
{#if showInfo} -
(showInfo = false)}>
{ASCII_ART}
NeoHtop v{version} + {#if hasUpdate} + + Update to v{latestVersion} + + {/if}
app @@ -106,6 +132,10 @@ color: var(--subtext0); } + .icon.update-available { + color: var(--red); + } + .info-panel { position: absolute; top: 100%; @@ -167,4 +197,34 @@ color: var(--text); font-weight: 500; } + + .info-button.has-update { + border-color: var(--red); + } + + .info-button.has-update:hover { + background: color-mix(in srgb, var(--red) 10%, transparent); + } + + .info-button.has-update .icon { + color: var(--red); + } + + .update-button { + display: inline-flex; + align-items: center; + padding: 4px 8px; + font-size: 12px; + color: var(--base); + background: var(--red); + border-radius: 4px; + text-decoration: none; + margin-left: 8px; + transition: all 0.2s ease; + } + + .update-button:hover { + background: color-mix(in srgb, var(--red) 90%, white); + transform: translateY(-1px); + }