Spaces:
Running
Running
Add a "Schedule" button (Primary) and a "Cancel" button (Secondary) at the bottom of the modal. 4. On clicking "Schedule": → Validate that required fields are filled. → Save the interview data to a local database or server-side route as a new Interview record. Use this object structure for each saved interview: { id: auto_generated, participantId: selected_participant_id, projectId: selected_project_id, interviewerId: selected_user_id, datetime: ISO8601 format, mode: "in-person" | "online" | "phone", location: string, notes: optional string, status: "scheduled" } 5. After saving: - Close the modal. - Refresh or update the Upcoming Interviews panel to include the newly scheduled interview. - Show a toast notification: "Interview successfully scheduled." 6. (Optional Enhancement) - Allow document attachment (e.g., Interview Guide, Consent Form). - Add toggle: “Send notification to participant/interviewer”. - Auto-link participant and project fields so that this interview is accessible from both modules. 7. Accessibility: - Modal must be keyboard accessible (Tab to move, Enter to submit, Esc to close). - Include aria-labels on all fields and modal header. 8. Design: - Use Tailwind UI or ShadCN components (like Dialog, Input, Select, Textarea). - Follow the app’s primary colors from Quantals Collect branding. 9. File: Interviews.html - Keep all modal and event-handler code scoped to this file. - Use React component state to manage modal visibility and form state. - Follow Up Deployment
34560f7 verified Download index.html from dataquantals/quantals-collect: direct link, hf CLI and curl.
- Browser
- Download file 45.2 kB
-
https://huggingface.co/spaces/dataquantals/quantals-collect/resolve/main/index.html
- Command line
-
hf download hf://spaces/dataquantals/quantals-collect/index.html
-
curl -L -o index.html https://huggingface.co/spaces/dataquantals/quantals-collect/resolve/main/index.html
45.2 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Interview Management - Quantals Collect</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css"> | |
| <script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script> | |
| <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet"> | |
| <style> | |
| /* Custom styles */ | |
| .recording-indicator { | |
| animation: pulse 2s infinite; | |
| } | |
| @keyframes pulse { | |
| 0% { opacity: 1; } | |
| 50% { opacity: 0.5; } | |
| 100% { opacity: 1; } | |
| } | |
| #videoPreview { | |
| aspect-ratio: 16/9; | |
| background: #f3f4f6; | |
| } | |
| .ql-editor { | |
| min-height: 200px; | |
| } | |
| .interview-history-table th { | |
| position: sticky; | |
| top: 0; | |
| background: white; | |
| z-index: 10; | |
| } | |
| .mobile-menu { | |
| transition: transform 0.3s ease-in-out; | |
| } | |
| .mobile-menu.hidden { | |
| transform: translateX(-100%); | |
| } | |
| .mobile-menu.show { | |
| transform: translateX(0); | |
| } | |
| @media (max-width: 768px) { | |
| .nav-item { | |
| padding: 0.75rem 1rem; | |
| border-bottom: 1px solid #e5e7eb; | |
| } | |
| .nav-item:last-child { | |
| border-bottom: none; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 font-sans"> | |
| <div class="flex flex-col h-screen overflow-hidden"> | |
| <!-- Top Navigation Bar --> | |
| <nav class="bg-indigo-800 text-white shadow-lg"> | |
| <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> | |
| <div class="flex justify-between items-center h-16"> | |
| <!-- Logo and Brand --> | |
| <div class="flex items-center space-x-3"> | |
| <div class="bg-white p-2 rounded-lg"> | |
| <i class="fas fa-microscope text-indigo-800 text-xl"></i> | |
| </div> | |
| <h1 class="text-xl font-bold">Quantals Collect</h1> | |
| </div> | |
| <!-- Desktop Navigation --> | |
| <div class="hidden md:flex items-center space-x-1"> | |
| <a href="index.html" class="flex items-center space-x-2 px-3 py-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white transition-colors"> | |
| <i class="fas fa-home"></i> | |
| <span>Dashboard</span> | |
| </a> | |
| <a href="projects.html" class="flex items-center space-x-2 px-3 py-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white transition-colors"> | |
| <i class="fas fa-project-diagram"></i> | |
| <span>Projects</span> | |
| </a> | |
| <a href="participants.html" class="flex items-center space-x-2 px-3 py-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white transition-colors"> | |
| <i class="fas fa-users"></i> | |
| <span>Participants</span> | |
| </a> | |
| <a href="interview.html" class="flex items-center space-x-2 px-3 py-2 rounded-lg bg-indigo-700 text-white"> | |
| <i class="fas fa-microphone"></i> | |
| <span>Interviews</span> | |
| </a> | |
| <a href="analysis.html" class="flex items-center space-x-2 px-3 py-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white transition-colors"> | |
| <i class="fas fa-chart-pie"></i> | |
| <span>Analysis</span> | |
| </a> | |
| <a href="ai-assist.html" class="flex items-center space-x-2 px-3 py-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white transition-colors"> | |
| <i class="fas fa-robot"></i> | |
| <span>AI Assist</span> | |
| </a> | |
| <a href="transcriber.html" class="flex items-center space-x-2 px-3 py-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white transition-colors"> | |
| <i class="fas fa-keyboard"></i> | |
| <span>Transcriber</span> | |
| </a> | |
| </div> | |
| <!-- User Menu and Mobile Menu Button --> | |
| <div class="flex items-center space-x-4"> | |
| <!-- Settings Link (Desktop) --> | |
| <a href="settings.html" class="hidden md:flex items-center space-x-2 px-3 py-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white transition-colors"> | |
| <i class="fas fa-cog"></i> | |
| <span>Settings</span> | |
| </a> | |
| <!-- Mobile Menu Button --> | |
| <button id="mobileMenuBtn" class="md:hidden p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white transition-colors"> | |
| <i class="fas fa-bars text-xl"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Mobile Navigation Menu --> | |
| <div id="mobileMenu" class="mobile-menu hidden md:hidden bg-indigo-800 border-t border-indigo-700"> | |
| <div class="px-4 py-2 space-y-1"> | |
| <a href="index.html" class="nav-item flex items-center space-x-3 text-indigo-200 hover:bg-indigo-700 hover:text-white rounded-lg transition-colors"> | |
| <i class="fas fa-home w-5"></i> | |
| <span>Dashboard</span> | |
| </a> | |
| <a href="projects.html" class="nav-item flex items-center space-x-3 text-indigo-200 hover:bg-indigo-700 hover:text-white rounded-lg transition-colors"> | |
| <i class="fas fa-project-diagram w-5"></i> | |
| <span>Projects</span> | |
| </a> | |
| <a href="participants.html" class="nav-item flex items-center space-x-3 text-indigo-200 hover:bg-indigo-700 hover:text-white rounded-lg transition-colors"> | |
| <i class="fas fa-users w-5"></i> | |
| <span>Participants</span> | |
| </a> | |
| <a href="interview.html" class="nav-item flex items-center space-x-3 bg-indigo-700 text-white rounded-lg"> | |
| <i class="fas fa-microphone w-5"></i> | |
| <span>Interviews</span> | |
| </a> | |
| <a href="analysis.html" class="nav-item flex items-center space-x-3 text-indigo-200 hover:bg-indigo-700 hover:text-white rounded-lg transition-colors"> | |
| <i class="fas fa-chart-pie w-5"></i> | |
| <span>Analysis</span> | |
| </a> | |
| <a href="ai-assist.html" class="nav-item flex items-center space-x-3 text-indigo-200 hover:bg-indigo-700 hover:text-white rounded-lg transition-colors"> | |
| <i class="fas fa-robot w-5"></i> | |
| <span>AI Assist</span> | |
| </a> | |
| <a href="transcriber.html" class="nav-item flex items-center space-x-3 text-indigo-200 hover:bg-indigo-700 hover:text-white rounded-lg transition-colors"> | |
| <i class="fas fa-keyboard w-5"></i> | |
| <span>Transcriber</span> | |
| </a> | |
| <a href="settings.html" class="nav-item flex items-center space-x-3 text-indigo-200 hover:bg-indigo-700 hover:text-white rounded-lg transition-colors"> | |
| <i class="fas fa-cog w-5"></i> | |
| <span>Settings</span> | |
| </a> | |
| </div> | |
| </div> | |
| </nav> | |
| <!-- Main Content --> | |
| <div class="flex-1 flex flex-col overflow-hidden"> | |
| <!-- Header --> | |
| <header class="bg-white shadow-sm p-4 flex justify-between items-center"> | |
| <div class="flex items-center space-x-4"> | |
| <h2 class="text-xl font-semibold text-gray-800">Interviews</h2> | |
| <div class="offline-indicator hidden px-3 py-1 bg-yellow-100 text-yellow-800 rounded-full text-sm"> | |
| <i class="fas fa-wifi-slash mr-1"></i> Offline | |
| </div> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <button class="p-2 rounded-full hover:bg-gray-100 relative"> | |
| <i class="fas fa-bell text-gray-600"></i> | |
| <span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full"></span> | |
| </button> | |
| <div class="hidden sm:flex items-center space-x-2"> | |
| <div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center"> | |
| <span class="text-xs font-medium text-indigo-800">RS</span> | |
| </div> | |
| <span class="text-sm">Research Team</span> | |
| </div> | |
| <button class="bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 transition-colors flex items-center space-x-2"> | |
| <i class="fas fa-plus"></i> | |
| <span class="hidden sm:inline">Start New Interview</span> | |
| <span class="sm:hidden">New</span> | |
| </button> | |
| </div> | |
| </header> | |
| <!-- Main Content Area --> | |
| <main class="flex-1 overflow-y-auto p-4 sm:p-6"> | |
| <div class="max-w-7xl mx-auto"> | |
| <div class="grid grid-cols-1 lg:grid-cols-12 gap-6"> | |
| <!-- Left Sidebar - Scheduling Panel --> | |
| <div class="lg:col-span-3"> | |
| <div class="bg-white rounded-lg shadow-sm p-4"> | |
| <h3 class="text-lg font-semibold text-gray-800 mb-4">Upcoming Interviews</h3> | |
| <div class="space-y-4"> | |
| <!-- Sample Interview Items --> | |
| <div class="p-3 bg-gray-50 rounded-lg"> | |
| <div class="text-sm text-gray-600">Today, 2:00 PM</div> | |
| <div class="font-medium">John Doe</div> | |
| <div class="text-sm text-gray-500">Project: UX Research</div> | |
| </div> | |
| <div class="p-3 bg-gray-50 rounded-lg"> | |
| <div class="text-sm text-gray-600">Tomorrow, 10:30 AM</div> | |
| <div class="font-medium">Jane Smith</div> | |
| <div class="text-sm text-gray-500">Project: Market Study</div> | |
| </div> | |
| </div> | |
| <button class="mt-4 w-full bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 transition-colors flex items-center justify-center space-x-2"> | |
| <i class="fas fa-plus"></i> | |
| <span>Schedule Interview</span> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Main Workspace --> | |
| <div class="lg:col-span-9 space-y-6"> | |
| <!-- Recording Panel --> | |
| <div class="bg-white rounded-lg shadow-sm p-4"> | |
| <h3 class="text-lg font-semibold text-gray-800 mb-4">Recording</h3> | |
| <div class="flex flex-wrap gap-4 mb-4"> | |
| <div class="w-full"> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Camera</label> | |
| <select id="cameraSelect" class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"> | |
| <option value="">Select Camera</option> | |
| </select> | |
| </div> | |
| <button class="bg-red-600 text-white px-4 py-2 rounded-lg hover:bg-red-700 transition-colors flex items-center space-x-2"> | |
| <i class="fas fa-microphone"></i> | |
| <span>Record Audio</span> | |
| </button> | |
| <button class="bg-red-600 text-white px-4 py-2 rounded-lg hover:bg-red-700 transition-colors flex items-center space-x-2"> | |
| <i class="fas fa-video"></i> | |
| <span>Record Video</span> | |
| </button> | |
| <button class="bg-gray-600 text-white px-4 py-2 rounded-lg hover:bg-gray-700 transition-colors flex items-center space-x-2"> | |
| <i class="fas fa-upload"></i> | |
| <span>Upload File</span> | |
| </button> | |
| </div> | |
| <div class="mb-4"> | |
| <video id="videoPreview" autoplay muted class="w-full rounded-lg"></video> | |
| </div> | |
| <div class="flex justify-between items-center"> | |
| <div class="text-sm text-gray-600"> | |
| <span class="recording-indicator hidden text-red-600"> | |
| <i class="fas fa-circle"></i> Recording... | |
| </span> | |
| <span class="timer">00:00:00</span> | |
| </div> | |
| <div class="flex space-x-2"> | |
| <button class="bg-gray-100 text-gray-700 px-3 py-1 rounded hover:bg-gray-200 transition-colors"> | |
| <i class="fas fa-pause"></i> | |
| </button> | |
| <button class="bg-gray-100 text-gray-700 px-3 py-1 rounded hover:bg-gray-200 transition-colors"> | |
| <i class="fas fa-stop"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Notes Panel --> | |
| <div class="bg-white rounded-lg shadow-sm p-4"> | |
| <h3 class="text-lg font-semibold text-gray-800 mb-4">Live Notes</h3> | |
| <div class="mb-4"> | |
| <div class="text-sm text-gray-600"> | |
| <span class="font-medium">Project:</span> UX Research | |
| <span class="mx-2">|</span> | |
| <span class="font-medium">Participant:</span> John Doe | |
| </div> | |
| </div> | |
| <div id="editor" class="h-64"></div> | |
| <div class="mt-4 flex justify-between items-center"> | |
| <button class="bg-gray-100 text-gray-700 px-3 py-1 rounded hover:bg-gray-200 transition-colors flex items-center space-x-2"> | |
| <i class="fas fa-clock"></i> | |
| <span>Insert Timestamp</span> | |
| </button> | |
| <div class="text-sm text-gray-500"> | |
| Last saved: Just now | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Playback & Review Panel --> | |
| <div class="bg-white rounded-lg shadow-sm p-4"> | |
| <h3 class="text-lg font-semibold text-gray-800 mb-4">Playback & Review</h3> | |
| <div class="flex flex-wrap gap-4 mb-4"> | |
| <button class="bg-gray-100 text-gray-700 px-4 py-2 rounded hover:bg-gray-200 transition-colors flex items-center space-x-2"> | |
| <i class="fas fa-file-alt"></i> | |
| <span>View Transcript</span> | |
| </button> | |
| <div class="relative"> | |
| <button class="bg-gray-100 text-gray-700 px-4 py-2 rounded hover:bg-gray-200 transition-colors flex items-center space-x-2"> | |
| <i class="fas fa-download"></i> | |
| <span>Export</span> | |
| <i class="fas fa-chevron-down ml-2"></i> | |
| </button> | |
| <!-- Export dropdown menu --> | |
| </div> | |
| </div> | |
| <div class="flex flex-wrap items-center gap-4 mb-4"> | |
| <label class="flex items-center space-x-2"> | |
| <input type="checkbox" class="form-checkbox text-indigo-600"> | |
| <span class="text-sm text-gray-700">Show Transcript</span> | |
| </label> | |
| <label class="flex items-center space-x-2"> | |
| <input type="checkbox" class="form-checkbox text-indigo-600"> | |
| <span class="text-sm text-gray-700">Sync Notes Timeline</span> | |
| </label> | |
| </div> | |
| <div id="transcript" class="hidden bg-gray-50 rounded-lg p-4 max-h-64 overflow-y-auto"> | |
| <!-- Transcript content will be inserted here --> | |
| </div> | |
| </div> | |
| <!-- Interview History --> | |
| <div class="bg-white rounded-lg shadow-sm p-4"> | |
| <h3 class="text-lg font-semibold text-gray-800 mb-4">Interview History</h3> | |
| <div class="overflow-x-auto"> | |
| <table class="interview-history-table min-w-full"> | |
| <thead> | |
| <tr class="bg-gray-50"> | |
| <th class="px-4 py-2 text-left text-sm font-medium text-gray-500">Interview ID</th> | |
| <th class="px-4 py-2 text-left text-sm font-medium text-gray-500">Participant</th> | |
| <th class="px-4 py-2 text-left text-sm font-medium text-gray-500">Date</th> | |
| <th class="px-4 py-2 text-left text-sm font-medium text-gray-500">Status</th> | |
| <th class="px-4 py-2 text-left text-sm font-medium text-gray-500">Media Type</th> | |
| <th class="px-4 py-2 text-left text-sm font-medium text-gray-500">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody class="divide-y divide-gray-200"> | |
| <!-- Sample rows --> | |
| <tr> | |
| <td class="px-4 py-2 text-sm">IVW-20240315-001</td> | |
| <td class="px-4 py-2 text-sm">John Doe</td> | |
| <td class="px-4 py-2 text-sm">Mar 15, 2024</td> | |
| <td class="px-4 py-2 text-sm"> | |
| <span class="px-2 py-1 bg-green-100 text-green-800 rounded-full text-xs">Completed</span> | |
| </td> | |
| <td class="px-4 py-2 text-sm">Video</td> | |
| <td class="px-4 py-2 text-sm"> | |
| <div class="flex space-x-2"> | |
| <button class="text-indigo-600 hover:text-indigo-800"> | |
| <i class="fas fa-eye"></i> | |
| </button> | |
| <button class="text-gray-600 hover:text-gray-800"> | |
| <i class="fas fa-download"></i> | |
| </button> | |
| <button class="text-red-600 hover:text-red-800"> | |
| <i class="fas fa-trash"></i> | |
| </button> | |
| </div> | |
| </td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| </div> | |
| </div> | |
| <!-- Schedule Interview Modal --> | |
| <div id="scheduleModal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"> | |
| <div class="bg-white rounded-lg p-6 w-full max-w-md mx-4"> | |
| <h3 class="text-lg font-semibold text-gray-800 mb-4">Schedule New Interview</h3> | |
| <form class="space-y-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Participant *</label> | |
| <select class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required> | |
| <option value="">Select Participant</option> | |
| <option>John Doe (ID: P001)</option> | |
| <option>Jane Smith (ID: P002)</option> | |
| <!-- Will be populated dynamically --> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Project *</label> | |
| <select class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required> | |
| <option value="">Select Project</option> | |
| <option>UX Research</option> | |
| <option>Market Study</option> | |
| <!-- Will be populated dynamically --> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Date & Time *</label> | |
| <input type="datetime-local" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Interviewer *</label> | |
| <select class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required> | |
| <option value="">Select Interviewer</option> | |
| <option>Research Team</option> | |
| <option>Alex Johnson</option> | |
| <option>Sam Williams</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Mode *</label> | |
| <div class="space-y-2 mt-1"> | |
| <div class="flex items-center"> | |
| <input type="radio" id="mode-in-person" name="mode" value="in-person" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500"> | |
| <label for="mode-in-person" class="ml-2 block text-sm text-gray-700">In-Person</label> | |
| </div> | |
| <div class="flex items-center"> | |
| <input type="radio" id="mode-online" name="mode" value="online" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500"> | |
| <label for="mode-online" class="ml-2 block text-sm text-gray-700">Zoom/Online</label> | |
| </div> | |
| <div class="flex items-center"> | |
| <input type="radio" id="mode-phone" name="mode" value="phone" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500"> | |
| <label for="mode-phone" class="ml-2 block text-sm text-gray-700">Phone</label> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="locationField"> | |
| <label for="location" class="block text-sm font-medium text-gray-700 mb-1">Location/Link *</label> | |
| <input type="text" id="location" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" required> | |
| </div> | |
| <div> | |
| <label for="notes" class="block text-sm font-medium text-gray-700 mb-1">Notes (Optional)</label> | |
| <textarea id="notes" rows="3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"></textarea> | |
| </div> | |
| <div class="flex justify-end space-x-3 mt-6"> | |
| <button type="button" id="cancelScheduleBtn" | |
| class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"> | |
| Cancel | |
| </button> | |
| <button type="submit" id="submitScheduleBtn" | |
| class="px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"> | |
| Schedule | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| <script> | |
| // Mobile menu functionality | |
| const mobileMenuBtn = document.getElementById('mobileMenuBtn'); | |
| const mobileMenu = document.getElementById('mobileMenu'); | |
| let isMobileMenuOpen = false; | |
| mobileMenuBtn.addEventListener('click', () => { | |
| isMobileMenuOpen = !isMobileMenuOpen; | |
| if (isMobileMenuOpen) { | |
| mobileMenu.classList.remove('hidden'); | |
| mobileMenu.classList.add('show'); | |
| mobileMenuBtn.innerHTML = '<i class="fas fa-times text-xl"></i>'; | |
| } else { | |
| mobileMenu.classList.add('hidden'); | |
| mobileMenu.classList.remove('show'); | |
| mobileMenuBtn.innerHTML = '<i class="fas fa-bars text-xl"></i>'; | |
| } | |
| }); | |
| // Close mobile menu when clicking outside | |
| document.addEventListener('click', (e) => { | |
| if (!mobileMenuBtn.contains(e.target) && !mobileMenu.contains(e.target)) { | |
| if (isMobileMenuOpen) { | |
| isMobileMenuOpen = false; | |
| mobileMenu.classList.add('hidden'); | |
| mobileMenu.classList.remove('show'); | |
| mobileMenuBtn.innerHTML = '<i class="fas fa-bars text-xl"></i>'; | |
| } | |
| } | |
| }); | |
| // Close mobile menu on window resize if screen becomes larger | |
| window.addEventListener('resize', () => { | |
| if (window.innerWidth >= 768 && isMobileMenuOpen) { | |
| isMobileMenuOpen = false; | |
| mobileMenu.classList.add('hidden'); | |
| mobileMenu.classList.remove('show'); | |
| mobileMenuBtn.innerHTML = '<i class="fas fa-bars text-xl"></i>'; | |
| } | |
| }); | |
| // Initialize Quill editor | |
| var quill = new Quill('#editor', { | |
| theme: 'snow', | |
| modules: { | |
| toolbar: [ | |
| ['bold', 'italic', 'underline'], | |
| [{ 'list': 'ordered'}, { 'list': 'bullet' }], | |
| ['clean'] | |
| ] | |
| } | |
| }); | |
| // MediaRecorder setup | |
| let mediaRecorder; | |
| let recordedChunks = []; | |
| let isRecording = false; | |
| let timerInterval; | |
| let startTime; | |
| let videoStream; | |
| // Get available cameras and start preview | |
| async function getCameras() { | |
| try { | |
| const devices = await navigator.mediaDevices.enumerateDevices(); | |
| const videoDevices = devices.filter(device => device.kind === 'videoinput'); | |
| const cameraSelect = document.getElementById('cameraSelect'); | |
| const videoPreview = document.getElementById('videoPreview'); | |
| // Clear existing options | |
| cameraSelect.innerHTML = '<option value="">Select Camera</option>'; | |
| // Add camera options | |
| videoDevices.forEach(device => { | |
| const option = document.createElement('option'); | |
| option.value = device.deviceId; | |
| option.text = device.label || `Camera ${cameraSelect.length + 1}`; | |
| cameraSelect.appendChild(option); | |
| }); | |
| // Start preview with first available camera | |
| if (videoDevices.length > 0) { | |
| const stream = await navigator.mediaDevices.getUserMedia({ | |
| video: { deviceId: videoDevices[0].deviceId } | |
| }); | |
| videoPreview.srcObject = stream; | |
| } | |
| } catch (err) { | |
| console.error('Error accessing media devices:', err); | |
| } | |
| } | |
| // Call initially and whenever devices change | |
| getCameras(); | |
| navigator.mediaDevices.addEventListener('devicechange', getCameras); | |
| // Handle camera selection change | |
| document.getElementById('cameraSelect').addEventListener('change', async function() { | |
| const videoPreview = document.getElementById('videoPreview'); | |
| const selectedDeviceId = this.value; | |
| if (selectedDeviceId) { | |
| try { | |
| const stream = await navigator.mediaDevices.getUserMedia({ | |
| video: { deviceId: selectedDeviceId } | |
| }); | |
| // Stop previous stream | |
| if (videoPreview.srcObject) { | |
| videoPreview.srcObject.getTracks().forEach(track => track.stop()); | |
| } | |
| videoPreview.srcObject = stream; | |
| } catch (err) { | |
| console.error('Error switching camera:', err); | |
| } | |
| } | |
| }); | |
| // Timer display | |
| const timerDisplay = document.querySelector('.timer'); | |
| const recordingIndicator = document.querySelector('.recording-indicator'); | |
| function startTimer() { | |
| startTime = Date.now(); | |
| timerInterval = setInterval(updateTimer, 1000); | |
| } | |
| function updateTimer() { | |
| const elapsed = Date.now() - startTime; | |
| const seconds = Math.floor(elapsed / 1000); | |
| const minutes = Math.floor(seconds / 60); | |
| const hours = Math.floor(minutes / 60); | |
| timerDisplay.textContent = `${String(hours).padStart(2, '0')}:${String(minutes % 60).padStart(2, '0')}:${String(seconds % 60).padStart(2, '0')}`; | |
| } | |
| function stopTimer() { | |
| clearInterval(timerInterval); | |
| } | |
| // Recording functions | |
| async function startRecording(type) { | |
| try { | |
| const constraints = { | |
| audio: type === 'audio' || type === 'video', | |
| video: false | |
| }; | |
| if (type === 'video') { | |
| const cameraSelect = document.getElementById('cameraSelect'); | |
| const selectedCameraId = cameraSelect.value; | |
| constraints.video = { | |
| deviceId: selectedCameraId ? { exact: selectedCameraId } : undefined | |
| }; | |
| } | |
| const stream = await navigator.mediaDevices.getUserMedia(constraints); | |
| videoStream = stream; | |
| mediaRecorder = new MediaRecorder(stream); | |
| recordedChunks = []; | |
| mediaRecorder.ondataavailable = (event) => { | |
| if (event.data.size > 0) { | |
| recordedChunks.push(event.data); | |
| } | |
| }; | |
| mediaRecorder.onstop = () => { | |
| const blob = new Blob(recordedChunks, { | |
| type: type === 'video' ? 'video/webm' : 'audio/webm' | |
| }); | |
| const url = URL.createObjectURL(blob); | |
| const mediaContainer = document.querySelector('.media-container'); | |
| if (type === 'video') { | |
| mediaContainer.innerHTML = `<video controls src="${url}" class="w-full h-full"></video>`; | |
| } else { | |
| mediaContainer.innerHTML = `<audio controls src="${url}" class="w-full"></audio>`; | |
| } | |
| }; | |
| mediaRecorder.start(); | |
| isRecording = true; | |
| recordingIndicator.classList.remove('hidden'); | |
| startTimer(); | |
| } catch (err) { | |
| console.error('Error accessing media devices:', err); | |
| alert('Error accessing media devices. Please ensure you have granted the necessary permissions.'); | |
| } | |
| } | |
| function stopRecording() { | |
| if (mediaRecorder && isRecording) { | |
| mediaRecorder.stop(); | |
| isRecording = false; | |
| recordingIndicator.classList.add('hidden'); | |
| stopTimer(); | |
| // Stop all tracks | |
| if (videoStream) { | |
| videoStream.getTracks().forEach(track => track.stop()); | |
| videoStream = null; | |
| } | |
| } | |
| } | |
| // Event listeners | |
| document.querySelector('button:has(.fa-microphone)').addEventListener('click', () => startRecording('audio')); | |
| document.querySelector('button:has(.fa-video)').addEventListener('click', () => startRecording('video')); | |
| document.querySelector('button:has(.fa-stop)').addEventListener('click', stopRecording); | |
| // Schedule interview modal | |
| function setupScheduleModal() { | |
| const scheduleButtons = document.querySelectorAll('button:has(.fa-plus)'); | |
| scheduleButtons.forEach(button => { | |
| button.addEventListener('click', () => { | |
| modal.classList.remove('hidden'); | |
| document.body.style.overflow = 'hidden'; | |
| modal.querySelector('input').focus(); | |
| }); | |
| }); | |
| // Pre-populate with today's date | |
| const now = new Date(); | |
| const timeString = `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`; | |
| const today = `${now.getFullYear()}-${(now.getMonth()+1).toString().padStart(2, '0')}-${now.getDate().toString().padStart(2, '0')}`; | |
| document.querySelector('input[type="datetime-local"]').value = `${today}T${timeString}`; | |
| // Handle mode selection changes | |
| const modeRadios = document.querySelectorAll('input[name="mode"]'); | |
| const locationField = document.getElementById('locationField'); | |
| const locationInput = document.getElementById('location'); | |
| modeRadios.forEach(radio => { | |
| radio.addEventListener('change', (e) => { | |
| const mode = e.target.value; | |
| const label = locationField.querySelector('label'); | |
| if (mode === 'online') { | |
| label.textContent = 'Meeting Link *'; | |
| locationInput.placeholder = 'https://zoom.us/j/...'; | |
| } else if (mode === 'phone') { | |
| label.textContent = 'Phone Number *'; | |
| locationInput.placeholder = '+1 (555) 123-4567'; | |
| } else { | |
| label.textContent = 'Location *'; | |
| locationInput.placeholder = 'Office address or room number'; | |
| } | |
| }); | |
| }); | |
| } | |
| document.addEventListener('DOMContentLoaded', setupScheduleModal); | |
| // Auto-save notes | |
| setInterval(() => { | |
| const content = quill.root.innerHTML; | |
| localStorage.setItem('interview_notes', content); | |
| // TODO: Implement remote save | |
| }, 30000); | |
| // Load saved notes | |
| const savedNotes = localStorage.getItem('interview_notes'); | |
| if (savedNotes) { | |
| quill.root.innerHTML = savedNotes; | |
| } | |
| // Before unload warning | |
| window.addEventListener('beforeunload', (e) => { | |
| if (isRecording) { | |
| e.preventDefault(); | |
| e.returnValue = ''; | |
| } | |
| }); | |
| </script> | |
| <!-- Toast Notification --> | |
| <div id="toast" class="hidden fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg"> | |
| Interview successfully scheduled. | |
| </div> | |
| <script> | |
| // Modal handling | |
| const modal = document.getElementById('scheduleModal'); | |
| const cancelBtn = document.getElementById('cancelScheduleBtn'); | |
| const submitBtn = document.getElementById('submitScheduleBtn'); | |
| const form = modal.querySelector('form'); | |
| const toast = document.getElementById('toast'); | |
| // Modal close functions | |
| function closeModal() { | |
| modal.classList.add('hidden'); | |
| document.body.style.overflow = 'auto'; | |
| } | |
| // Keyboard accessibility | |
| modal.addEventListener('keydown', (e) => { | |
| if (e.key === 'Escape') closeModal(); | |
| if (e.key === 'Tab') { | |
| const focusable = modal.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'); | |
| if (focusable.length === 0) return; | |
| const first = focusable[0]; | |
| const last = focusable[focusable.length - 1]; | |
| if (e.shiftKey) { | |
| if (document.activeElement === first) { | |
| last.focus(); | |
| e.preventDefault(); | |
| } | |
| } else { | |
| if (document.activeElement === last) { | |
| first.focus(); | |
| e.preventDefault(); | |
| } | |
| } | |
| } | |
| }); | |
| // Close buttons | |
| cancelBtn.addEventListener('click', closeModal); | |
| // Form submission | |
| form.addEventListener('submit', async (e) => { | |
| e.preventDefault(); | |
| // Validate required fields | |
| const requiredFields = form.querySelectorAll('[required]'); | |
| let isValid = true; | |
| requiredFields.forEach(field => { | |
| if (!field.value) { | |
| isValid = false; | |
| field.classList.add('border-red-500'); | |
| } else { | |
| field.classList.remove('border-red-500'); | |
| } | |
| }); | |
| if (!isValid) return; | |
| // Get form values | |
| const formData = { | |
| participantId: form.querySelector('select:nth-of-type(1)').value, | |
| projectId: form.querySelector('select:nth-of-type(2)').value, | |
| interviewerId: form.querySelector('select:nth-of-type(3)').value, | |
| datetime: form.querySelector('input[type="datetime-local"]').value, | |
| mode: form.querySelector('input[name="mode"]:checked').value, | |
| location: document.getElementById('location').value, | |
| notes: document.getElementById('notes').value, | |
| status: 'scheduled' | |
| }; | |
| try { | |
| // In a real app, you would call an API here | |
| // For demo, we'll use localStorage | |
| const interviews = JSON.parse(localStorage.getItem('interviews') || '[]'); | |
| const newInterview = { | |
| ...formData, | |
| id: 'IVW-' + Date.now().toString().slice(-6) | |
| }; | |
| interviews.push(newInterview); | |
| localStorage.setItem('interviews', JSON.stringify(interviews)); | |
| // Show success & close modal | |
| toast.classList.remove('hidden'); | |
| setTimeout(() => toast.classList.add('hidden'), 3000); | |
| closeModal(); | |
| // Refresh upcoming interviews | |
| refreshUpcomingInterviews(); | |
| } catch (error) { | |
| console.error('Error saving interview:', error); | |
| alert('Failed to schedule interview'); | |
| } | |
| }); | |
| function refreshUpcomingInterviews() { | |
| const interviews = JSON.parse(localStorage.getItem('interviews') || '[]'); | |
| const upcomingContainer = document.querySelector('.space-y-4'); | |
| // Sort by datetime | |
| const sorted = interviews | |
| .filter(i => new Date(i.datetime) > new Date()) | |
| .sort((a, b) => new Date(a.datetime) - new Date(b.datetime)); | |
| // Update UI | |
| upcomingContainer.innerHTML = sorted | |
| .map(interview => ` | |
| <div class="p-3 bg-gray-50 rounded-lg"> | |
| <div class="text-sm text-gray-600">${new Date(interview.datetime).toLocaleString()}</div> | |
| <div class="font-medium">${interview.participantId}</div> | |
| <div class="text-sm text-gray-500">Project: ${interview.projectId}</div> | |
| </div> | |
| `).join(''); | |
| } | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=dataquantals/quantals-collect" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |