import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; export default function GoalTracker() { const [goal, setGoal] = useState(""); const [goals, setGoals] = useState([]); const addGoal = () => { if (goal.trim() === "") return; setGoals([...goals, { text: goal, completed: false }]); setGoal(""); }; const completeGoal = (index) => { const updatedGoals = [...goals]; updatedGoals[index].completed = true; setGoals(updatedGoals); }; return (

My Goals

setGoal(e.target.value)} placeholder="Write your goal here" className="flex-1 p-2 rounded border" />
{goals.map((g, i) => ( {g.text} {!g.completed && ( )} ))}
); }