import React, { useState, useEffect, useCallback } from 'react'; import { UserProfile, AppStep, ScheduledCall, Message, MatchSuggestion } from './types'; import { INTEREST_OPTIONS, MOCK_USERS } from './constants'; import Layout from './components/Layout'; import { getMatchingAdvice, getIcebreaker } from './services/geminiService'; // Fix: Added missing icon imports from lucide-react to resolve "Cannot find name" errors import { CheckCircle2, Clock, Video, Plus, ArrowRight, Send, Search, Zap, Star, Calendar, Trophy, MessageSquare } from 'lucide-react'; const App: React.FC = () => { const [step, setStep] = useState(AppStep.WELCOME); const [activeTab, setActiveTab] = useState('dashboard'); const [user, setUser] = useState(null); const [matchingAdvice, setMatchingAdvice] = useState<MatchSuggestion[]>([]); const [calls, setCalls] = useState<ScheduledCall[]>([]); const [messages, setMessages] = useState<Message[]>([]); const [selectedPartnerId, setSelectedPartnerId] = useState(null); const [loadingMatching, setLoadingMatching] = useState(false); // Registration State const [regData, setRegData] = useState({ name: '', bio: '', interests: [] as string[], goals: [] as string[] }); // Persist session locally useEffect(() => { const savedUser = localStorage.getItem('focusSyncUser'); if (savedUser) { setUser(JSON.parse(savedUser)); setStep(AppStep.DASHBOARD); } }, []); const handleCompleteRegistration = async () => { const newUser: UserProfile = { id: 'u1', name: regData.name, avatar: `https://ui-avatars.com/api/?name=${regData.name}&background=random`, bio: regData.bio, interests: regData.interests, goals: regData.goals, role: 'member', timezone: Intl.DateTimeFormat().resolvedOptions().timeZone }; setUser(newUser); localStorage.setItem('focusSyncUser', JSON.stringify(newUser)); setStep(AppStep.DASHBOARD); }; const handleTabChange = (tabId: string) => { setActiveTab(tabId); if (tabId === 'matching' && user) { loadMatches(); } }; const loadMatches = async () => { if (!user) return; setLoadingMatching(true); const advice = await getMatchingAdvice(user, MOCK_USERS as UserProfile[]); setMatchingAdvice(advice); setLoadingMatching(false); }; const scheduleCall = (partnerId: string, duration: 5 | 10 | 15) => { const newCall: ScheduledCall = { id: Math.random().toString(36).substr(2, 9), partnerId, startTime: new Date(Date.now() + 3600000).toISOString(), // 1 hour from now duration, platform: 'Google Meet', meetingUrl: 'https://meet.google.com/abc-defg-hij', status: 'upcoming' }; setCalls([...calls, newCall]); setActiveTab('dashboard'); alert(`Accountability call scheduled for 1 hour from now! Check your dashboard.`); }; const sendMessage = (content: string) => { if (!user || !selectedPartnerId) return; const newMessage: Message = { id: Math.random().toString(36).substr(2, 9), senderId: user.id, receiverId: selectedPartnerId, content, timestamp: new Date().toISOString() }; setMessages([...messages, newMessage]); }; const onLogout = () => { localStorage.removeItem('focusSyncUser'); setUser(null); setStep(AppStep.WELCOME); }; // Views const WelcomeView = () => (

F

FocusSync

The ultimate accountability community. Connect for 5, 10, or 15 minute sprints and crush your goals.

Join 10,000+ high achievers worldwide.

); const ProfileStep = () => (

Create your profile

Tell us a bit about yourself so we can find your perfect matches.

setRegData({...regData, name: e.target.value})} />

 

Close

50% Complete

Two Step

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.