import { ReactElement } from 'react'; import { Trans, useTranslation } from 'react-i18next'; import { useGetServerVersionQuery } from '../../app/services/server'; import { compareVersion } from '../utils'; type Props = { empty?: boolean, version: string, children: ReactElement } const ServerVersionChecker = ({ empty = false, version, children }: Props) => { const { t } = useTranslation(); const { data: currentVersion, isSuccess } = useGetServerVersionQuery(); if (!isSuccess) return null; const res = compareVersion(currentVersion, version); if (res < 0) return empty ? null :
{{ version }} {{ version: currentVersion }} {t("server_update.update_tip")} {t("server_update.howto")} 📖
; return children; }; export default ServerVersionChecker;