diff --git a/src/components/preview_panel/Problems.tsx b/src/components/preview_panel/Problems.tsx index 93dfb4e..d3e6b38 100644 --- a/src/components/preview_panel/Problems.tsx +++ b/src/components/preview_panel/Problems.tsx @@ -1,3 +1,4 @@ +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 ( -
-
- -
-

Enable Auto-Fix Problems

-

- You need to enable autofix problems to use the Problem pane. -

- -
- ); - } + const isShowingChecking = isChecking || showingFeedback; return ( ); }; @@ -130,10 +122,13 @@ const ProblemsSummary = ({ problemReport, appId }: ProblemsSummaryProps) => { if (problems.length === 0) { return (
+

+ No problems found +

-
+
-

No problems found

+
); @@ -197,6 +192,13 @@ export function _Problems() { if (!problemReport) { return (
+
+ +
+

No Problems Report

+

+ Run checks to scan your app for TypeScript errors and other problems. +

);