import Link from 'next/link'; import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import useSWR from 'swr'; import { StatusResponse } from '../../../../server/interfaces/api/settingsInterfaces'; const messages = defineMessages({ streamdevelop: 'Overseerr Develop', streamstable: 'Overseerr Stable', outofdate: 'Out of date', commitsbehind: '{commitsBehind} {commitsBehind, plural, one {commit} other {commits}} behind', }); const VersionStatus: React.FC = () => { const intl = useIntl(); const { data } = useSWR('/api/v1/status', { refreshInterval: 60 * 1000, }); if (!data) { return null; } const versionStream = data.commitTag === 'local' ? 'Keep it up!' : data.version.startsWith('develop-') ? intl.formatMessage(messages.streamdevelop) : intl.formatMessage(messages.streamstable); return ( {data.commitTag === 'local' ? ( ) : data.version.startsWith('develop-') ? ( ) : ( )}
{versionStream} {data.commitTag === 'local' ? '(⌐■_■)' : data.commitsBehind > 0 ? intl.formatMessage(messages.commitsbehind, { commitsBehind: data.commitsBehind, }) : data.commitsBehind === -1 ? intl.formatMessage(messages.outofdate) : data.version.replace('develop-', '')}
{data.updateAvailable && ( )}
); }; export default VersionStatus;