import React, { useState } from 'react';
import { ChevronRight, Tool, AlertCircle, CheckCircle, Phone } from 'lucide-react';
export default function ApplianceDiagnostic() {
const [step, setStep] = useState('appliance'); // appliance, symptoms, results, contact
const [selectedAppliance, setSelectedAppliance] = useState(null);
const [selectedSymptoms, setSelectedSymptoms] = useState([]);
const [contactInfo, setContactInfo] = useState({ name: '', phone: '', email: '' });
const [submitted, setSubmitted] = useState(false);
const appliances = [
{ id: 'refrigerator', name: 'Refrigerator', icon: '❄️' },
{ id: 'dishwasher', name: 'Dishwasher', icon: '🍽️' },
{ id: 'washer', name: 'Washing Machine', icon: '🌊' },
{ id: 'dryer', name: 'Dryer', icon: '🔥' },
{ id: 'oven', name: 'Oven/Range', icon: '🍳' },
{ id: 'microwave', name: 'Microwave', icon: '📡' },
];
const symptoms = {
refrigerator: [
{ symptom: 'Not cooling properly', issue: 'Compressor or thermostat may be faulty', severity: 'high' },
{ symptom: 'Leaking water inside', issue: 'Clogged drain line or defrost issue', severity: 'high' },
{ symptom: 'Making strange noises', issue: 'Fan or compressor bearing wear', severity: 'medium' },
{ symptom: 'Ice buildup in freezer', issue: 'Door seal issue or defrost system problem', severity: 'medium' },
{ symptom: 'Not starting/no power', issue: 'Power supply or control board failure', severity: 'high' },
],
dishwasher: [
{ symptom: 'Not draining water', issue: 'Clogged drain or pump failure', severity: 'high' },
{ symptom: 'Dishes still dirty after cycle', issue: 'Spray arm blockage or pump issue', severity: 'medium' },
{ symptom: 'Leaking water', issue: 'Door seal worn or pump seal failure', severity: 'high' },
{ symptom: 'Not starting', issue: 'Control board or door latch issue', severity: 'high' },
{ symptom: 'Strange odors', issue: 'Food debris or mold in filter', severity: 'low' },
],
washer: [
{ symptom: 'Not draining', issue: 'Clogged drain hose or pump failure', severity: 'high' },
{ symptom: 'Leaking water', issue: 'Hose connection loose or seal worn', severity: 'high' },
{ symptom: 'Making loud noise during spin', issue: 'Drum bearing or foreign object', severity: 'high' },
{ symptom: 'Not spinning/clothes soaking wet', issue: 'Motor or belt issue', severity: 'high' },
{ symptom: 'Won\'t fill with water', issue: 'Inlet valve or water supply issue', severity: 'medium' },
],
dryer: [
{ symptom: 'Not heating', issue: 'Heating element or thermal fuse failure', severity: 'high' },
{ symptom: 'Taking too long to dry', issue: 'Clogged vent or airflow issue', severity: 'medium' },
{ symptom: 'Not tumbling', issue: 'Belt or pulley failure', severity: 'high' },
{ symptom: 'Making squeaking noise', issue: 'Drum roller or idler wear', severity: 'medium' },
{ symptom: 'Not starting', issue: 'Door latch or thermal fuse blown', severity: 'high' },
],
oven: [
{ symptom: 'Not heating', issue: 'Heating element or ignitor failure', severity: 'high' },
{ symptom: 'Temperature not accurate', issue: 'Thermostat or sensor issue', severity: 'medium' },
{ symptom: 'Door won\'t close properly', issue: 'Door hinge or latch broken', severity: 'medium' },
{ symptom: 'Self-cleaning not working', issue: 'Latch or control board issue', severity: 'low' },
{ symptom: 'Smoking or burning smells', issue: 'Food debris or heating element issue', severity: 'high' },
],
microwave: [
{ symptom: 'Not heating food', issue: 'Magnetron failure or high voltage issue', severity: 'high' },
{ symptom: 'Not turning on', issue: 'Power supply or control board failure', severity: 'high' },
{ symptom: 'Sparking inside', issue: 'Metal in microwave or waveguide damage', severity: 'high' },
{ symptom: 'Display not working', issue: 'Control board failure', severity: 'medium' },
{ symptom: 'Making weird noises', issue: 'Turntable motor or fan issue', severity: 'low' },
],
};
const handleApplianceSelect = (applianceId) => {
setSelectedAppliance(applianceId);
setSelectedSymptoms([]);
setStep('symptoms');
};
const handleSymptomToggle = (symptomIndex) => {
setSelectedSymptoms(prev =>
prev.includes(symptomIndex)
? prev.filter(i => i !== symptomIndex)
: [...prev, symptomIndex]
);
};
const handleGetResults = () => {
if (selectedSymptoms.length > 0) {
setStep('results');
}
};
const handleContactSubmit = (e) => {
e.preventDefault();
if (contactInfo.name && contactInfo.phone) {
setSubmitted(true);
// In a real scenario, you'd send this to your server/email
console.log('Contact submitted:', contactInfo);
}
};
const getSeverityColor = (severity) => {
switch (severity) {
case 'high':
return 'text-red-600 bg-red-50';
case 'medium':
return 'text-yellow-600 bg-yellow-50';
case 'low':
return 'text-green-600 bg-green-50';
default:
return 'text-gray-600 bg-gray-50';
}
};
const selectedApplianceName = appliances.find(a => a.id === selectedAppliance)?.name;
const appliance = symptoms[selectedAppliance];
return (
{/* Header */}
Appliance Diagnostic
Jupiter Appliance Repair - Quick Problem Identification
{/* Step 1: Select Appliance */}
{step === 'appliance' && (
What appliance needs repair?
{appliances.map(app => (
handleApplianceSelect(app.id)}
className="p-4 rounded-lg border-2 border-gray-200 hover:border-indigo-500 hover:bg-indigo-50 transition-all duration-200 text-center group"
>
{app.icon}
{app.name}
))}
)}
{/* Step 2: Select Symptoms */}
{step === 'symptoms' && (
setStep('appliance')}
className="text-indigo-600 hover:text-indigo-800 font-medium text-sm flex items-center gap-1"
>
← Back
Select symptoms for your {selectedApplianceName}
{appliance.map((item, idx) => (
handleSymptomToggle(idx)}
className="w-5 h-5 text-indigo-600 rounded mt-1"
/>
{item.symptom}
{item.issue}
))}
Get Diagnostic Results
)}
{/* Step 3: Results */}
{step === 'results' && (
setStep('symptoms')}
className="text-indigo-600 hover:text-indigo-800 font-medium text-sm flex items-center gap-1"
>
← Back
Diagnostic Results
{/* Selected symptoms with analysis */}
{selectedSymptoms.map(idx => {
const item = appliance[idx];
return (
{item.severity === 'high' ? (
) : (
)}
{item.symptom}
⚙️ Likely cause: {item.issue}
{item.severity === 'high' && '🔴 Requires professional service'}
{item.severity === 'medium' && '🟡 Should be serviced soon'}
{item.severity === 'low' && '🟢 May be fixable easily'}
);
})}
{/* Recommendation */}
📋 Our Recommendation:
Based on your appliance's symptoms, we recommend scheduling a professional service call.
Our Jupiter service team can provide accurate diagnosis and repairs.
setStep('contact')}
className="w-full bg-green-600 hover:bg-green-700 text-white font-bold py-3 rounded-lg transition-colors flex items-center justify-center gap-2"
>
Schedule Service Call
)}
{/* Step 4: Contact Form */}
{step === 'contact' && !submitted && (
setStep('results')}
className="text-indigo-600 hover:text-indigo-800 font-medium text-sm flex items-center gap-1"
>
← Back
Request Service
)}
{/* Submission Confirmation */}
{submitted && (
Request Submitted!
Thank you, {contactInfo.name} ! We received your service request.
Our Jupiter team will contact you at {contactInfo.phone} within 24 hours to schedule your appointment.
{
setStep('appliance');
setSelectedAppliance(null);
setSelectedSymptoms([]);
setContactInfo({ name: '', phone: '', email: '' });
setSubmitted(false);
}}
className="bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-3 px-6 rounded-lg transition-colors"
>
Start Over
)}
{/* Footer */}
Jupiter Appliance Repair • Serving the Local Community
⚠️ Emergency repairs available • Free diagnostic consultation
);
}
Comments
Post a Comment