refactor(web): 优化 IOD 相关组件和 hooks

- 修改 IodRelevant 组件,根据搜索状态动态显示文本
- 更新 useMessage hook,添加调试断点
- 重构 iod.ts 中的 IoDSources 处理逻辑
This commit is contained in:
zhaoweijie
2025-08-24 12:44:02 +08:00
parent ecb90d9035
commit cb6c3c225b
3 changed files with 14 additions and 8 deletions

View File

@@ -228,15 +228,21 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
return iodSearch && messages.length > 0 && !iodLoading
}, [iodSearch, messages, iodLoading])
const data = useMemo(() => {
const currentMessage = messages?.find(
(message) => message.id === currentMessageId
)
const text = (iodSearch && iodLoading) ? '正' : '已'
const text2 = (iodSearch && iodLoading) ? '进行' : '完成'
const text3 = (iodSearch && iodLoading) ? '……' : ''
return [
{
title: (
<p className="font-extrabold">
{text}
<span className="text-[#f00000]">
<CountUp end={29} duration={2.5} separator="," />
</span>
@@ -250,7 +256,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
<CountUp decimals={1} end={53.7} duration={2.5} separator="," />
</span>
{text2}{text3}
</p>
),
description: showSearchData ? (
@@ -274,7 +280,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
{
title: (
<p className="font-extrabold">
{text}
<span className="text-[#f00000]">
<CountUp end={138} duration={2.5} separator="," />
@@ -284,7 +290,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
<CountUp end={18.3} decimals={1} duration={2.5} separator="," />
</span>
{text2}{text3}
</p>
),
description: showSearchData ? (
@@ -308,7 +314,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
{
title: (
<p className="font-extrabold">
{text}
<span className="text-[#f00000]">
<CountUp end={763} duration={2.5} separator="," />
</span>
@@ -322,7 +328,7 @@ export const PlaygroundIodRelevant: React.FC<Props> = ({ className }) => {
{" "}
<CountUp end={2} duration={2.5} separator="," />
</span>
{text2}{text3}
</p>
),
description: showSearchData ? (