import React, { useState, useEffect, useMemo } from 'react'; import { Calendar as CalendarIcon, Clock, Video, ShieldCheck, Star, Search, Filter, User, Heart, AlertCircle, CheckCircle2, PhoneCall, CalendarCheck, ChevronRight, ArrowRight, PawPrint, Stethoscope, Activity, FileText, MessageSquare, Mic, MicOff, VideoOff, X, Plus, Download, Info, Sparkles, ChevronLeft, CalendarClock, Lock, Share2, HelpCircle, Award } from 'lucide-react'; const INITIAL_DOCTORS = [ { id: 'vet-1', name: 'Dr. Sarah Jenkins, DVM', title: 'Canine Specialist & Behavioral Medicine', experience: '12+ years exp.', rating: 4.96, reviewsCount: 342, fee: 45, avatar: 'https://images.unsplash.com/photo-1559839734-2b71ea197ec2?auto=format&fit=crop&q=80&w=400', specialties: ['Dogs', 'Behavior', 'Preventive Care'], bio: 'Dedicated canine practitioner focusing on stress-free consultations, behavioral therapies, and diet management.', education: 'Cornell University College of Vet Medicine', nextAvailable: 'Today, 2:30 PM', availableSlots: [ { id: 's1', time: '10:00 AM', status: 'available' }, { id: 's2', time: '11:30 AM', status: 'booked' }, { id: 's3', time: '02:30 PM', status: 'available' }, { id: 's4', time: '04:00 PM', status: 'available' }, { id: 's5', time: '05:30 PM', status: 'booked' }, ] }, { id: 'vet-2', name: 'Dr. Aris Thorne, MVSc', title: 'Feline Internal Medicine & Senior Pet Vitality', experience: '9 years exp.', rating: 4.92, reviewsCount: 218, fee: 50, avatar: 'https://images.unsplash.com/photo-1622253692010-333f2da6031d?auto=format&fit=crop&q=80&w=400', specialties: ['Cats', 'Kidney Health', 'Nutrition'], bio: 'Board-certified feline medicine practitioner with deep clinical focus on renal wellness, gentle handling, and chronic care.', education: 'Royal Veterinary College (London)', nextAvailable: 'Today, 4:15 PM', availableSlots: [ { id: 's6', time: '09:30 AM', status: 'booked' }, { id: 's7', time: '12:00 PM', status: 'available' }, { id: 's8', time: '04:15 PM', status: 'available' }, { id: 's9', time: '06:00 PM', status: 'available' } ] }, { id: 'vet-3', name: 'Dr. Maya Patel, DVM, DABVP', title: 'Avian & Exotic Pet Health Specialist', experience: '14 years exp.', rating: 4.98, reviewsCount: 412, fee: 60, avatar: 'https://images.unsplash.com/photo-1594824813689-0824b067a9e1?auto=format&fit=crop&q=80&w=400', specialties: ['Birds', 'Exotics', 'Reptiles'], bio: 'Pioneering gentle telemedicine evaluations for parrots, raptors, rabbits, reptiles, and atypical household companions.', education: 'UC Davis School of Veterinary Medicine', nextAvailable: 'Tomorrow, 10:00 AM', availableSlots: [ { id: 's10', time: '10:00 AM', status: 'available' }, { id: 's11', time: '11:00 AM', status: 'available' }, { id: 's12', time: '03:00 PM', status: 'booked' }, { id: 's13', time: '05:00 PM', status: 'available' } ] }, { id: 'vet-4', name: 'Dr. Marcus Lin, BVSc', title: 'Emergency Triage & Acute Trauma Consultant', experience: '8 years exp.', rating: 4.89, reviewsCount: 185, fee: 55, avatar: 'https://images.unsplash.com/photo-1537368910025-700350fe46c7?auto=format&fit=crop&q=80&w=400', specialties: ['Dogs', 'Cats', 'Emergency SOS', 'Trauma'], bio: 'Rapid tele-triage specialist helping parents determine immediate hospital transport needs versus home stabilization.', education: 'University of Sydney Vet Science', nextAvailable: 'Instant (Under 15m)', availableSlots: [ { id: 's14', time: '01:15 PM', status: 'available' }, { id: 's15', time: '02:00 PM', status: 'available' }, { id: 's16', time: '03:30 PM', status: 'available' } ] }, { id: 'vet-5', name: 'Dr. Elena Rostova, DVM', title: 'Veterinary Dermatology & Allergy Care', experience: '11 years exp.', rating: 4.95, reviewsCount: 290, fee: 48, avatar: 'https://images.unsplash.com/photo-1551836022-d5d88e9218df?auto=format&fit=crop&q=80&w=400', specialties: ['Dogs', 'Cats', 'Skin & Coat', 'Allergies'], bio: 'Resolving severe itching, recurring otitis, food hypersensitivities, and environmental allergens through guided telemetry.', education: 'University of Florida CVM', nextAvailable: 'Tomorrow, 1:30 PM', availableSlots: [ { id: 's17', time: '11:15 AM', status: 'available' }, { id: 's18', time: '01:30 PM', status: 'available' }, { id: 's19', time: '04:45 PM', status: 'booked' } ] } ]; const INITIAL_PETS = [ { id: 'pet-1', name: 'Milo', species: 'Dog', breed: 'Golden Retriever', age: '3 yrs', weight: '29 kg', icon: '🐕' }, { id: 'pet-2', name: 'Luna', species: 'Cat', breed: 'British Shorthair', age: '2 yrs', weight: '4.2 kg', icon: '🐈' }, { id: 'pet-3', name: 'Pip', species: 'Bird', breed: 'Cockatiel', age: '1 yr', weight: '95 g', icon: '🦜' }, ]; export default function App() { const [activeTab, setActiveTab] = useState('home'); // 'home' | 'doctors' | 'bookings' | 'telehealth-room' const [selectedDoctor, setSelectedDoctor] = useState(null); const [isBookingOpen, setIsBookingOpen] = useState(false); const [bookingStep, setBookingStep] = useState(1); // 1: Pet, 2: Slot & Calendar, 3: Dual-Sync Blocking, 4: Confirmed // Filtering & Search const [selectedSpeciesFilter, setSelectedSpeciesFilter] = useState('All'); const [searchQuery, setSearchQuery] = useState(''); const [specialtyFilter, setSpecialtyFilter] = useState('All'); // Booking Form const [selectedPet, setSelectedPet] = useState(INITIAL_PETS[0]); const [bookingDate, setBookingDate] = useState(() => { const today = new Date(); return today.toISOString().split('T')[0]; }); const [selectedSlot, setSelectedSlot] = useState(null); const [petConcern, setPetConcern] = useState(''); const [consultationType, setConsultationType] = useState('video'); // 'video' | 'audio' const [syncProgress, setSyncProgress] = useState(0); // Confirmed Bookings Store const [bookings, setBookings] = useState([ { id: 'EV-8842', doctor: INITIAL_DOCTORS[0], pet: INITIAL_PETS[0], date: '2026-09-22', time: '02:30 PM', duration: '30 mins', concern: 'Post-walk paw limping and dietary sensitivity check', status: 'Confirmed', meetingUrl: '#', createdAt: 'Just now' } ]); // Video Consultation Room const [activeCallSession, setActiveCallSession] = useState(null); const [callMuted, setCallMuted] = useState(false); const [callVideoOff, setCallVideoOff] = useState(false); const [chatMessages, setChatMessages] = useState([ { sender: 'vet', text: 'Good day! I have Milo’s records open. Could you show me the affected paw on camera?', time: '02:31 PM' } ]); const [inputMsg, setInputMsg] = useState(''); // Toast const [toastMessage, setToastMessage] = useState(null); const showToast = (msg) => { setToastMessage(msg); setTimeout(() => { setToastMessage(null); }, 4500); }; const filteredDoctors = useMemo(() => { return INITIAL_DOCTORS.filter((doc) => { const matchesSearch = doc.name.toLowerCase().includes(searchQuery.toLowerCase()) || doc.title.toLowerCase().includes(searchQuery.toLowerCase()) || doc.specialties.some(s => s.toLowerCase().includes(searchQuery.toLowerCase())); const matchesSpecies = selectedSpeciesFilter === 'All' || doc.specialties.some(s => s.toLowerCase() === selectedSpeciesFilter.toLowerCase()); const matchesSpecialty = specialtyFilter === 'All' || doc.specialties.includes(specialtyFilter); return matchesSearch && matchesSpecies && matchesSpecialty; }); }, [searchQuery, selectedSpeciesFilter, specialtyFilter]); const startBooking = (doctor) => { setSelectedDoctor(doctor); const firstAvailable = doctor.availableSlots.find(s => s.status === 'available'); setSelectedSlot(firstAvailable ? firstAvailable.time : '02:30 PM'); setBookingStep(1); setIsBookingOpen(true); }; const handleConfirmAndSyncCalendar = () => { setBookingStep(3); setSyncProgress(15); const timer = setInterval(() => { setSyncProgress((prev) => { if (prev >= 100) { clearInterval(timer); const newBooking = { id: `EV-${Math.floor(1000 + Math.random() * 9000)}`, doctor: selectedDoctor, pet: selectedPet, date: bookingDate, time: selectedSlot, duration: '30 mins', concern: petConcern || 'Comprehensive Telehealth Wellness Check', status: 'Confirmed', createdAt: 'Just now' }; setBookings(prevList => [newBooking, ...prevList]); setBookingStep(4); showToast(`Dual-Calendar locked! Reserved with ${selectedDoctor.name}.`); return 100; } return prev + 25; }); }, 420); }; const launchConsultationRoom = (booking) => { setActiveCallSession(booking); setActiveTab('telehealth-room'); setIsBookingOpen(false); }; const handleSendMessage = (e) => { e.preventDefault(); if (!inputMsg.trim()) return; const newMsg = { sender: 'parent', text: inputMsg, time: 'Just now' }; setChatMessages(prev => [...prev, newMsg]); setInputMsg(''); setTimeout(() => { setChatMessages(prev => [ ...prev, { sender: 'vet', text: 'Understood. The joint swelling appears mild. I will log a gentle antiseptic compress regimen into the Rx notes.', time: 'Just now' } ]); }, 1400); }; return (
{/* Dynamic Toast Message */} {toastMessage && (
{toastMessage}
)} {}
{/* Logo & Brand */}
setActiveTab('home')} className="flex items-center gap-3 cursor-pointer select-none group" >
Ether Vets Clinical Dual-Sync

Certified veterinary telehealth & time-blocking

{/* Navigation Pill */} {/* Right Action buttons */}
{}
{/* HOMEPAGE VIEW */} {activeTab === 'home' && (
{/* Hero Section with Blue & Green Gradient */}
{/* Left Column: Hero Content */}
Smart Automated Calendar Synchronization for Pet Parent & Clinic

Veterinary Care Locked into Your{' '} Calendar in Real-Time.

Connect your pet directly with board-certified veterinary doctors. When you click consult, our engine reserves both your digital calendar and the veterinarian’s schedule simultaneously.

{/* CTA Actions */}
{/* Blue & Green Clinical Metrics */}
500+
Licensed Vets
< 15 min
Average Response
100%
Dual-Blocked Time
{/* Right Column: Hero Visual Card */}
{/* Doctor Profile Banner */}
Vet
{INITIAL_DOCTORS[0].name}
Cornell Veterinary Specialist
Online
{/* Interactive Dual-Block Visual Simulation */}
Simultaneous Slot Blocking Live Lock
Today
2:30 PM
Selected
Today
4:00 PM
Available
Today
5:30 PM
Booked
{/* Dual Lock Card Component */}
Both Agendas Reserved Locks parent device calendar & clinical doctor schedule.
{/* Quick Consult Trigger */}
{/* 3-Step Clean Flow Section */}
Transparent Workflow

How EtherVets Connects You

High quality veterinary care with instant, clash-free calendar slot confirmation.

1

Select Your Pet & Doctor

Choose which pet needs attention and browse verified specialists in canine behavioral health, feline medicine, avian, and exotic species.

2

Block Dual Calendars

Select an active time slot. The system automatically locks the time window on both the veterinary doctor's clinical diary and your personal calendar.

3

Live Encrypted Telehealth

Join the consultation room directly inside EtherVets with HD video, interactive chat, symptom review, and instant treatment recommendations.

{/* Species Browsing Categories */}

Specialized Care by Animal

Every companion animal deserves expert attention tailored to their biology

{[ { label: 'Dogs', icon: '🐕', count: '140+ Vets' }, { label: 'Cats', icon: '🐈', count: '115+ Vets' }, { label: 'Birds', icon: '🦜', count: '45+ Vets' }, { label: 'Exotics', icon: '🦎', count: '30+ Vets' }, { label: 'Small Pets', icon: '🐇', count: '60+ Vets' } ].map((cat) => ( ))}
)} {} {activeTab === 'doctors' && (
{/* Header & Emergency Notice */}

Verified Veterinary Specialists

Book an online consultation. Time slots automatically sync with both your calendar and the clinic.

{/* Emergency banner */}
Critical Poison / Hemorrhage? Immediate ER hospital admission advised.
{/* Blue, Green & White Filter Controls */}
{/* Search Bar */}
setSearchQuery(e.target.value)} className="w-full pl-10 pr-4 py-2.5 rounded-xl text-sm bg-slate-50 border border-slate-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white" />
{/* Pet Species Selectors */}
{['All', 'Dogs', 'Cats', 'Birds', 'Exotics'].map((species) => ( ))}
{/* Specialty Dropdown */}
{/* Doctors Grid with Blue & Green Cards */}
{filteredDoctors.map((doctor) => (
{/* Top Doctor Row */}
{doctor.name}

{doctor.name}

{doctor.title}

{doctor.rating} {doctor.reviewsCount} reviews {doctor.experience}
{/* Bio */}

{doctor.bio}

{/* Specialty Badges */}
{doctor.specialties.map((spec) => ( {spec} ))}
{/* Slot Availability preview */}
Next Opening: {doctor.nextAvailable}
{doctor.availableSlots.slice(0, 4).map((slot) => ( {slot.time} ))}
{/* Card Bottom CTA */}
Fee / Session
${doctor.fee} / 30m
))}
{filteredDoctors.length === 0 && (

No veterinary doctors found

Try relaxing your search terms or filter selection.

)}
)} {} {activeTab === 'bookings' && (

My Consultation Schedule

Active time blocks registered across both your personal agenda and the veterinary clinic.

{bookings.length === 0 ? (

No consultations scheduled yet

When you book a doctor, both the clinical calendar and your personal schedule will lock simultaneously.

) : (
{/* Bookings List */}
{bookings.map((booking) => (
{booking.doctor.name}
{booking.status} ID: {booking.id}

{booking.doctor.name}

Patient: {booking.pet.name} ({booking.pet.breed})
{booking.date}
{booking.time} ({booking.duration})

Reason: {booking.concern}

{/* Right Action Block */}
))}
{/* Right Calendar Sync Status Card */}

Dual-Calendar Synchronizer

Active Lock Protection
Clinic Agenda: Locked (No Double Booking)
Pet Parent Agenda: Synced & Alerted
Registered Household Pets
{INITIAL_PETS.map(pet => (
{pet.icon}
{pet.name}
{pet.breed} • {pet.age}
{pet.species}
))}
)}
)} {} {activeTab === 'telehealth-room' && activeCallSession && (

Consultation Room #{activeCallSession.id}

Active stream with {activeCallSession.doctor.name} for {activeCallSession.pet.name}

25:40 remaining
{/* Doctor Video Canvas */}
{/* Doctor Feed */}
Vet in session
{/* Top overlay */}
{activeCallSession.doctor.name} Verified MD
Encrypted • 1080p
{/* Pet Parent PiP */}
{!callVideoOff ? (
{activeCallSession.pet.icon}
You & {activeCallSession.pet.name}
) : (
Camera Disabled
)}
{/* Bottom Control Bar */}
{/* Chat & Clinical Notes */}
{/* Header */}
Consultation Chat & Notes
Active
{/* Messages */}
{chatMessages.map((msg, idx) => (
{msg.text}
{msg.time}
))}
{/* Message Input */}
setInputMsg(e.target.value)} className="flex-1 px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 font-medium" />
)}
{} {isBookingOpen && selectedDoctor && (
{/* Modal Blue & Green Header */}
{selectedDoctor.name}

{selectedDoctor.name}

{selectedDoctor.title} • ${selectedDoctor.fee} per 30m

{/* Stepper Header */}
= 1 ? 'text-blue-900 font-bold' : ''}`}> 1 Pet Details
= 2 ? 'text-blue-900 font-bold' : ''}`}> 2 Slot Picker
= 3 ? 'text-emerald-700 font-bold' : ''}`}> 3 Calendar Lock
{/* Step 1: Pet Details */} {bookingStep === 1 && (
{INITIAL_PETS.map((pet) => (
setSelectedPet(pet)} className={`p-3.5 rounded-2xl border-2 cursor-pointer transition text-center ${ selectedPet.id === pet.id ? 'border-blue-700 bg-blue-50/70 shadow-xs' : 'border-slate-200 hover:border-slate-300 bg-white' }`} > {pet.icon}
{pet.name}
{pet.breed}
))}
{/* Consultation Mode */}
{/* Symptoms Description */}
)} {/* Step 2: Date & Slot Pick with Calendar Blocking Preview */} {bookingStep === 2 && (
Duration: 30 Minutes
setBookingDate(e.target.value)} className="w-full p-3 rounded-xl border border-slate-200 bg-slate-50 text-xs font-bold text-blue-950 focus:ring-2 focus:ring-blue-600 focus:outline-none" />
{/* Real-time Slots */}
Available Locked
{selectedDoctor.availableSlots.map((slot) => { const isSelected = selectedSlot === slot.time; const isBooked = slot.status === 'booked'; return ( ); })}
{/* Calendar Blocking Visual Badge */}
Instant Dual-Calendar Lock Guarantee
Confirming will immediately reserve {selectedSlot} on {selectedDoctor.name}'s schedule and simultaneously create an event block in your calendar.
)} {/* Step 3: Dual Calendar Syncing Engine Simulation */} {bookingStep === 3 && (

Locking Dual Calendars...

Simultaneously reserving the veterinary clinic and pet parent schedules.

{/* Progress bar */}
1. Doctor's Calendar
Slot Locked ({selectedSlot})
2. Pet Parent Calendar
Event Blocked ({selectedPet.name})
)} {/* Step 4: Booking Confirmation with Receipt */} {bookingStep === 4 && (
Time Block Confirmed

Both Calendars Successfully Synced!

Your appointment with {selectedDoctor.name} has been locked into both agendas.

{/* Receipt */}
Patient: {selectedPet.name} ({selectedPet.species})
Scheduled Time Block: {bookingDate} at {selectedSlot}
Consulting Doctor: {selectedDoctor.name}
{/* Next actions */}
)}
)} {}
); }