Files
opencode-manager/frontend/src/components/VersionNotifier.tsx
T
Chris ScottandFran Boon b38b9e3aca Add version notifications for new releases (#139)
* Add SSH known hosts support and optimize git status fetching

* Add opencode-manager version to health endpoint

* Add version notifications for new releases

---------

Co-authored-by: Fran Boon <fran@aidiq.com>
2026-02-16 20:07:20 -05:00

27 lines
809 B
TypeScript

import { useEffect, useRef } from 'react'
import { showToast } from '@/lib/toast'
import { useVersionCheck } from '@/hooks/useVersionCheck'
export function VersionNotifier() {
const { data, isSuccess } = useVersionCheck()
const hasNotifiedRef = useRef(false)
useEffect(() => {
if (!isSuccess || !data || hasNotifiedRef.current) return
if (data.updateAvailable && data.latestVersion && data.releaseUrl) {
hasNotifiedRef.current = true
showToast.info(`OpenCode Manager v${data.latestVersion} is available`, {
description: 'A new version is ready to install.',
action: {
label: 'View Release',
onClick: () => window.open(data.releaseUrl ?? '', '_blank'),
},
duration: 10000,
})
}
}, [isSuccess, data])
return null
}