/* * @Description: * @Version: 0.0.1 * @Author: yujiangping * @Date: 2026-01-12 16:34:59 * @LastEditors: ZhaoYing * @LastEditTime: 2026-04-02 10:36:37 */ import React, { useEffect, useState, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { Flex } from 'antd'; import { getVersion, type versionResponse } from '@/api/common' import Empty from '@/components/Empty'; import { useI18n } from '@/store/locale'; import { formatDateTime } from '@/utils/format' const VersionCard: React.FC = () => { const { t } = useTranslation(); const { language } = useI18n() const [versionInfo, setVersionInfo] = useState(null); // 获取当前语言对应的介绍信息 const introduction = useMemo(() => { if (!versionInfo) return null; return language === 'zh' ? versionInfo.introduction : (versionInfo.introduction_en || versionInfo.introduction); }, [versionInfo, language]) useEffect(() => { const fetchVersion = async () => { try { const response = await getVersion(); setVersionInfo(response); } catch (error) { console.error('Failed to fetch version:', error); } }; fetchVersion(); }, []); return (
{t('index.latestUpdate')} {versionInfo?.version && {versionInfo?.version} } {introduction ? (<>
{t('version.releaseDate')}: {formatDateTime(introduction.releaseDate, 'YYYY-MM-DD')} | {t('version.name')}: {introduction.codeName}

') }} /> {introduction.coreUpgrades?.map((item: string, index: number) => (

') }} /> ))}

) : }
); }; export default VersionCard;