Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
ac2efa32
Unverified
提交
ac2efa32
authored
7月 08, 2025
作者:
Will Chen
提交者:
GitHub
7月 08, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Spruce up problems UX more (#593)
上级
99f2e9ff
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
24 行增加
和
22 行删除
+24
-22
Problems.tsx
src/components/preview_panel/Problems.tsx
+24
-22
没有找到文件。
src/components/preview_panel/Problems.tsx
浏览文件 @
ac2efa32
import
{
useState
}
from
"react"
;
import
{
useAtom
,
useAtomValue
}
from
"jotai"
;
import
{
selectedChatIdAtom
}
from
"@/atoms/chatAtoms"
;
import
{
selectedAppIdAtom
}
from
"@/atoms/appAtoms"
;
...
...
@@ -7,6 +8,7 @@ import {
FileText
,
Wrench
,
RefreshCw
,
Check
,
}
from
"lucide-react"
;
import
{
Problem
,
ProblemReport
}
from
"@/ipc/ipc_types"
;
import
{
Button
}
from
"@/components/ui/button"
;
...
...
@@ -15,8 +17,6 @@ import { useStreamChat } from "@/hooks/useStreamChat";
import
{
useCheckProblems
}
from
"@/hooks/useCheckProblems"
;
import
{
createProblemFixPrompt
}
from
"@/shared/problem_prompt"
;
import
{
showError
}
from
"@/lib/toast"
;
import
{
useSettings
}
from
"@/hooks/useSettings"
;
import
{
AutoFixProblemsSwitch
}
from
"../AutoFixProblemsSwitch"
;
interface
ProblemItemProps
{
problem
:
Problem
;
...
...
@@ -64,45 +64,37 @@ const RecheckButton = ({
variant
=
"outline"
,
className
=
"h-7 px-3 text-xs"
,
}:
RecheckButtonProps
)
=>
{
const
{
settings
}
=
useSettings
();
const
{
checkProblems
,
isChecking
}
=
useCheckProblems
(
appId
);
const
[
showingFeedback
,
setShowingFeedback
]
=
useState
(
false
);
const
handleRecheck
=
async
()
=>
{
setShowingFeedback
(
true
);
const
res
=
await
checkProblems
();
setShowingFeedback
(
false
);
if
(
res
.
error
)
{
showError
(
res
.
error
);
}
};
if
(
!
settings
?.
enableAutoFixProblems
)
{
return
(
<
div
className=
"flex flex-col items-center justify-center h-full text-center p-8"
>
<
div
className=
"w-16 h-16 rounded-full bg-[var(--background-darkest)] flex items-center justify-center mb-4"
>
<
Wrench
size=
{
24
}
className=
"text-muted-foreground"
/>
</
div
>
<
h3
className=
"text-lg font-medium mb-2"
>
Enable Auto-Fix Problems
</
h3
>
<
p
className=
"text-sm text-muted-foreground max-w-md mb-4"
>
You need to enable autofix problems to use the Problem pane.
</
p
>
<
AutoFixProblemsSwitch
showToast=
{
true
}
/>
</
div
>
);
}
const
isShowingChecking
=
isChecking
||
showingFeedback
;
return
(
<
Button
size=
{
size
}
variant=
{
variant
}
onClick=
{
handleRecheck
}
disabled=
{
isChecking
}
disabled=
{
is
Showing
Checking
}
className=
{
className
}
data
-
testid=
"recheck-button"
>
<
RefreshCw
size=
{
14
}
className=
{
`mr-1 ${isChecking ? "animate-spin" : ""}`
}
className=
{
`mr-1 ${is
Showing
Checking ? "animate-spin" : ""}`
}
/>
{
is
Checking
?
"Checking..."
:
"Recheck
"
}
{
is
ShowingChecking
?
"Checking..."
:
"Run checks
"
}
</
Button
>
);
};
...
...
@@ -130,10 +122,13 @@ const ProblemsSummary = ({ problemReport, appId }: ProblemsSummaryProps) => {
if
(
problems
.
length
===
0
)
{
return
(
<
div
className=
"flex flex-col items-center justify-center h-32 text-center"
>
<
p
className=
"mt-6 text-sm font-medium text-muted-foreground mb-3"
>
No problems found
</
p
>
<
div
className=
"w-12 h-12 rounded-full bg-green-100 dark:bg-green-900/20 flex items-center justify-center mb-3"
>
<
div
className=
"w-6 h-6 rounded-full bg-green-500"
></
div
>
<
Check
size=
{
20
}
className=
"text-green-600 dark:text-green-400"
/
>
</
div
>
<
p
className=
"text-sm text-muted-foreground mb-3"
>
No problems found
</
p
>
<
RecheckButton
appId=
{
appId
}
/>
</
div
>
);
...
...
@@ -197,6 +192,13 @@ export function _Problems() {
if
(
!
problemReport
)
{
return
(
<
div
className=
"flex flex-col items-center justify-center h-full text-center p-8"
>
<
div
className=
"w-16 h-16 rounded-full bg-[var(--background-darkest)] flex items-center justify-center mb-4"
>
<
AlertTriangle
size=
{
24
}
className=
"text-muted-foreground"
/>
</
div
>
<
h3
className=
"text-lg font-medium mb-2"
>
No Problems Report
</
h3
>
<
p
className=
"text-sm text-muted-foreground max-w-md mb-4"
>
Run checks to scan your app for TypeScript errors and other problems.
</
p
>
<
RecheckButton
appId=
{
selectedAppId
}
/>
</
div
>
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论