Spaces:
Running
Running
Ctrl+K
let us do it again under the interview.html. here are the instructions: // Target File: Interview.html // Goal: Embed a full "Add Participant" system directly into the Interview page. This should allow researchers to: // - Add new participants // - View/edit participants in spreadsheet style // - Select participants during "Start New Interview" setup ββββββββββββββββββββββββββββββββββββββββββββββ 1. Add βAdd Participantβ Button: At the top of the participants section inside `Interview.html`, add a green button: <Button className="bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 shadow"> β Add Participant </Button> On click β trigger modal or toggle a form inline below the table. ββββββββββββββββββββββββββββββββββββββββββββββ 2. Create Participant Entry Form OR Modal: Build a reusable participant entry form with the following fields: - Full Name (text) - Age (number) - Gender (dropdown: Male, Female, Other) - Location (text) - Notes (multiline) Auto-generate unique ID (e.g., `P-001`, `P-002`β¦) Use Tailwind styling: form group with padding, rounded borders, and error highlighting if validation fails. On submission: - Push to `participants[]` state. - Save to `localStorage["participants"]`. - Show success toast. ββββββββββββββββββββββββββββββββββββββββββββββ 3. Display Spreadsheet-style Table: Use a responsive `<table>` inside `Interview.html` or a library like `TanStack Table`. Table Columns: | ID | Full Name | Age | Gender | Location | Notes | Actions (Edit/Delete) | Features: - Inline editable cells (optional) - Delete row button (with confirm) - Sortable by column - Responsive scroll on mobile Use Tailwind classes: `table-auto`, `text-sm`, `rounded`, `shadow`, `overflow-x-scroll` ββββββββββββββββββββββββββββββββββββββββββββββ 4. Data Logic: Use the following TypeScript interface: ```ts interface Participant { id: string; name: string; age: number; gender: "Male" | "Female" | "Other"; location: string; notes: string; } Save and retrieve from localStorage: ts Copy Edit useEffect(() => { const saved = JSON.parse(localStorage.getItem("participants") || "[]"); setParticipants(saved); }, []); const saveParticipants = (data) => { localStorage.setItem("participants", JSON.stringify(data)); } ββββββββββββββββββββββββββββββββββββββββββββββ 5. Integrate with βStart New Interviewβ: In the "Start Interview" form (still on Interview.html), add a dropdown: tsx Copy Edit <select className="w-full p-2 border rounded"> {participants.map(p => ( <option key={p.id} value={p.id}> {p.id} β {p.name} </option> ))} </select> Optional: show selected participantβs details below the dropdown. ββββββββββββββββββββββββββββββββββββββββββββββ 6. Export/Import Participants: Add "Export CSV" and "Import CSV" buttons next to the table. On export: Convert participants[] to CSV string and trigger download. On import: Parse CSV file β validate β add to list. ββββββββββββββββββββββββββββββββββββββββββββββ 7. UI Considerations: Highlight new/unsaved rows Show empty-state illustration when no participants are added yet All elements mobile responsive Use Tailwind utility classes for spacing, font, colors Add icons using Lucide (or any icon lib used in the project) - Follow Up Deployment
e0497b7 verified