import { useCallback, useEffect, useState } from "react"; import { useHealth } from "src/hooks"; import { T } from "src/locale"; export function SiteFooter() { const health = useHealth(); const [latestVersion, setLatestVersion] = useState(null); const [isNewVersionAvailable, setIsNewVersionAvailable] = useState(false); const getVersion = useCallback(() => { if (!health.data) { return ""; } const v = health.data.version; return `v${v.major}.${v.minor}.${v.revision}`; }, [health.data]); useEffect(() => { const checkForUpdates = async () => { try { const response = await fetch("/api/version/check"); if (response.ok) { const data = await response.json(); setLatestVersion(data.latest); setIsNewVersionAvailable(data.updateAvailable); } } catch (error) { console.debug("Could not check for updates:", error); } }; if (health.data) { checkForUpdates(); } }, [health.data]); return ( ); }