Spaces:
Configuration error
Configuration error
Create IdeaFrom.jsx
Browse files- component/IdeaFrom.jsx +95 -0
component/IdeaFrom.jsx
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState } from "react";
|
| 2 |
+
|
| 3 |
+
export default function IdeaForm({ onSubmit }) {
|
| 4 |
+
const [industry, setIndustry] = useState("General / Cross-industry");
|
| 5 |
+
const [category, setCategory] = useState("Ice Breaking");
|
| 6 |
+
const [message, setMessage] = useState("");
|
| 7 |
+
const [audience, setAudience] = useState([]);
|
| 8 |
+
const [batchSize, setBatchSize] = useState("15-20");
|
| 9 |
+
const [duration, setDuration] = useState("10-20 mins");
|
| 10 |
+
const [delivery, setDelivery] = useState("In-person");
|
| 11 |
+
const [stage, setStage] = useState("Ice-breaker");
|
| 12 |
+
const [context, setContext] = useState("");
|
| 13 |
+
const [outcome, setOutcome] = useState("");
|
| 14 |
+
const [includeDialogues, setIncludeDialogues] = useState(false);
|
| 15 |
+
|
| 16 |
+
const audiences = ["First-line managers","Senior managers","Sales reps","New joiners","Cross-functional teams","Leadership team"];
|
| 17 |
+
|
| 18 |
+
function toggleAudience(a) {
|
| 19 |
+
setAudience(prev => prev.includes(a) ? prev.filter(x=>x!==a) : [...prev,a]);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
function handleSubmit(e) {
|
| 23 |
+
e.preventDefault();
|
| 24 |
+
if (!message || audience.length===0 || !context || !outcome) {
|
| 25 |
+
alert("Please fill required fields");
|
| 26 |
+
return;
|
| 27 |
+
}
|
| 28 |
+
onSubmit({
|
| 29 |
+
industry, category, message, audience, batchSize, duration, delivery, stage, context, outcome, includeDialogues
|
| 30 |
+
});
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
return (
|
| 34 |
+
<form onSubmit={handleSubmit} className="space-y-3 p-3">
|
| 35 |
+
<select value={industry} onChange={e=>setIndustry(e.target.value)} className="w-full p-3 border rounded-md">
|
| 36 |
+
<option>General / Cross-industry</option>
|
| 37 |
+
<option>Pharmaceutical</option>
|
| 38 |
+
<option>Healthcare</option>
|
| 39 |
+
<option>Insurance</option>
|
| 40 |
+
<option>Technology</option>
|
| 41 |
+
<option>Education</option>
|
| 42 |
+
<option>Other</option>
|
| 43 |
+
</select>
|
| 44 |
+
|
| 45 |
+
<select value={category} onChange={e=>setCategory(e.target.value)} className="w-full p-3 border rounded-md">
|
| 46 |
+
<option>Ice Breaking</option>
|
| 47 |
+
<option>Activities During Workshop</option>
|
| 48 |
+
<option>Learning Solution</option>
|
| 49 |
+
<option>Energizer</option>
|
| 50 |
+
</select>
|
| 51 |
+
|
| 52 |
+
<textarea value={message} onChange={e=>setMessage(e.target.value)} placeholder="Message you want to drive" className="w-full p-3 border rounded-md" />
|
| 53 |
+
|
| 54 |
+
<div className="text-sm font-medium">Audience</div>
|
| 55 |
+
<div className="grid grid-cols-2 gap-2">
|
| 56 |
+
{audiences.map(a => (
|
| 57 |
+
<button type="button" key={a} onClick={()=>toggleAudience(a)} className={`p-2 border rounded ${audience.includes(a)?'bg-primary text-white':'bg-white'}`}>
|
| 58 |
+
{a}
|
| 59 |
+
</button>
|
| 60 |
+
))}
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
<input value={batchSize} onChange={e=>setBatchSize(e.target.value)} className="w-full p-3 border rounded-md" />
|
| 64 |
+
<select value={duration} onChange={e=>setDuration(e.target.value)} className="w-full p-3 border rounded-md">
|
| 65 |
+
<option>5-10 mins</option>
|
| 66 |
+
<option>10-20 mins</option>
|
| 67 |
+
<option>20-30 mins</option>
|
| 68 |
+
<option>30-60 mins</option>
|
| 69 |
+
</select>
|
| 70 |
+
|
| 71 |
+
<div className="flex gap-2">
|
| 72 |
+
<label className="flex-1"><input type="radio" checked={delivery==='In-person'} onChange={()=>setDelivery('In-person')} /> In-person</label>
|
| 73 |
+
<label className="flex-1"><input type="radio" checked={delivery==='Virtual'} onChange={()=>setDelivery('Virtual')} /> Virtual</label>
|
| 74 |
+
</div>
|
| 75 |
+
|
| 76 |
+
<select value={stage} onChange={e=>setStage(e.target.value)} className="w-full p-3 border rounded-md">
|
| 77 |
+
<option>Ice-breaker</option>
|
| 78 |
+
<option>Mid-session energizer</option>
|
| 79 |
+
<option>Concept introduction</option>
|
| 80 |
+
<option>Deep-dive practice</option>
|
| 81 |
+
<option>Reflection/closing</option>
|
| 82 |
+
</select>
|
| 83 |
+
|
| 84 |
+
<textarea value={context} onChange={e=>setContext(e.target.value)} placeholder="Scenario context" className="w-full p-3 border rounded-md" />
|
| 85 |
+
<textarea value={outcome} onChange={e=>setOutcome(e.target.value)} placeholder="Desired outcome" className="w-full p-3 border rounded-md" />
|
| 86 |
+
|
| 87 |
+
<label className="flex items-center gap-2">
|
| 88 |
+
<input type="checkbox" checked={includeDialogues} onChange={e=>setIncludeDialogues(e.target.checked)} />
|
| 89 |
+
Include sample dialogues (roleplay only)
|
| 90 |
+
</label>
|
| 91 |
+
|
| 92 |
+
<button type="submit" className="w-full bg-primary text-white p-3 rounded-md">Generate Ideas</button>
|
| 93 |
+
</form>
|
| 94 |
+
);
|
| 95 |
+
}
|