1 import { useParams } from "wouter";
2 import { useQuery } from "@tanstack/react-query";
3 import Header from "@/components/layout/header";
4 import TroubleshootingFlowchart from "@/components/repair/troubleshooting-flowchart";
5 import type { TroubleshootingFlow } from "@shared/schema";
6
7 export default function Troubleshooting() {
8 const { type } = useParams<{ type?: string }>();
9
10 const { data: flows = [], isLoading } = useQuery<TroubleshootingFlow[]>({
11 queryKey: ["/api/troubleshooting-flows"],
12 });
13
14 const selectedFlow = flows.find(flow => flow.type === type);
15
16 return (
17 <div className="min-h-screen bg-gray-50">
18 <Header />
19
20 <main className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
21 <div className="mb-6">
22 <h1 className="text-2xl font-medium text-gray-900 mb-2">Troubleshooting Assistant</h1>
23 <p className="text-gray-600">Follow the interactive guide to diagnose and fix your device issues.</p>
24 </div>
25
26 {isLoading ? (
27 <div className="bg-white rounded-xl shadow-material p-6 animate-pulse">
28 <div className="h-6 bg-gray-200 rounded w-1/2 mb-4"></div>
29 <div className="space-y-3">
30 {[...Array(3)].map((_, i) => (
31 <div key={i} className="h-4 bg-gray-200 rounded w-full"></div>
32 ))}
33 </div>
34 </div>
35 ) : (
36 <>
37 <TroubleshootingFlowchart selectedFlow={selectedFlow} />
38
39 {/* Help & Contact Section */}
40 <div className="mt-8 bg-white dark:bg-gray-800 amoled:bg-black rounded-xl shadow-material p-6">
41 <h2 className="text-lg font-medium text-gray-900 dark:text-white mb-4 flex items-center">
42 <i className="material-icons text-primary-700 mr-2">help_center</i>
43 Need Additional Help?
44 </h2>
45
46 <div className="grid md:grid-cols-2 gap-6">
47 <div className="space-y-4">
48 <h3 className="font-medium text-gray-900 dark:text-white">Quick Support Options</h3>
49 <div className="space-y-3 text-sm">
50 <div className="flex items-center">
51 <i className="material-icons text-blue-600 text-lg mr-3">live_help</i>
52 <span>Browse our comprehensive repair guides</span>
53 </div>
54 <div className="flex items-center">
55 <i className="material-icons text-green-600 text-lg mr-3">build</i>
56 <span>Use our software diagnostic tools</span>
57 </div>
58 <div className="flex items-center">
59 <i className="material-icons text-purple-600 text-lg mr-3">search</i>
60 <span>Search for device-specific solutions</span>
61 </div>
62 </div>
63 </div>
64
65 <div className="space-y-4">
66 <h3 className="font-medium text-gray-900 dark:text-white">Contact Support</h3>
67 <div className="bg-gray-50 dark:bg-gray-700 amoled:bg-gray-900 rounded-lg p-4">
68 <div className="flex items-center mb-2">
69 <i className="material-icons text-primary-700 text-lg mr-2">email</i>
70 <span className="font-medium text-gray-900 dark:text-white">Email Support</span>
71 </div>
72 <p className="text-sm text-gray-600 dark:text-gray-400 mb-3">
73 Can't find what you're looking for? Contact our app creator directly:
74 </p>
75 <a
76 href="mailto:JCRguideproofficial@gmail.com"
77 className="inline-flex items-center text-primary-700 hover:text-primary-800 dark:text-primary-400 dark:hover:text-primary-300 font-medium text-sm"
78 >
79 JCRguideproofficial@gmail.com
80 <i className="material-icons text-sm ml-1">open_in_new</i>
81 </a>
82 </div>
83 </div>
84 </div>
85 </div>
86 </>
87 )}
88 </main>
89 </div>
90 );
91 }