import React, { useState, useEffect, useMemo } from 'react'; // --- Helper Icons (inline SVG to avoid external dependencies) --- const PlusIcon = () => ( ); const ZapIcon = () => ( ); const TrashIcon = () => ( ); const ChevronRightIcon = () => ( ); const CheckCircleIcon = () => ( ); // --- Logo Component --- const Logo = () => (

GoalBreaker

); // --- AI Simulation Function --- // In a real application, this would be a fetch call to an LLM API. const getAIPlan = (goalTitle) => { return new Promise(resolve => { setTimeout(() => { let tasks = []; const lowerCaseTitle = goalTitle.toLowerCase(); if (lowerCaseTitle.includes("portfolio website")) { tasks = [ { id: Date.now() + 1, title: 'Phase 1: Planning & Design', subtasks: [ { id: Date.now() + 2, title: 'Define target audience and goals' }, { id: Date.now() + 3, title: 'Gather inspiration and create a mood board' }, { id: Date.now() + 4, title: 'Sketch wireframes for key pages' }, { id: Date.now() + 5, title: 'Choose a color scheme and typography' }, ]}, { id: Date.now() + 6, title: 'Phase 2: Content Creation', subtasks: [ { id: Date.now() + 7, title: 'Write "About Me" section' }, { id: Date.now() + 8, title: 'Select and optimize project images/videos' }, { id: Date.now() + 9, title: 'Write project descriptions' }, ]}, { id: Date.now() + 10, title: 'Phase 3: Development', subtasks: [ { id: Date.now() + 11, title: 'Set up development environment' }, { id: Date.now() + 12, title: 'Build out page structure and navigation' }, { id: Date.now() + 13, title: 'Implement responsive design' }, { id: Date.now() + 14, title: 'Add animations and interactive elements' }, ]}, { id: Date.now() + 15, title: 'Phase 4: Deployment & Launch', subtasks: [ { id: Date.now() + 16, title: 'Purchase a domain name and hosting' }, { id: Date.now() + 17, title: 'Test for bugs and compatibility' }, { id: Date.now() + 18, title: 'Deploy the website' }, { id: Date.now() + 19, title: 'Announce the launch' }, ]}, ]; } else if (lowerCaseTitle.includes("run a 5k")) { tasks = [ { id: Date.now() + 1, title: 'Week 1-2: Build a Base', subtasks: [ { id: Date.now() + 2, title: 'Get proper running shoes' }, { id: Date.now() + 3, title: '3x weekly: 20-min run/walk intervals' }, { id: Date.now() + 4, title: '1x weekly: Cross-train' }, ]}, { id: Date.now() + 5, title: 'Week 3-4: Increase Endurance', subtasks: [ { id: Date.now() + 6, title: '3x weekly: Increase running intervals' }, { id: Date.now() + 7, title: 'Introduce one longer run (2 miles)' }, ]}, { id: Date.now() + 8, title: 'Week 5-6: Build Stamina', subtasks: [ { id: Date.now() + 9, title: 'Incorporate one day of hill repeats' }, { id: Date.now() + 10, title: 'Long run increases to 3 miles' }, ]}, { id: Date.now() + 11, title: 'Week 7-8: Taper & Race Prep', subtasks: [ { id: Date.now() + 12, title: 'Reduce mileage to recover' }, { id: Date.now() + 13, title: 'Practice race day nutrition' }, { id: Date.now() + 14, title: 'Plan race day logistics' }, { id: Date.now() + 15, title: 'Race Day!' }, ]}, ]; } else { tasks = [ { id: Date.now() + 1, title: 'Discovery & Research', subtasks: [ { id: Date.now() + 2, title: 'Clearly define final outcome' }, { id: Date.now() + 3, title: 'Research best practices' }, ]}, { id: Date.now() + 4, title: 'Planning', subtasks: [ { id: Date.now() + 5, title: 'Break down into major phases' }, { id: Date.now() + 6, title: 'Estimate timelines for each phase' }, ]}, { id: Date.now() + 7, title: 'Execution', subtasks: [ { id: Date.now() + 8, title: 'Work on Phase 1 tasks' }, { id: Date.now() + 9, title: 'Regularly review progress' }, ]}, { id: Date.now() + 10, title: 'Review & Completion', subtasks: [ { id: Date.now() + 11, title: 'Final review of completed work' }, { id: Date.now() + 12, title: 'Share or launch the project' }, ]}, ]; } const plan = tasks.map(task => ({ ...task, completed: false, subtasks: task.subtasks.map(subtask => ({ ...subtask, completed: false })) })); resolve(plan); }, 1500); }); }; // --- Core App Components --- function Task({ task, onToggle }) { return (
onToggle(task.id)} role="button" tabIndex="0" > {}} className="form-checkbox h-5 w-5 rounded bg-slate-700 border-slate-600 text-cyan-500 focus:ring-cyan-500 cursor-pointer" /> {task.title}
); } function TaskGroup({ group, onToggleSubtask }) { const [isOpen, setIsOpen] = useState(true); const groupProgress = useMemo(() => { const totalSubtasks = group.subtasks.length; if (totalSubtasks === 0) return 0; const completedSubtasks = group.subtasks.filter(st => st.completed).length; return (completedSubtasks / totalSubtasks) * 100; }, [group.subtasks]); return (
setIsOpen(!isOpen)}>

{group.title}

{isOpen && (
{group.subtasks.map(subtask => ( onToggleSubtask(group.id, subtask.id)} /> ))}
)}
); } function GoalDetail({ goal, onUpdateGoal, onBack, onDeleteGoal }) { const [isLoading, setIsLoading] = useState(false); const handleDeconstruct = async () => { setIsLoading(true); const plan = await getAIPlan(goal.title); onUpdateGoal({ ...goal, tasks: plan }); setIsLoading(false); }; const handleToggleSubtask = (groupId, subtaskId) => { const updatedTasks = goal.tasks.map(group => { if (group.id === groupId) { return { ...group, subtasks: group.subtasks.map(subtask => subtask.id === subtaskId ? { ...subtask, completed: !subtask.completed } : subtask )}; } return group; }); onUpdateGoal({ ...goal, tasks: updatedTasks }); }; const overallProgress = useMemo(() => { if (!goal.tasks || goal.tasks.length === 0) return 0; const allSubtasks = goal.tasks.flatMap(g => g.subtasks); if (allSubtasks.length === 0) return 0; const completedSubtasks = allSubtasks.filter(st => st.completed).length; return Math.round((completedSubtasks / allSubtasks.length) * 100); }, [goal.tasks]); return (

{goal.title}

Target Date: {goal.targetDate || 'Not set'}

Overall Progress {overallProgress}%
{goal.tasks && goal.tasks.length > 0 ? (
{goal.tasks.map(group => ( ))}
) : (

This goal has no tasks yet.

Let our AI assistant break it down into manageable steps for you.

)}
); } function AddGoalForm({ onAddGoal }) { const [title, setTitle] = useState(''); const [targetDate, setTargetDate] = useState(''); const handleSubmit = (e) => { e.preventDefault(); if (!title.trim()) return; onAddGoal({ title, targetDate, id: Date.now(), tasks: [] }); setTitle(''); setTargetDate(''); }; return (

Create a New Goal

setTitle(e.target.value)} placeholder="Enter a new goal..." className="flex-grow bg-slate-800 text-white border border-slate-700 rounded-lg p-3 focus:ring-2 focus:ring-cyan-500 focus:outline-none" /> setTargetDate(e.target.value)} className="bg-slate-800 text-white border border-slate-700 rounded-lg p-3 focus:ring-2 focus:ring-cyan-500 focus:outline-none" />
); } function GoalCard({ goal, onSelectGoal }) { const progress = useMemo(() => { if (!goal.tasks || goal.tasks.length === 0) return 0; const allSubtasks = goal.tasks.flatMap(g => g.subtasks); if (allSubtasks.length === 0) return 0; const completedSubtasks = allSubtasks.filter(st => st.completed).length; return Math.round((completedSubtasks / allSubtasks.length) * 100); }, [goal.tasks]); return (
onSelectGoal(goal)} className="bg-slate-900/70 backdrop-blur-sm border border-slate-800 rounded-xl p-5 cursor-pointer hover:border-cyan-400 hover:shadow-2xl hover:shadow-cyan-900/50 transition-all transform hover:-translate-y-1">

{goal.title}

{goal.targetDate || 'No date set'}

{progress}% complete
); } function GoalList({ goals, onSelectGoal }) { return (
{goals.length === 0 ? (

Welcome to your Dashboard!

You have no goals yet. Add one above to get started.

) : (
{goals.map(goal => ( ))}
)}
); } function AboutPage() { return (

About GoalBreaker

Company Overview

Founded in 2025, GoalBreaker was created to address the universal challenge of procrastination. We believe that every great achievement starts with a single, manageable step. Our platform is designed to provide the structure and motivation needed to turn ambitious dreams into tangible realities for creators, professionals, and lifelong learners everywhere.

Our Vision

To help individuals transform overwhelming goals into small, achievable tasks, fostering consistent progress and boosting productivity.

Our Mission

GoalBreaker empowers users to break down large goals into manageable steps, providing tools for prioritization, tracking, and motivation to reduce procrastination and ensure sustained productivity.

Our Goal

To provide a simple, intuitive, and powerful tool that empowers anyone to turn their ambitions into real accomplishments through structured planning and consistent, focused action.

); } // --- Landing Page Components --- const LandingPage = ({ onNavigate }) => (
{/* Hero Section */}

Turn Your Big Goals Into Achievable Steps

GoalBreaker helps you break down overwhelming tasks into manageable actions, making productivity feel easy and achievable.

{/* Features Section */}

How GoalBreaker Helps You Succeed

{/* Testimonials Section */}

Why People Love GoalBreaker

); const FeatureCard = ({ title, description }) => (

{title}

{description}

); const TestimonialCard = ({ quote, name, role }) => (

"{quote}"

{name}

{role}

); // --- Main App Component --- export default function App() { const [goals, setGoals] = useState(() => { try { const savedGoals = localStorage.getItem('goalBreakerGoals'); return savedGoals ? JSON.parse(savedGoals) : []; } catch (error) { console.error("Could not parse goals from localStorage", error); return []; } }); const [currentPage, setCurrentPage] = useState('landing'); // 'landing', 'dashboard', 'goalDetail', 'about' const [selectedGoal, setSelectedGoal] = useState(null); useEffect(() => { try { localStorage.setItem('goalBreakerGoals', JSON.stringify(goals)); } catch (error) { console.error("Could not save goals to localStorage", error); } }, [goals]); // Effect to load the Zapier chatbot script useEffect(() => { const script = document.createElement('script'); script.src = 'https://interfaces.zapier.com/assets/web-components/zapier-interfaces/zapier-interfaces.esm.js'; script.async = true; script.type = 'module'; document.body.appendChild(script); // Cleanup the script when the component unmounts return () => { // Check if the script is still in the body before trying to remove it if (script.parentNode) { document.body.removeChild(script); } }; }, []); // Empty array ensures this effect runs only once const handleAddGoal = (newGoal) => { setGoals([...goals, newGoal]); }; const handleUpdateGoal = (updatedGoal) => { setGoals(goals.map(g => g.id === updatedGoal.id ? updatedGoal : g)); if (selectedGoal && selectedGoal.id === updatedGoal.id) { setSelectedGoal(updatedGoal); } }; const handleDeleteGoal = (goalId) => { setGoals(goals.filter(g => g.id !== goalId)); setCurrentPage('dashboard'); setSelectedGoal(null); }; const handleSelectGoal = (goal) => { setSelectedGoal(goal); setCurrentPage('goalDetail'); }; const renderContent = () => { switch (currentPage) { case 'goalDetail': return setCurrentPage('dashboard')} onDeleteGoal={handleDeleteGoal} />; case 'about': return ; case 'dashboard': return (
); case 'landing': default: return ; } }; return (
{/* Keyframe animation for smooth transitions and new background */}
{renderContent()}

Deconstruct your ambitions. Conquer your goals.

© {new Date().getFullYear()} GoalBreaker. All Rights Reserved.
{/* This renders the Zapier chatbot after the script is loaded */}
); }