fix(web): ui upgrade

This commit is contained in:
zhaoying
2026-03-25 13:58:25 +08:00
parent 9df41456f6
commit 2b9fd33bc8
42 changed files with 223 additions and 191 deletions

View File

@@ -68,7 +68,7 @@ const TopCardList: FC<{data?: DataResponse}> = ({ data }) => {
</Flex>
<div className="rb:mt-5 rb:font-[MiSans-Bold] rb:font-bold rb:text-[24px] rb:leading-8">
{item.key === 'spaces' && String(data?.active_workspaces)}
{item.key === 'spaces' && String(data?.active_workspaces || 0)}
{item.key === 'running_apps' && String(data?.[`${item.key}` as keyof DataResponse] || item.value || 0)}
{item.key !== 'spaces' && item.key !== 'running_apps' && String(data?.[`total_${item.key}` as keyof DataResponse] || item.value || 0)}
</div>

View File

@@ -6,22 +6,24 @@
* @LastEditors: yujiangping
* @LastEditTime: 2026-01-23 19:07:36
*/
import React, { useEffect, useState } from 'react';
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';
const VersionCard: React.FC = () => {
const { t, i18n } = useTranslation();
const { t } = useTranslation();
const { language } = useI18n()
const [versionInfo, setVersionInfo] = useState<versionResponse | null>(null);
// 获取当前语言对应的介绍信息
const getIntroduction = () => {
const introduction = useMemo(() => {
if (!versionInfo) return null;
const currentLang = i18n.language;
return currentLang === 'zh' ? versionInfo.introduction : (versionInfo.introduction_en || versionInfo.introduction);
};
return language === 'zh' ? versionInfo.introduction : (versionInfo.introduction_en || versionInfo.introduction);
}, [versionInfo, language])
useEffect(() => {
const fetchVersion = async () => {
@@ -40,13 +42,14 @@ const VersionCard: React.FC = () => {
<div className='rb:w-full rb:p-3 rb:bg-white rb:rounded-xl rb:mt-3'>
<Flex gap={4} className="rb:mb-3">
<span className="rb:font-[MiSans-Bold] rb:font-bold rb:leading-5">{t('index.latestUpdate')}</span>
<span className='rb:text-[12px] rb:text-white rb:leading-4.25 rb:pt-px rb:pl-2 rb:pr-1.75 rb:bg-[#171719] rb:rounded-lg rb:rounded-bl-none '>
{versionInfo?.version}
</span>
{versionInfo?.version &&
<span className='rb:text-[12px] rb:text-white rb:leading-4.25 rb:pt-px rb:pl-2 rb:pr-1.75 rb:bg-[#171719] rb:rounded-lg rb:rounded-bl-none '>
{versionInfo?.version}
</span>
}
</Flex>
{versionInfo && (() => {
const introduction = getIntroduction();
return introduction ? (<>
{introduction
? (<>
<div className="rb:text-[#5B6167] rb:text-[12px] rb:leading-4.5 rb:mt-1 rb:mb-2">
{t('version.releaseDate')}: {introduction.releaseDate} | {t('version.name')}: {introduction.codeName}
</div>
@@ -63,8 +66,9 @@ const VersionCard: React.FC = () => {
/>
))}
</div>
</>) : null;
})()}
</>)
: <Empty size={88} />
}
</div>
);
};