Spaces:
Configuration error
Configuration error
Create index.js
Browse files- pages/index.js +52 -0
pages/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Head from "next/head";
|
| 2 |
+
import Header from "../components/Header";
|
| 3 |
+
import Card from "../components/Card";
|
| 4 |
+
import IdeaForm from "../components/IdeaForm";
|
| 5 |
+
import ActivityPack from "../components/ActivityPack";
|
| 6 |
+
import { useState } from "react";
|
| 7 |
+
|
| 8 |
+
export default function Home() {
|
| 9 |
+
const [showForm, setShowForm] = useState(false);
|
| 10 |
+
const [pack, setPack] = useState(null);
|
| 11 |
+
|
| 12 |
+
function handleCardClick() {
|
| 13 |
+
setShowForm(true);
|
| 14 |
+
window.scrollTo({ top: 300, behavior: "smooth" });
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
async function handleGenerate(payload) {
|
| 18 |
+
const simulated = {
|
| 19 |
+
activity_name: "Simulated Role Play",
|
| 20 |
+
objective: payload.message,
|
| 21 |
+
why: "Auto-selected based on inputs",
|
| 22 |
+
scenario: `Context: ${payload.context}`,
|
| 23 |
+
character_sketches: [{ role: "Rep", description: "Field rep" }, { role: "Manager", description: "Sr manager" }],
|
| 24 |
+
trainer_notes: ["Step 1: ...", "Step 2: ..."],
|
| 25 |
+
debrief_questions: ["What happened?", "What will you try next?"]
|
| 26 |
+
};
|
| 27 |
+
await new Promise(r=>setTimeout(r,700));
|
| 28 |
+
setPack(simulated);
|
| 29 |
+
setShowForm(false);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
return (
|
| 33 |
+
<div>
|
| 34 |
+
<Head>
|
| 35 |
+
<title>L&D Studio AI</title>
|
| 36 |
+
</Head>
|
| 37 |
+
<Header />
|
| 38 |
+
<main className="p-4 max-w-md mx-auto">
|
| 39 |
+
<div className="space-y-3">
|
| 40 |
+
<Card title="Idea Generator" subtitle="Discover activities and exercises" icon="💡" onClick={handleCardClick}/>
|
| 41 |
+
<Card title="Learning Journey Builder" subtitle="Plan and structure a learning journey" icon="📘" onClick={()=>{}}/>
|
| 42 |
+
<Card title="Content Inspiration Hub" subtitle="Find resources to enhance content" icon="🔎" onClick={()=>{}}/>
|
| 43 |
+
<Card title="Strategist Mode" subtitle="Guide for organizations" icon="🧭" onClick={()=>{}}/>
|
| 44 |
+
</div>
|
| 45 |
+
|
| 46 |
+
{showForm && <div className="mt-4 card"><IdeaForm onSubmit={handleGenerate}/></div>}
|
| 47 |
+
|
| 48 |
+
{pack && <ActivityPack data={pack} />}
|
| 49 |
+
</main>
|
| 50 |
+
</div>
|
| 51 |
+
);
|
| 52 |
+
}
|