refactor: Simplify version display by removing API endpoint and using constant

This commit is contained in:
Yash 2025-12-25 09:48:09 +05:30
parent 612b00179b
commit 5e3e6b3edd
2 changed files with 2 additions and 60 deletions

View file

@ -1,31 +1,8 @@
'use client';
import { Text } from '@umami/react-zen';
import { useEffect, useState } from 'react';
import { CURRENT_VERSION } from '@/lib/constants';
export function VersionSetting() {
const [version, setVersion] = useState<string>('');
const [loading, setLoading] = useState(true);
useEffect(() => {
const fetchVersion = async () => {
try {
const response = await fetch('/api/version');
const data = await response.json();
setVersion(data.version || 'unknown');
} catch (error) {
setVersion('unknown');
} finally {
setLoading(false);
}
};
fetchVersion();
}, []);
if (loading) {
return <Text>Loading...</Text>;
}
return <Text>{version}</Text>;
return <Text>{CURRENT_VERSION}</Text>;
}