akhaliq HF Staff commited on
Commit
8dfab88
·
1 Parent(s): e0ee826

style: remove below-the-fold examples grid and integrate clean visual example pills directly inside the main UI under the input card

Browse files
Files changed (1) hide show
  1. index.html +88 -145
index.html CHANGED
@@ -453,21 +453,23 @@
453
  }
454
 
455
  .quick-example-pill {
456
- background: rgba(255, 255, 255, 0.02);
457
- border: 1px solid rgba(255, 255, 255, 0.04);
 
 
 
458
  backdrop-filter: blur(8px);
459
  -webkit-backdrop-filter: blur(8px);
460
  color: rgba(255, 255, 255, 0.65);
461
- padding: 6px 12px;
462
  border-radius: 100px;
463
  font-size: 12px;
464
  font-family: var(--font-inter);
465
  cursor: pointer;
466
  transition: var(--transition-fast);
467
- max-width: 180px;
468
  white-space: nowrap;
469
  overflow: hidden;
470
- text-overflow: ellipsis;
471
  }
472
 
473
  .quick-example-pill:hover {
@@ -477,6 +479,37 @@
477
  transform: translateY(-1px);
478
  }
479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  /* Bottom Section elements */
481
  .viewport-bottom {
482
  display: flex;
@@ -1818,18 +1851,7 @@
1818
 
1819
  </div>
1820
 
1821
- <!-- FOLD 2: RECOMMENDED EXAMPLES GRID SECTION (BELOW THE FOLD) -->
1822
- <div class="examples-section-fold" id="examples-wrapper-element">
1823
- <div class="examples-container">
1824
- <div class="section-header">
1825
- <i data-lucide="sparkles"></i>
1826
- <span id="examples-section-title">Recommended Cases</span>
1827
- </div>
1828
- <div class="examples-grid" id="examples-grid-container">
1829
- <!-- Will be populated dynamically via renderRecommendedGrid() -->
1830
- </div>
1831
- </div>
1832
- </div>
1833
 
1834
  <!-- SLIDE-OUT CONTROLS SIDEBAR -->
1835
  <div class="controls-sidebar" id="sidebar-controls-pane">
@@ -2022,11 +2044,7 @@
2022
  window.scrollTo({ top: 0, behavior: 'smooth' });
2023
  }
2024
 
2025
- function scrollToExamples() {
2026
- const examplesFold = document.getElementById("examples-wrapper-element");
2027
- examplesFold.style.display = "block";
2028
- examplesFold.scrollIntoView({ behavior: "smooth" });
2029
- }
2030
 
2031
  function toggleSidebar() {
2032
  const pane = document.getElementById("sidebar-controls-pane");
@@ -2111,8 +2129,7 @@
2111
  const centeredImageOutput = document.getElementById("centered-image-output");
2112
  const centeredVideoOutput = document.getElementById("centered-video-output");
2113
  const closeTerminalTrigger = document.getElementById("close-terminal-trigger");
2114
- const examplesGridContainer = document.getElementById("examples-grid-container");
2115
- const examplesWrapperElement = document.getElementById("examples-wrapper-element");
2116
 
2117
  // Trigger and status panel
2118
  const generateTrigger = document.getElementById("generate-trigger");
@@ -2382,7 +2399,7 @@
2382
 
2383
  // Populate examples
2384
  renderQuickExamples(activeTask);
2385
- renderRecommendedGrid(activeTask);
2386
  }
2387
 
2388
  // --- Populate Resolutions, ratios, durations dynamically ---
@@ -2605,8 +2622,51 @@
2605
 
2606
  const pill = document.createElement("button");
2607
  pill.className = "quick-example-pill";
2608
- pill.textContent = promptText;
2609
- pill.title = promptText;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2610
 
2611
  pill.addEventListener("click", () => {
2612
  populateExample(row);
@@ -2614,6 +2674,7 @@
2614
 
2615
  quickExamplesWrapper.appendChild(pill);
2616
  }
 
2617
  } else {
2618
  quickExamplesBox.style.display = "none";
2619
  }
@@ -2626,125 +2687,7 @@
2626
  return "/api/file?path=" + encodeURIComponent(filePath);
2627
  }
2628
 
2629
- // --- Render Visual Examples Grid (Fold 2 below Fold 1) ---
2630
- function renderRecommendedGrid(task) {
2631
- if (!examplesGridContainer || !examplesWrapperElement) return;
2632
-
2633
- let cases = [];
2634
- let taskTitle = "Recommended Cases";
2635
- let badgeText = "Task";
2636
-
2637
- if (task === "t2v") {
2638
- cases = appConfig.VIDEO_GENERATION_EXAMPLES;
2639
- taskTitle = "Video Generation Recommended Cases";
2640
- badgeText = "Video Gen";
2641
- } else if (task === "video_edit") {
2642
- cases = appConfig.VIDEO_EDIT_EXAMPLES;
2643
- taskTitle = "Video Editing Recommended Cases";
2644
- badgeText = "Video Edit";
2645
- } else if (task === "x2t_video") {
2646
- cases = appConfig.VIDEO_UNDERSTANDING_EXAMPLES;
2647
- taskTitle = "Video Understanding Recommended Cases";
2648
- badgeText = "Video QA";
2649
- } else if (task === "t2i") {
2650
- cases = appConfig.IMAGE_GENERATION_EXAMPLES;
2651
- taskTitle = "Image Generation Recommended Cases";
2652
- badgeText = "Image Gen";
2653
- } else if (task === "image_edit") {
2654
- cases = appConfig.IMAGE_EDIT_EXAMPLES;
2655
- taskTitle = "Image Editing Recommended Cases";
2656
- badgeText = "Image Edit";
2657
- } else if (task === "x2t_image") {
2658
- cases = appConfig.IMAGE_UNDERSTANDING_EXAMPLES;
2659
- taskTitle = "Image Understanding Recommended Cases";
2660
- badgeText = "Image QA";
2661
- }
2662
-
2663
- const examplesTitleElement = document.getElementById("examples-section-title");
2664
- if (examplesTitleElement) {
2665
- examplesTitleElement.textContent = taskTitle;
2666
- }
2667
-
2668
- if (cases && cases.length > 0) {
2669
- examplesWrapperElement.style.display = "block";
2670
- examplesGridContainer.innerHTML = "";
2671
-
2672
- cases.forEach(row => {
2673
- const promptText = row[0];
2674
- if (!promptText) return;
2675
-
2676
- // Determine the visual preview media URL
2677
- // Index 1 = preview_video, Index 2 = input_video (fallback)
2678
- // Index 3 = preview_image, Index 4 = input_image (fallback)
2679
- const isVideoType = (task === "t2v" || task === "video_edit" || task === "x2t_video");
2680
- let mediaUrl = null;
2681
-
2682
- if (isVideoType) {
2683
- mediaUrl = resolveMediaUrl(row[1] || row[2]);
2684
- } else {
2685
- mediaUrl = resolveMediaUrl(row[3] || row[4]);
2686
- }
2687
-
2688
- // Create elegant Card
2689
- const card = document.createElement("div");
2690
- card.className = "example-card";
2691
-
2692
- // 1. Media Preview Area (if media exists)
2693
- if (mediaUrl) {
2694
- const mediaPreview = document.createElement("div");
2695
- mediaPreview.className = "example-media-preview";
2696
-
2697
- if (isVideoType) {
2698
- const video = document.createElement("video");
2699
- video.src = mediaUrl;
2700
- video.muted = true;
2701
- video.playsInline = true;
2702
- video.loop = true;
2703
-
2704
- // On hover play preview, on leave pause
2705
- card.addEventListener("mouseenter", () => {
2706
- video.play().catch(() => {});
2707
- });
2708
- card.addEventListener("mouseleave", () => {
2709
- video.pause();
2710
- video.currentTime = 0.5;
2711
- });
2712
-
2713
- mediaPreview.appendChild(video);
2714
- video.addEventListener("loadeddata", () => {
2715
- video.currentTime = 0.5;
2716
- });
2717
- } else {
2718
- const img = document.createElement("img");
2719
- img.src = mediaUrl;
2720
- mediaPreview.appendChild(img);
2721
- }
2722
- card.appendChild(mediaPreview);
2723
- }
2724
-
2725
- // 2. Task Badge
2726
- const badge = document.createElement("div");
2727
- badge.className = "example-badge";
2728
- badge.textContent = badgeText;
2729
- card.appendChild(badge);
2730
-
2731
- // 3. Prompt Text
2732
- const prompt = document.createElement("div");
2733
- prompt.className = "example-prompt";
2734
- prompt.textContent = promptText;
2735
- card.appendChild(prompt);
2736
 
2737
- // 4. Interaction click handler
2738
- card.addEventListener("click", () => {
2739
- populateExample(row);
2740
- });
2741
-
2742
- examplesGridContainer.appendChild(card);
2743
- });
2744
- } else {
2745
- examplesWrapperElement.style.display = "none";
2746
- }
2747
- }
2748
 
2749
  // --- Helper to calculate height/width based on Aspect Ratio ---
2750
  function calculateDimensions(aspectRatio, isImage) {
 
453
  }
454
 
455
  .quick-example-pill {
456
+ display: inline-flex;
457
+ align-items: center;
458
+ gap: 6px;
459
+ background: rgba(255, 255, 255, 0.03);
460
+ border: 1px solid rgba(255, 255, 255, 0.05);
461
  backdrop-filter: blur(8px);
462
  -webkit-backdrop-filter: blur(8px);
463
  color: rgba(255, 255, 255, 0.65);
464
+ padding: 4px 12px 4px 6px;
465
  border-radius: 100px;
466
  font-size: 12px;
467
  font-family: var(--font-inter);
468
  cursor: pointer;
469
  transition: var(--transition-fast);
470
+ max-width: 260px;
471
  white-space: nowrap;
472
  overflow: hidden;
 
473
  }
474
 
475
  .quick-example-pill:hover {
 
479
  transform: translateY(-1px);
480
  }
481
 
482
+ .quick-example-thumb {
483
+ width: 20px;
484
+ height: 20px;
485
+ border-radius: 50%;
486
+ object-fit: cover;
487
+ border: 1px solid rgba(255, 255, 255, 0.15);
488
+ background: #000;
489
+ flex-shrink: 0;
490
+ }
491
+
492
+ .quick-example-thumb-icon {
493
+ display: inline-flex;
494
+ align-items: center;
495
+ justify-content: center;
496
+ width: 20px;
497
+ height: 20px;
498
+ border-radius: 50%;
499
+ background: rgba(249, 115, 22, 0.1);
500
+ border: 1px solid rgba(249, 115, 22, 0.2);
501
+ color: var(--accent-orange);
502
+ font-size: 9px;
503
+ flex-shrink: 0;
504
+ }
505
+
506
+ .quick-example-text {
507
+ white-space: nowrap;
508
+ overflow: hidden;
509
+ text-overflow: ellipsis;
510
+ display: inline-block;
511
+ }
512
+
513
  /* Bottom Section elements */
514
  .viewport-bottom {
515
  display: flex;
 
1851
 
1852
  </div>
1853
 
1854
+
 
 
 
 
 
 
 
 
 
 
 
1855
 
1856
  <!-- SLIDE-OUT CONTROLS SIDEBAR -->
1857
  <div class="controls-sidebar" id="sidebar-controls-pane">
 
2044
  window.scrollTo({ top: 0, behavior: 'smooth' });
2045
  }
2046
 
2047
+
 
 
 
 
2048
 
2049
  function toggleSidebar() {
2050
  const pane = document.getElementById("sidebar-controls-pane");
 
2129
  const centeredImageOutput = document.getElementById("centered-image-output");
2130
  const centeredVideoOutput = document.getElementById("centered-video-output");
2131
  const closeTerminalTrigger = document.getElementById("close-terminal-trigger");
2132
+
 
2133
 
2134
  // Trigger and status panel
2135
  const generateTrigger = document.getElementById("generate-trigger");
 
2399
 
2400
  // Populate examples
2401
  renderQuickExamples(activeTask);
2402
+
2403
  }
2404
 
2405
  // --- Populate Resolutions, ratios, durations dynamically ---
 
2622
 
2623
  const pill = document.createElement("button");
2624
  pill.className = "quick-example-pill";
2625
+
2626
+ // Resolve visual preview URL (Index 1/2 for video, Index 3/4 for image)
2627
+ const isVideoType = (task === "t2v" || task === "video_edit" || task === "x2t_video");
2628
+ let mediaUrl = isVideoType ? resolveMediaUrl(row[1] || row[2]) : resolveMediaUrl(row[3] || row[4]);
2629
+
2630
+ if (mediaUrl) {
2631
+ if (isVideoType) {
2632
+ const thumbVideo = document.createElement("video");
2633
+ thumbVideo.src = mediaUrl;
2634
+ thumbVideo.className = "quick-example-thumb";
2635
+ thumbVideo.muted = true;
2636
+ thumbVideo.playsInline = true;
2637
+
2638
+ // Micro-animation: Hover to play tiny video thumbnail
2639
+ pill.addEventListener("mouseenter", () => {
2640
+ thumbVideo.play().catch(() => {});
2641
+ });
2642
+ pill.addEventListener("mouseleave", () => {
2643
+ thumbVideo.pause();
2644
+ thumbVideo.currentTime = 0.5;
2645
+ });
2646
+
2647
+ pill.appendChild(thumbVideo);
2648
+ thumbVideo.addEventListener("loadeddata", () => {
2649
+ thumbVideo.currentTime = 0.5;
2650
+ });
2651
+ } else {
2652
+ const thumbImg = document.createElement("img");
2653
+ thumbImg.src = mediaUrl;
2654
+ thumbImg.className = "quick-example-thumb";
2655
+ pill.appendChild(thumbImg);
2656
+ }
2657
+ } else {
2658
+ const fallbackIcon = document.createElement("div");
2659
+ fallbackIcon.className = "quick-example-thumb-icon";
2660
+ fallbackIcon.innerHTML = '<i data-lucide="sparkles" style="width:10px;height:10px;"></i>';
2661
+ pill.appendChild(fallbackIcon);
2662
+ }
2663
+
2664
+ // Add text element
2665
+ const textSpan = document.createElement("span");
2666
+ textSpan.className = "quick-example-text";
2667
+ textSpan.textContent = promptText;
2668
+ textSpan.title = promptText;
2669
+ pill.appendChild(textSpan);
2670
 
2671
  pill.addEventListener("click", () => {
2672
  populateExample(row);
 
2674
 
2675
  quickExamplesWrapper.appendChild(pill);
2676
  }
2677
+ lucide.createIcons();
2678
  } else {
2679
  quickExamplesBox.style.display = "none";
2680
  }
 
2687
  return "/api/file?path=" + encodeURIComponent(filePath);
2688
  }
2689
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2690
 
 
 
 
 
 
 
 
 
 
 
 
2691
 
2692
  // --- Helper to calculate height/width based on Aspect Ratio ---
2693
  function calculateDimensions(aspectRatio, isImage) {