// import React, { useState, useEffect } from 'react'; // import { // Brain, Sparkles, CheckCircle, XCircle, ChevronRight, RotateCcw, // ThumbsUp, Award, Clock, Heart, Shield, Lightbulb, ArrowRight, // MessageCircle, TrendingUp, Users, Menu, X // } from 'lucide-react'; // // --- Type Definitions (Interfaces) --- // interface DistortionResult { // has_distortion: boolean; // distortion_types: string[]; // explanation: string; // } // interface AnalysisResult { // emotional_impact: string; // underlying_beliefs: string[]; // triggers: string[]; // recommended_therapies: string[]; // } // interface Candidate { // therapy: string; // reframe: string; // rationale: string; // evaluation?: { // [key: string]: number; // Allow dynamic evaluation keys like 'empathy', 'logic' // }; // } // interface FormData { // situation: string; // thought: string; // } // const API_BASE_URL = 'http://localhost:8000/api'; // const CognitiveReframingPlatform = () => { // const [currentPage, setCurrentPage] = useState('home'); // const [mobileMenuOpen, setMobileMenuOpen] = useState(false); // const [step, setStep] = useState(1); // const [formData, setFormData] = useState({ // situation: '', // thought: '' // }); // // State with explicit types allowing null // const [sessionId, setSessionId] = useState(null); // const [distortionResult, setDistortionResult] = useState(null); // const [analysis, setAnalysis] = useState(null); // const [candidates, setCandidates] = useState([]); // Array of Candidates // const [selectedReframe, setSelectedReframe] = useState(null); // const [loading, setLoading] = useState(false); // const [error, setError] = useState(null); // useEffect(() => { // // Initialize session // const initSession = async () => { // try { // const response = await fetch(`${API_BASE_URL}/session/init`, { // method: 'POST', // headers: { 'Content-Type': 'application/json' } // }); // const data = await response.json(); // setSessionId(data.session_id); // } catch (err) { // console.error('Session init failed:', err); // setSessionId('demo-session-' + Date.now()); // } // }; // initSession(); // }, []); // const Navigation = () => ( // // ); // const HomePage = () => ( //
// {/* Hero Section */} //
//
//
//
//
//
//
//
//

// Transform Your // Thoughts //

//

// Evidence-based cognitive reframing powered by AI and multiple therapeutic approaches. // Find the perspective that works for you. //

//
// // //
//
//
//
//
//
//
//
//
// //
//
//
//
//
//
//
//
// //
//
//
//
//
//
//
//
// //
//
//
//
//
//
//
//
//
//
//
//
//
// {/* Features Section */} //
//
//
//

Why MindReframe?

//

Science-backed features designed for your well-being

//
//
//
//
// //
//

Evidence-Based

//

// Built on proven therapeutic frameworks including CBT, ACT, DBT, and 9 other modalities studied in clinical research. //

//
//
//
// //
//

Personalized

//

// Choose the therapeutic approach that resonates with you. Different perspectives for different people. //

//
//
//
// //
//

AI-Powered

//

// Advanced language models trained to provide empathetic, safe, and clinically appropriate reframes. //

//
//
//
//
// {/* How It Works */} //
//
//
//

How It Works

//

Your journey to healthier thinking in 5 simple steps

//
//
// {[ // { icon: MessageCircle, title: 'Share', desc: 'Tell us your situation and thoughts' }, // { icon: Brain, title: 'Detect', desc: 'We identify cognitive distortions' }, // { icon: TrendingUp, title: 'Analyze', desc: 'Deep analysis of thought patterns' }, // { icon: Sparkles, title: 'Reframe', desc: 'Multiple therapeutic perspectives' }, // { icon: Heart, title: 'Choose', desc: 'Select what works for you' } // ].map((item, idx) => ( //
//
// //
//

{item.title}

//

{item.desc}

//
// ))} //
//
//
// {/* CTA Section */} //
//
//

Ready to Transform Your Thinking?

//

// Join thousands who have discovered healthier perspectives through cognitive reframing //

// //
//
//
// ); // const AboutPage = () => ( //
//
//

About MindReframe

//
//

Our Mission

//

// MindReframe combines cutting-edge AI technology with evidence-based psychotherapy to make mental health // support accessible, personalized, and effective for everyone. //

//

// We believe that mental well-being should be within reach for all, and that the right perspective // can make a profound difference in how we experience life's challenges. //

//
//
//

The Science Behind It

//

// Our platform is built on ReframeBench, a comprehensive benchmark evaluating large // language models across 12 distinct therapeutic modalities. This research ensures that our AI // provides clinically appropriate and safe cognitive reframes. //

//

// We integrate principles from CBT, ACT, DBT, REBT, Schema Therapy, MBCT, CFT, Narrative Therapy, // SFBT, and Motivational Interviewing - giving you access to diverse therapeutic perspectives. //

//
//
//

Important Note

//

// MindReframe is designed as a self-help tool and educational resource. It is not a replacement // for professional mental health care. If you're experiencing severe distress, please reach out // to a qualified mental health professional. //

//
//
//
// ); // const TherapiesPage = () => ( //
//
//

Therapeutic Approaches

//

// Explore the diverse perspectives we offer //

//
// {[ // { name: 'CBT', full: 'Cognitive Behavioral Therapy', color: 'indigo', desc: 'Challenge and change unhelpful thoughts through evidence and logic' }, // { name: 'ACT', full: 'Acceptance & Commitment Therapy', color: 'purple', desc: 'Accept thoughts and commit to value-driven actions' }, // { name: 'DBT', full: 'Dialectical Behavior Therapy', color: 'pink', desc: 'Balance acceptance with change through mindfulness' }, // { name: 'REBT', full: 'Rational Emotive Behavior Therapy', color: 'blue', desc: 'Dispute irrational beliefs with rational alternatives' }, // { name: 'MBCT', full: 'Mindfulness-Based Cognitive Therapy', color: 'green', desc: 'Combine mindfulness with cognitive techniques' }, // { name: 'CFT', full: 'Compassion-Focused Therapy', color: 'rose', desc: 'Cultivate self-compassion and kindness' }, // { name: 'Schema Therapy', full: 'Schema Therapy', color: 'violet', desc: 'Identify and heal deep-rooted patterns' }, // { name: 'Narrative', full: 'Narrative Therapy', color: 'amber', desc: 'Rewrite your story and externalize problems' }, // { name: 'SFBT', full: 'Solution-Focused Brief Therapy', color: 'cyan', desc: 'Focus on solutions rather than problems' }, // { name: 'MI', full: 'Motivational Interviewing', color: 'emerald', desc: 'Enhance motivation for positive change' } // ].map((therapy, idx) => ( //
//

{therapy.name}

//

{therapy.full}

//

{therapy.desc}

//
// ))} //
//
//
// ); // const detectDistortion = async () => { // setLoading(true); // setError(null); // try { // const response = await fetch(`${API_BASE_URL}/detect`, { // method: 'POST', // headers: { 'Content-Type': 'application/json' }, // body: JSON.stringify({ // session_id: sessionId, // situation: formData.situation, // thought: formData.thought // }) // }); // if (!response.ok) throw new Error('Detection failed'); // const data = await response.json(); // setDistortionResult(data); // if (data.has_distortion) { // setStep(2); // } // } catch (err) { // setError('Failed to detect distortions. Please try again.'); // console.error(err); // } // setLoading(false); // }; // const analyzeThought = async () => { // if (!distortionResult) return; // setLoading(true); // setError(null); // try { // const response = await fetch(`${API_BASE_URL}/analyze`, { // method: 'POST', // headers: { 'Content-Type': 'application/json' }, // body: JSON.stringify({ // session_id: sessionId, // situation: formData.situation, // thought: formData.thought, // distortions: distortionResult.distortion_types // }) // }); // if (!response.ok) throw new Error('Analysis failed'); // const data = await response.json(); // setAnalysis(data); // setStep(3); // } catch (err) { // setError('Failed to analyze thought. Please try again.'); // console.error(err); // } // setLoading(false); // }; // const generateCandidates = async () => { // if (!analysis) return; // setLoading(true); // setError(null); // try { // const response = await fetch(`${API_BASE_URL}/reframe`, { // method: 'POST', // headers: { 'Content-Type': 'application/json' }, // body: JSON.stringify({ // session_id: sessionId, // situation: formData.situation, // thought: formData.thought, // recommended_therapies: analysis.recommended_therapies // }) // }); // if (!response.ok) throw new Error('Generation failed'); // const data = await response.json(); // setCandidates(data.candidates); // setStep(4); // } catch (err) { // setError('Failed to generate reframes. Please try again.'); // console.error(err); // } // setLoading(false); // }; // const saveSelection = async () => { // if (selectedReframe === null) return; // try { // await fetch(`${API_BASE_URL}/save`, { // method: 'POST', // headers: { 'Content-Type': 'application/json' }, // body: JSON.stringify({ // session_id: sessionId, // selected_reframe: candidates[selectedReframe], // original_thought: formData.thought // }) // }); // setStep(5); // } catch (err) { // console.error('Failed to save selection:', err); // setStep(5); // Continue anyway // } // }; // const reset = () => { // setStep(1); // setFormData({ situation: '', thought: '' }); // setDistortionResult(null); // setAnalysis(null); // setCandidates([]); // setSelectedReframe(null); // setError(null); // }; // const AppPage = () => ( //
//
// {/* Progress Bar */} //
//
// {['Input', 'Detect', 'Analyze', 'Reframe', 'Select'].map((label, idx) => ( // //
//
idx + 1 ? 'bg-green-500 text-white shadow-lg scale-110' : // step === idx + 1 ? 'bg-indigo-600 text-white shadow-lg animate-pulse' : // 'bg-gray-200 text-gray-400' // }`}> // {step > idx + 1 ? : idx + 1} //
// {label} //
// {idx < 4 &&
idx + 1 ? 'bg-green-500' : 'bg-gray-200'}`}>
} //
// ))} //
//
// {error && ( //
// //

{error}

//
// )} // {/* Step 1: Input */} // {step === 1 && ( //
//
//
// //
//

Share Your Thoughts

//
//

// Let's start by understanding what's on your mind. Be as honest and detailed as you'd like. //

//
// //