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 
 
 
 
 
 
 
16ec358
3ca1cd5
 
 
 
 
 
 
 
16ec358
 
3ca1cd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16ec358
 
3ca1cd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16ec358
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Autotutorial.ai</title>
    <link rel="manifest" href="manifest.json"> <!--  Create this file for PWA -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!-- Ionic CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@7/css/ionic.bundle.css">

    <!-- Google Fonts (Inter) -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
     <style>
        :root {
            --ion-font-family: 'Inter', sans-serif;
             /*  Define app-specific colors (based on previous designs, refined)*/
            --app-primary: #4f46e5; /* Indigo-600 from Tailwind/Radix */
            --app-primary-rgb: 79,70,229;
            --app-primary-contrast: #ffffff;
            --app-primary-contrast-rgb: 255,255,255;
            --app-primary-shade: #4640cc;  /* Slightly darker shade */
            --app-primary-tint: #615ce6;   /* Slightly lighter tint */

            --ion-color-primary: var(--app-primary);
            --ion-color-primary-rgb: var(--app-primary-rgb);
            --ion-color-primary-contrast: var(--app-primary-contrast);
            --ion-color-primary-contrast-rgb: var(--app-primary-contrast-rgb);
            --ion-color-primary-shade: var(--app-primary-shade);
            --ion-color-primary-tint: var(--app-primary-tint);
        }

        /*  Global Style Tweaks */
        body {
            font-family: var(--ion-font-family);
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        .video-preview-container {
            border-radius: var(--ion-border-radius);
            overflow: hidden;
            position: relative; /* For overlay */
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow */
        }

        .video-title-overlay {
            position: absolute;
            bottom: 16px;
            left: 16px;
            color: white;
            font-size: 1.2em;
            font-weight: 600;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
        }
        .hidden {
            display: none !important;
        }

    </style>
</head>
<body>
    <ion-app>
        <ion-header>
            <ion-toolbar color="primary">
                <ion-title>Autotutorial.ai</ion-title>
                <ion-buttons slot="end">
                    <ion-button id="helpButton">
                      <ion-icon slot="icon-only" name="help-circle"></ion-icon>
                    </ion-button>
                </ion-buttons>
            </ion-toolbar>
        </ion-header>

        <ion-content class="ion-padding">
            <!--  Main Content: Generate Tutorial -->
            <div id="generate-content">

                <ion-card>
                    <ion-card-header>
                        <ion-card-title>Generate Tutorial</ion-card-title>
                        <ion-card-subtitle>Create a new video tutorial</ion-card-subtitle>
                    </ion-card-header>

                    <ion-card-content>
                        <ion-list lines="full">
                            <ion-item>
                                <ion-label position="floating">Tutorial Topic</ion-label>
                                <ion-input id="tutorialTopic" value="CSS Grid Layout"></ion-input>
                            </ion-item>
                            <ion-item>
                                <ion-label>Duration</ion-label>
                                <ion-select id="tutorialDuration" value="10">
                                    <ion-select-option value="5">5 Minutes</ion-select-option>
                                    <ion-select-option value="10">10 Minutes</ion-select-option>
                                    <ion-select-option value="15">15 Minutes</ion-select-option>
                                    <ion-select-option value="20">20 Minutes</ion-select-option>
                                </ion-select>
                            </ion-item>
                            <ion-item>
                                <ion-label position="floating">OpenAI API Key (Optional)</ion-label>
                                <ion-input id="openaiApiKey" type="text" placeholder="sk-..." value="sk-DEMO_OPENAI_KEY"></ion-input>
                            </ion-item>
                            <ion-item>
                                <ion-label position="floating">Video Gen. API Key (Optional)</ion-label>
                                <ion-input id="videoGenApiKey" type="text" placeholder="vg-..." value="vg-DEMO_VIDEO_KEY"></ion-input>
                            </ion-item>
                        </ion-list>

                        <ion-button id="generateButton" expand="block" color="primary" style="margin-top: 20px;">
                            <ion-icon slot="start" name="play-circle"></ion-icon>
                            Generate
                        </ion-button>
                        <ion-button id="resetButton" expand="block" color="medium" style="margin-top: 10px;" class="hidden">
                            <ion-icon slot="start" name="refresh"></ion-icon>
                            Reset
                        </ion-button>
                    </ion-card-content>
                </ion-card>



                <ion-card id="statusCard" class="hidden">
                    <ion-card-header>
                        <ion-card-title>Status</ion-card-title>
                    </ion-card-header>
                    <ion-card-content>
                        <ion-list id="statusList"></ion-list>
                        <ion-progress-bar id="progressBar" type="indeterminate"></ion-progress-bar> <!-- Changed to indeterminate -->
                        <ion-text color="danger" id="errorMessage" class="hidden"></ion-text>
                    </ion-card-content>
                </ion-card>

                <ion-card id="previewCard" class="hidden">
                  <ion-card-header>
                    <ion-card-title>Tutorial Preview</ion-card-title>
                  </ion-card-header>
                  <ion-card-content>
                    <div class="video-preview-container">
                      <video id="tutorialVideo" controls width="100%" preload="metadata">
                        <source src="https://vjs.zencdn.net/v/oceans.mp4" type="video/mp4"> <!-- Better demo video -->
                        Your browser does not support the video tag.
                      </video>
                      <div id="videoTitleOverlay" class="video-title-overlay"></div>
                    </div>
                    <ion-button expand="block" id="downloadButton" style="margin-top: 16px;">
                        <ion-icon slot="start" name="download"></ion-icon>
                        Download (Demo)
                    </ion-button>
                  </ion-card-content>
                </ion-card>
            </div>


            <!-- Tutorial History (Initially Hidden) -->
             <div id="history-content" class="hidden">
                <ion-card>
                    <ion-card-header>
                        <ion-card-title>Tutorial History</ion-card-title>
                        <ion-card-subtitle>View your past tutorials</ion-card-subtitle>
                    </ion-card-header>
                    <ion-card-content>
                        <ion-list id="historyList">
                            <ion-item button class="history-item" data-title="React Hooks Guide">
                                <ion-label>React Hooks Guide</ion-label>
                                <ion-note slot="end">Oct 28, 2023</ion-note> <!-- Use ion-note for date -->
                            </ion-item>
                            <ion-item button class="history-item" data-title="Vue.js Composition API">
                                <ion-label>Vue.js Composition API</ion-label>
                                 <ion-note slot="end">Oct 27, 2023</ion-note>
                            </ion-item>
                            <ion-item button class="history-item" data-title="Python for Data Science">
                                <ion-label>Python for Data Science</ion-label>
                                <ion-note slot="end">Oct 26, 2023</ion-note>
                            </ion-item>
                        </ion-list>
                        <ion-text color="medium">
                            <p>This is a simulated history for demo purposes.</p>
                        </ion-text>
                    </ion-card-content>
                </ion-card>
             </div>

            <!--  Settings (Initially Hidden) -->
            <div id="settings-content" class="hidden">
                <ion-card>
                    <ion-card-header>
                        <ion-card-title>Settings</ion-card-title>
                        <ion-card-subtitle>Configure app preferences</ion-card-subtitle>
                    </ion-card-header>
                    <ion-card-content>
                        <ion-list lines="full">
                            <ion-item>
                                <ion-label>Default Duration</ion-label>
                                <ion-select id="defaultDuration" value="10">
                                    <ion-select-option value="5">5 Minutes</ion-select-option>
                                    <ion-select-option value="10">10 Minutes</ion-select-option>
                                    <ion-select-option value="15">15 Minutes</ion-select-option>
                                    <ion-select-option value="20">20 Minutes</ion-select-option>
                                </ion-select>
                            </ion-item>
                            <ion-item>
                                <ion-label>Default Quality</ion-label>
                                <ion-select id="defaultQuality" value="720p">
                                    <ion-select-option value="720p">720p</ion-select-option>
                                    <ion-select-option value="1080p">1080p</ion-select-option>
                                    <ion-select-option value="4k">4K (Premium)</ion-select-option>
                                </ion-select>
                            </ion-item>
                           <ion-item>
                                <ion-label>Voiceover Language</ion-label>
                                <ion-select id="defaultVoiceover" value="en-US">
                                  <ion-select-option value="en-US">English (US)</ion-select-option>
                                  <ion-select-option value="en-GB">English (UK)</ion-select-option>
                                  <ion-select-option value="es-ES">Spanish (ES)</ion-select-option>
                                </ion-select>
                           </ion-item>
                            <ion-item>
                                <ion-label>Output Format</ion-label>
                                <ion-select id="defaultOutput" value="mp4">
                                  <ion-select-option value="mp4">MP4</ion-select-option>
                                  <ion-select-option value="mov">MOV</ion-select-option>
                                  <ion-select-option value="webm">WebM</ion-select-option>
                                </ion-select>
                            </ion-item>
                        </ion-list>
                        <ion-button id="applySettingsButton" expand="block" style="margin-top: 20px;">
                            <ion-icon slot="start" name="save"></ion-icon>
                            Apply Settings
                        </ion-button>
                    </ion-card-content>
                </ion-card>
            </div>

            <!-- Help Modal (Initially Hidden) -->
             <ion-modal id="helpModal" trigger="helpButton">
                <ion-header>
                    <ion-toolbar>
                        <ion-title>Help & Support</ion-title>
                        <ion-buttons slot="end">
                            <ion-button onclick="closeHelpModal()">
                                <ion-icon slot="icon-only" name="close"></ion-icon>
                            </ion-button>
                        </ion-buttons>
                    </ion-toolbar>
                </ion-header>
                <ion-content class="ion-padding">
                  <p>Welcome to Autotutorial.ai, the app that makes creating video tutorials a breeze!</p>
                  <p><strong>Getting Started:</strong></p>
                  <ol>
                    <li>Navigate to the <strong>Generate Tutorial</strong> section.</li>
                    <li>Enter the topic of your tutorial in the <strong>Tutorial Topic</strong> field.</li>
                    <li>Select your desired tutorial length using the <strong>Duration</strong> dropdown.</li>
                    <li><em>(Optional)</em> If you have API keys for OpenAI and a video generation service, you can enter them in the respective fields for enhanced tutorial creation.  This is not required for basic functionality.</li>
                    <li>Click the <strong>Generate</strong> button to start the automated tutorial creation process.</li>
                    <li>Monitor the <strong>Status</strong> section to see the progress of your tutorial generation.</li>
                    <li>Once complete, preview your generated tutorial in the <strong>Tutorial Preview</strong> section.</li>
                  </ol>
                  <p><strong>Tutorial History</strong> allows you to view a list of your previously generated tutorials (simulated in this demo).</p>
                  <p><strong>Settings</strong> let you configure default preferences for new tutorials (also simulated in this demo).</p>
                  <p>For any questions or support, please contact us at: <a href="mailto:[email protected]">[email protected]</a></p>
                </ion-content>
            </ion-modal>

        </ion-content>

        <ion-footer>
            <ion-toolbar>
                <ion-tabs>
                    <ion-tab-bar slot="bottom">
                        <ion-tab-button tab="generate" onclick="showSection('generate')">
                            <ion-icon name="play-circle"></ion-icon>
                            <ion-label>Generate</ion-label>
                        </ion-tab-button>
                        <ion-tab-button tab="history" onclick="showSection('history')">
                            <ion-icon name="time"></ion-icon>
                            <ion-label>History</ion-label>
                        </ion-tab-button>
                        <ion-tab-button tab="settings" onclick="showSection('settings')">
                            <ion-icon name="settings"></ion-icon>
                            <ion-label>Settings</ion-label>
                        </ion-tab-button>
                    </ion-tab-bar>
                </ion-tabs>
            </ion-toolbar>
        </ion-footer>

    </ion-app>

    <!-- Ionic JavaScript -->
    <script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@7/dist/ionic/ionic.esm.js"></script>
    <script nomodule src="https://cdn.jsdelivr.net/npm/@ionic/core@7/dist/ionic/ionic.js"></script>

    <script>

      function showSection(sectionId) {
          // Hide all content sections
          document.getElementById('generate-content').classList.add('hidden');
          document.getElementById('history-content').classList.add('hidden');
          document.getElementById('settings-content').classList.add('hidden');

            // Remove active class from all tab buttons.  Important for visual state.
          document.querySelectorAll('ion-tab-button').forEach(btn => btn.classList.remove('tab-selected'));


          // Show the selected section
          document.getElementById(`${sectionId}-content`).classList.remove('hidden');

          // Highlight active tab button
          document.querySelector(`ion-tab-button[tab="${sectionId}"]`).classList.add('tab-selected');

            // Hide preview and status cards when switching tabs *away* from generate
            if (sectionId !== 'generate') {
              document.getElementById('previewCard').classList.add('hidden');
              document.getElementById('statusCard').classList.add('hidden');
            }
        }

        function closeHelpModal() {
            const modal = document.getElementById('helpModal');
            modal.dismiss();
        }


        document.addEventListener('DOMContentLoaded', () => {
            const generateButton = document.getElementById('generateButton');
            const resetButton = document.getElementById('resetButton');
            const statusCard = document.getElementById('statusCard');
            const statusList = document.getElementById('statusList');
            const progressBar = document.getElementById('progressBar');
            const previewCard = document.getElementById('previewCard');
            const videoTitleOverlay = document.getElementById('videoTitleOverlay');
            const tutorialVideo = document.getElementById('tutorialVideo');
            const errorMessage = document.getElementById('errorMessage');

          //  History click handler (simulated "load")
            const historyList = document.getElementById('historyList');
            historyList.addEventListener('click', (event) => {
              const item = event.target.closest('.history-item'); //  Find closest item
              if (item) {
                const title = item.dataset.title;
                videoTitleOverlay.textContent = title;
                previewCard.classList.remove('hidden'); // Show preview card
                //  You could simulate loading different videos here if you have multiple sources
                // tutorialVideo.src = 'another_video.mp4';
                // tutorialVideo.load();
                statusCard.classList.remove('hidden'); // Show status
                statusList.innerHTML = `<ion-item><ion-label color="primary">Loading ${title}...</ion-label></ion-item>`; // Show loading message

              }

            });

          // Apply Settings simulation
            document.getElementById('applySettingsButton').addEventListener('click', () => {
              // Simulate setting changes (could visually update UI elements if desired)
              statusCard.classList.remove('hidden');
              statusList.innerHTML = `<ion-item><ion-label color="success">Settings applied!</ion-label></ion-item>`;
            });


          //  Generate Button Click Handler
            generateButton.addEventListener('click', () => {
                const topic = document.getElementById('tutorialTopic').value;
                const duration = document.getElementById('tutorialDuration').value;
                const openaiKey = document.getElementById('openaiApiKey').value;
                const videoGenKey = document.getElementById('videoGenApiKey').value;

                // Clear previous status and error messages
                statusList.innerHTML = '';
                errorMessage.textContent = '';
                errorMessage.classList.add('hidden');

                // Show status and progress bar
                statusCard.classList.remove('hidden');
                progressBar.type = 'indeterminate'; // Start indeterminate

                // Hide preview card (until generation is complete)
                previewCard.classList.add('hidden');

                // Hide Generate, show Reset
                generateButton.classList.add('hidden');
                resetButton.classList.remove('hidden');

                const steps = [
                    { message: "Analyzing Topic...", delay: 800 },
                    { message: "Generating Script Outline (AI)...", delay: 1500 },
                    { message: "Writing Script Content (AI)...", delay: 2200 },
                    { message: "Synthesizing Voiceover (AI)...", delay: 1800 },
                    { message: "Selecting Relevant Visuals...", delay: 1600 },
                    { message: "Assembling Video Scenes...", delay: 2400 },
                    { message: "Adding Transitions and Effects...", delay: 1500 },
                    { message: "Rendering Final Video...", delay: 3000 }
                ];

                let currentStep = 0;

                function simulateStep() {
                    if (currentStep < steps.length) {
                        const listItem = document.createElement('ion-item');
                        listItem.innerHTML = `<ion-label>${steps[currentStep].message}</ion-label>`;
                        statusList.appendChild(listItem);

                        //  Simulate varying delays
                        const delay = steps[currentStep].delay + (Math.random() * 500 - 250); // +/- 250ms variation

                        setTimeout(() => {
                            currentStep++;
                            simulateStep();
                        }, delay);

                    } else {
                        //  Generation "complete"
                        progressBar.type = 'determinate'; // Switch to determinate for final "fill"
                        progressBar.value = 1; // Set to 100%

                         statusList.innerHTML = `<ion-item><ion-label color="success">Tutorial generation complete!</ion-label></ion-item>`;

                        videoTitleOverlay.textContent = `${topic} (${duration} min)`;
                        previewCard.classList.remove('hidden');

                        // Show generate, hide reset
                         generateButton.classList.remove('hidden');
                        resetButton.classList.add('hidden');
                    }
                }

                simulateStep();
            });

            // Reset Button Click Handler
            resetButton.addEventListener('click', () => {
                // Clear form fields
                document.getElementById('tutorialTopic').value = '';
                document.getElementById('tutorialDuration').value = '10';
                document.getElementById('openaiApiKey').value = '';
                document.getElementById('videoGenApiKey').value = '';

                // Hide status, error, and preview cards
                statusCard.classList.add('hidden');
                errorMessage.classList.add('hidden');
                previewCard.classList.add('hidden');

                // Clear status list
                statusList.innerHTML = '';

                // Reset progress bar
                progressBar.value = 0;
                progressBar.type = 'indeterminate';

                 // Show Generate, hide Reset
                generateButton.classList.remove('hidden');
                resetButton.classList.add('hidden');
            });

            document.getElementById('downloadButton').addEventListener('click', () => {
              // Simulate download
                statusCard.classList.remove('hidden');
                statusList.innerHTML = `<ion-item><ion-label color="primary">Downloading (simulated)...</ion-label></ion-item>`;
            });
        });
    </script>
</body>
</html>