rahul7star commited on
Commit
8b702f2
·
verified ·
1 Parent(s): 605ea1f

check all buttons in UI are wokring - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +51 -5
index.html CHANGED
@@ -147,7 +147,7 @@
147
  </div>
148
  </div>
149
  </div>
150
- <div id="upload-preview" class="hidden">
151
  <div id="images-preview" class="hidden mb-4">
152
  <p class="text-sm font-medium mb-2"><span id="image-count">0</span> images selected</p>
153
  <div class="flex space-x-2 overflow-x-auto pb-2">
@@ -545,7 +545,20 @@
545
  document.querySelectorAll('.plan-select').forEach(btn => {
546
  btn.addEventListener('click', function() {
547
  const plan = this.getAttribute('data-plan');
548
- showToast(`${plan.charAt(0).toUpperCase() + plan.slice(1)} plan selected`);
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  });
550
  });
551
 
@@ -783,7 +796,17 @@
783
  document.querySelectorAll('.download-btn').forEach(btn => {
784
  btn.addEventListener('click', function() {
785
  const id = this.getAttribute('data-id');
786
- alert(`Downloading image ${id}. In a real app, this would trigger a download.`);
 
 
 
 
 
 
 
 
 
 
787
  });
788
  });
789
 
@@ -793,10 +816,14 @@
793
  const voice = document.getElementById('voice-select').value;
794
 
795
  if (!prompt) {
796
- alert('Please describe the video you want to generate');
797
  return;
798
  }
799
 
 
 
 
 
800
  // Show processing
801
  videoProgress.classList.remove('hidden');
802
 
@@ -825,6 +852,12 @@
825
  // Set video info
826
  videoTitle.textContent = prompt.substring(0, 30) + (prompt.length > 30 ? '...' : '');
827
  videoDuration.textContent = '1:45';
 
 
 
 
 
 
828
  }, 1000);
829
  }
830
  }, 300);
@@ -832,7 +865,20 @@
832
 
833
  // Download video button
834
  downloadVideoBtn.addEventListener('click', function() {
835
- alert('Downloading video. In a real app, this would trigger a download.');
 
 
 
 
 
 
 
 
 
 
 
 
 
836
  });
837
 
838
  // Smooth scrolling for navigation links
 
147
  </div>
148
  </div>
149
  </div>
150
+ <div id="upload-preview-container" class="hidden">
151
  <div id="images-preview" class="hidden mb-4">
152
  <p class="text-sm font-medium mb-2"><span id="image-count">0</span> images selected</p>
153
  <div class="flex space-x-2 overflow-x-auto pb-2">
 
545
  document.querySelectorAll('.plan-select').forEach(btn => {
546
  btn.addEventListener('click', function() {
547
  const plan = this.getAttribute('data-plan');
548
+ const planName = plan.charAt(0).toUpperCase() + plan.slice(1);
549
+
550
+ // Update UI to show selected plan
551
+ document.querySelectorAll('.plan-select').forEach(b => {
552
+ b.classList.remove('bg-purple-500', 'text-white');
553
+ b.classList.add('border-purple-500', 'text-purple-500', 'hover:bg-purple-50');
554
+ });
555
+
556
+ if (plan !== 'free') {
557
+ this.classList.remove('border-purple-500', 'text-purple-500', 'hover:bg-purple-50');
558
+ this.classList.add('bg-purple-500', 'text-white');
559
+ }
560
+
561
+ showToast(`${planName} plan selected`);
562
  });
563
  });
564
 
 
796
  document.querySelectorAll('.download-btn').forEach(btn => {
797
  btn.addEventListener('click', function() {
798
  const id = this.getAttribute('data-id');
799
+ const imgSrc = document.getElementById(`result-${id}`).src;
800
+
801
+ // Create a temporary anchor element to trigger download
802
+ const a = document.createElement('a');
803
+ a.href = imgSrc;
804
+ a.download = `ai-clone-${id}.jpg`;
805
+ document.body.appendChild(a);
806
+ a.click();
807
+ document.body.removeChild(a);
808
+
809
+ showToast('Download started!');
810
  });
811
  });
812
 
 
816
  const voice = document.getElementById('voice-select').value;
817
 
818
  if (!prompt) {
819
+ showToast('Please describe the video you want to generate', 'error');
820
  return;
821
  }
822
 
823
+ // Disable button during processing
824
+ generateVideoBtn.disabled = true;
825
+ generateVideoBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Processing...';
826
+
827
  // Show processing
828
  videoProgress.classList.remove('hidden');
829
 
 
852
  // Set video info
853
  videoTitle.textContent = prompt.substring(0, 30) + (prompt.length > 30 ? '...' : '');
854
  videoDuration.textContent = '1:45';
855
+
856
+ // Re-enable button
857
+ generateVideoBtn.disabled = false;
858
+ generateVideoBtn.innerHTML = '<i class="fas fa-video mr-2"></i> Generate Video';
859
+
860
+ showToast('Video generated successfully!');
861
  }, 1000);
862
  }
863
  }, 300);
 
865
 
866
  // Download video button
867
  downloadVideoBtn.addEventListener('click', function() {
868
+ if (!generatedVideo.src) {
869
+ showToast('No video available to download', 'error');
870
+ return;
871
+ }
872
+
873
+ // Create a temporary anchor element to trigger download
874
+ const a = document.createElement('a');
875
+ a.href = generatedVideo.src;
876
+ a.download = 'ai-video-clone.mp4';
877
+ document.body.appendChild(a);
878
+ a.click();
879
+ document.body.removeChild(a);
880
+
881
+ showToast('Video download started!');
882
  });
883
 
884
  // Smooth scrolling for navigation links