import React, { useRef, useState, useEffect } from "react"; import { ArrowDown, Check, BookOpen, AlertTriangle, Zap } from "lucide-react"; import { PracticeFromDataset } from "../../../components/lessons/LessonShell"; import { BOUNDARIES_EASY, BOUNDARIES_MEDIUM, } from "../../../data/rw/boundaries"; import ClauseBreakdownWidget, { type ClauseExample, } from "../../../components/lessons/ClauseBreakdownWidget"; import DecisionTreeWidget, { type TreeScenario, type TreeNode, } from "../../../components/lessons/DecisionTreeWidget"; interface LessonProps { onFinish?: () => void; } // ── Clause Breakdown data ────────────────────────────────────────────────── const CLAUSE_EXAMPLES: ClauseExample[] = [ { title: "Semicolon — Joining Two ICs", segments: [ { text: "The experiment was a success", type: "ic", label: "Independent Clause", }, { text: ";", type: "punct" }, { text: " the team celebrated", type: "ic", label: "Independent Clause" }, { text: ".", type: "punct" }, ], }, { title: "Semicolon + Conjunctive Adverb", segments: [ { text: "The data was incomplete", type: "ic", label: "Independent Clause", }, { text: ";", type: "punct" }, { text: " however", type: "conjunction", label: "Conjunctive Adverb" }, { text: ",", type: "punct" }, { text: " the conclusions remained valid", type: "ic", label: "Independent Clause", }, { text: ".", type: "punct" }, ], }, { title: "Colon — Introduction", segments: [ { text: "The study revealed one key finding", type: "ic", label: "Complete Sentence", }, { text: ":", type: "punct" }, { text: " memory improves with spaced repetition", type: "ic", label: "What the colon introduces", }, { text: ".", type: "punct" }, ], }, ]; // ── Decision Tree data ───────────────────────────────────────────────────── const TREE_ROOT: TreeNode = { id: "root", question: "Is this a SEMICOLON or COLON question?", hint: "Look at the punctuation options: does the question ask about ; or :?", yesLabel: "Semicolon (;)", noLabel: "Colon (:)", yes: { id: "semicolon", question: "Is the word AFTER the semicolon a conjunctive adverb (however, therefore, moreover, thus, consequently, furthermore)?", hint: "These are NOT FANBOYS conjunctions. They look like transitions.", yesLabel: "Yes — conjunctive adverb follows", noLabel: "No — regular sentence follows", yes: { id: "semi-conjunctive", result: "✓ Correct use! Semicolon before the conjunctive adverb, comma after it.", resultType: "correct", ruleRef: "[IC]; [conjunctive adverb], [IC]", }, no: { id: "semi-no-conj", question: "Can BOTH sides stand alone as complete sentences?", yesLabel: "Yes — both are complete sentences", noLabel: "No — one side is incomplete", yes: { id: "semi-both-ic", result: "✓ Correct! A semicolon joins two related independent clauses.", resultType: "correct", ruleRef: "[IC]; [IC]", }, no: { id: "semi-fragment", result: "⚠ Error! A semicolon requires COMPLETE sentences on both sides. If one side is a phrase or clause, the semicolon is wrong.", resultType: "warning", ruleRef: "Both sides must be independent clauses", }, }, }, no: { id: "colon", question: "Is the part BEFORE the colon a complete sentence on its own?", hint: "Cover everything after the colon. Does what's left make a complete sentence?", yesLabel: "Yes — complete sentence before colon", noLabel: "No — incomplete phrase before colon", yes: { id: "colon-complete", result: "✓ Correct! The colon introduces what follows (list, explanation, or quotation).", resultType: "correct", ruleRef: "[Complete sentence]: [list / explanation / quotation]", }, no: { id: "colon-fragment", result: '⚠ Error! The part before a colon must ALWAYS be a complete sentence. Never use a colon after an incomplete phrase like "The results included:".', resultType: "warning", ruleRef: "[Complete sentence]: [explanation] — left side must be complete", }, }, }; const TREE_SCENARIOS: TreeScenario[] = [ { label: "Sentence 1", sentence: "The experiment yielded surprising results however the team chose not to revise their hypothesis.", tree: TREE_ROOT, }, { label: "Sentence 2", sentence: "The professor outlined three requirements for the assignment a thesis, supporting evidence, and a conclusion.", tree: TREE_ROOT, }, { label: "Sentence 3", sentence: "The researchers disagreed; one believed the effect was temporary, the other argued it was permanent.", tree: TREE_ROOT, }, ]; // ── Lesson component ─────────────────────────────────────────────────────── const EBRWSemicolonsColonsLesson: React.FC = ({ onFinish }) => { const [activeSection, setActiveSection] = useState(0); const sectionsRef = useRef<(HTMLElement | null)[]>([]); useEffect(() => { const observers: IntersectionObserver[] = []; sectionsRef.current.forEach((el, idx) => { if (!el) return; const obs = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting) setActiveSection(idx); }, { threshold: 0.3 }, ); obs.observe(el); observers.push(obs); }); return () => observers.forEach((o) => o.disconnect()); }, []); const scrollToSection = (index: number) => { setActiveSection(index); sectionsRef.current[index]?.scrollIntoView({ behavior: "smooth" }); }; const SectionMarker = ({ index, title, icon: Icon, }: { index: number; title: string; icon: React.ComponentType>; }) => { const isActive = activeSection === index; const isPast = activeSection > index; return ( ); }; return (
{/* Section 0 — Concept + Clause Breakdown */}
{ sectionsRef.current[0] = el; }} className="min-h-screen flex flex-col justify-center mb-24 pt-20 lg:pt-0" >
Standard English Conventions

Semicolons & Colons

Two marks — very different jobs. Master both to avoid the #1 punctuation error on the SAT.

{/* Rule summary grid */}
{[ { num: 1, rule: "Semicolon between ICs", desc: "Use a semicolon to join two independent clauses without a conjunction. Both sides must be complete sentences.", }, { num: 2, rule: "Semicolon + Conjunctive Adverb", desc: "Use a semicolon BEFORE conjunctive adverbs (however, therefore, moreover, consequently). They are NOT FANBOYS.", }, { num: 3, rule: "Colon for Explanation/List", desc: "Use a colon when the left side is a complete sentence that introduces a list, explanation, or quotation. Never colon if left side is incomplete.", }, { num: 4, rule: "No comma for conjunctive adverbs", desc: 'Never use a comma alone before "however," "therefore," etc. That creates a comma splice.', }, ].map((r) => (
{r.num} {r.rule}

{r.desc}

))}
{/* Clause Breakdown */}

Sentence Anatomy

Hover over any colored span to see its label. Use the tabs to switch between examples.

Golden Rule

A semicolon requires a complete sentence on both sides. A colon requires a complete sentence on the left only. Conjunctive adverbs like "however" and "therefore" are NOT FANBOYS — they always need a semicolon before them, not a comma.

{/* Section 1 — Decision Tree */}
{ sectionsRef.current[1] = el; }} className="min-h-screen flex flex-col justify-center mb-24" >

Decision Tree Lab

Work through the grammar logic one question at a time. Click your answer at each step.

{/* Trap callouts */}
{[ { label: "Conjunctive Adverb Trap", desc: 'Students confuse "however," "therefore," etc. with FANBOYS. These words need a semicolon before them, not a comma. "The data was good, however, we needed more" is a comma splice.', }, { label: "Colon After Incomplete Phrase", desc: 'Never: "The categories include: A, B, C." The word "include" makes it incomplete. Correct: "There are three categories: A, B, C."', }, { label: "Two Semicolons in One Clause", desc: "If the question has answer choices with extra semicolons in the middle of a clause, they are always wrong.", }, ].map((t) => (

{t.label}

{t.desc}

))}
{/* Section 2 — Quiz */}
{ sectionsRef.current[2] = el; }} className="min-h-screen flex flex-col justify-center mb-24" >

Practice Questions

{BOUNDARIES_EASY.slice(2, 4).map((q) => ( ))} {BOUNDARIES_MEDIUM.slice(1, 2).map((q) => ( ))}
); }; export default EBRWSemicolonsColonsLesson;