feat: enhance configuration management, add update checks, and improve UI components

This commit is contained in:
2026-03-02 12:13:01 +01:00
parent ed25c5299d
commit e8e76cdf8b
12 changed files with 239 additions and 46 deletions

27
utils/version.ts Normal file
View File

@@ -0,0 +1,27 @@
/**
* Compare two version strings.
* Returns true if 'latest' is greater than 'current' (an update is available).
*/
export const isUpdateAvailable = (currentVersion: string | undefined, latestVersion: string) => {
if (!currentVersion || !latestVersion) return false;
// Split strings into an array of numbers: "1.2.10" -> [1, 2, 10]
const currentParts = currentVersion.split('.').map(Number);
const latestParts = latestVersion.split('.').map(Number);
const maxLength = Math.max(currentParts.length, latestParts.length);
for (let i = 0; i < maxLength; i++) {
// If a part is missing, we consider it as 0 (e.g. "1.0" -> [1, 0, 0])
const current = currentParts[i] || 0;
const latest = latestParts[i] || 0;
if (current < latest) {
return true; // It needs an update
}
if (current > latest) {
return false;
}
}
return false;
};