Commit
·
899ba6d
1
Parent(s):
93b03bf
Refactor dataset search and sorting functionality, add share query button, update findSimilarFromResult function, improve dataset suggestions handling, make the page mobile friendly, and refactor dataset input to include trending dataset suggestions.
Browse files- index.html +57 -60
index.html
CHANGED
@@ -246,14 +246,6 @@
|
|
246 |
<span class="bg-blue-50 px-2 py-1 rounded text-sm">
|
247 |
${(result.similarity * 100).toFixed(1)}% match
|
248 |
</span>
|
249 |
-
<button
|
250 |
-
onclick="shareResult('${result.dataset_id}')"
|
251 |
-
class="flex items-center gap-1 text-sm text-blue-500 hover:text-blue-700"
|
252 |
-
title="Share link to these search results"
|
253 |
-
>
|
254 |
-
<i data-lucide="share-2"></i>
|
255 |
-
Share Results
|
256 |
-
</button>
|
257 |
<button
|
258 |
onclick="findSimilarFromResult('${
|
259 |
result.dataset_id
|
@@ -500,11 +492,11 @@
|
|
500 |
} results</span>
|
501 |
<button
|
502 |
onclick="shareResults()"
|
503 |
-
class="flex items-center gap-1 text-sm
|
504 |
-
title="
|
505 |
>
|
506 |
-
<i data-lucide="
|
507 |
-
|
508 |
</button>
|
509 |
</div>
|
510 |
</div>
|
@@ -513,43 +505,43 @@
|
|
513 |
results.length >= RESULTS_PER_PAGE * page &&
|
514 |
RESULTS_PER_PAGE * (page + 1) <= MAX_RESULTS
|
515 |
? `<div class="mt-4 flex items-center justify-between">
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
<button
|
524 |
onclick="shareResults()"
|
525 |
-
class="flex items-center gap-1 text-sm
|
526 |
-
title="
|
527 |
>
|
528 |
-
<i data-lucide="
|
529 |
-
|
530 |
</button>
|
531 |
-
</div
|
532 |
-
|
533 |
-
? `<div class="text-center mt-4 p-6 bg-blue-50 rounded-lg">
|
534 |
-
<p class="text-gray-700 mb-3">You've reached the end of our dataset journey! (${MAX_RESULTS} results)</p>
|
535 |
-
<p class="text-gray-600 mb-4">Can't find what you're looking for? Why not create and share your own dataset?</p>
|
536 |
-
<div class="flex items-center justify-center gap-4">
|
537 |
-
<a href="https://huggingface.co/docs/datasets/upload_dataset"
|
538 |
-
target="_blank"
|
539 |
-
class="inline-flex items-center gap-2 text-blue-500 hover:text-blue-700">
|
540 |
-
<i data-lucide="external-link"></i>
|
541 |
-
Learn how to share your dataset on Hugging Face
|
542 |
-
</a>
|
543 |
-
<button
|
544 |
-
onclick="shareResults()"
|
545 |
-
class="flex items-center gap-1 text-blue-500 hover:text-blue-700"
|
546 |
-
title="Share link to these search results"
|
547 |
-
>
|
548 |
-
<i data-lucide="share-2"></i>
|
549 |
-
Share Results
|
550 |
-
</button>
|
551 |
-
</div>
|
552 |
-
</div>`
|
553 |
: ""
|
554 |
}
|
555 |
`;
|
@@ -649,30 +641,35 @@
|
|
649 |
}
|
650 |
|
651 |
try {
|
652 |
-
|
653 |
-
// Use native sharing on supported devices
|
654 |
-
await navigator.share({
|
655 |
-
title: "Hub Semantic Search",
|
656 |
-
text: "Check out these dataset search results",
|
657 |
-
url: currentURL.toString(),
|
658 |
-
});
|
659 |
-
} else {
|
660 |
-
// Fallback to clipboard copy
|
661 |
-
await navigator.clipboard.writeText(currentURL.toString());
|
662 |
|
663 |
-
|
664 |
-
|
|
|
|
|
|
|
665 |
const originalHTML = button.innerHTML;
|
666 |
-
button.innerHTML =
|
|
|
|
|
|
|
|
|
|
|
|
|
667 |
lucide.createIcons();
|
668 |
|
669 |
setTimeout(() => {
|
670 |
button.innerHTML = originalHTML;
|
|
|
|
|
|
|
|
|
|
|
671 |
lucide.createIcons();
|
672 |
}, 2000);
|
673 |
-
}
|
674 |
} catch (error) {
|
675 |
-
console.error("Error
|
676 |
}
|
677 |
}
|
678 |
|
|
|
246 |
<span class="bg-blue-50 px-2 py-1 rounded text-sm">
|
247 |
${(result.similarity * 100).toFixed(1)}% match
|
248 |
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
<button
|
250 |
onclick="findSimilarFromResult('${
|
251 |
result.dataset_id
|
|
|
492 |
} results</span>
|
493 |
<button
|
494 |
onclick="shareResults()"
|
495 |
+
class="flex items-center gap-1 text-sm px-3 py-1.5 bg-white border border-gray-200 rounded-lg hover:bg-gray-50"
|
496 |
+
title="Copy link to these search results"
|
497 |
>
|
498 |
+
<i data-lucide="link"></i>
|
499 |
+
Copy Search Link
|
500 |
</button>
|
501 |
</div>
|
502 |
</div>
|
|
|
505 |
results.length >= RESULTS_PER_PAGE * page &&
|
506 |
RESULTS_PER_PAGE * (page + 1) <= MAX_RESULTS
|
507 |
? `<div class="mt-4 flex items-center justify-between">
|
508 |
+
<button
|
509 |
+
onclick="loadMore()"
|
510 |
+
class="px-6 py-3 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg transition-colors flex items-center gap-2"
|
511 |
+
>
|
512 |
+
<i data-lucide="more-horizontal"></i>
|
513 |
+
Load More Results
|
514 |
+
</button>
|
515 |
+
<button
|
516 |
+
onclick="shareResults()"
|
517 |
+
class="flex items-center gap-1 text-sm px-3 py-1.5 bg-white border border-gray-200 rounded-lg hover:bg-gray-50"
|
518 |
+
title="Copy link to these search results"
|
519 |
+
>
|
520 |
+
<i data-lucide="link"></i>
|
521 |
+
Copy Search Link
|
522 |
+
</button>
|
523 |
+
</div>`
|
524 |
+
: results.length >= MAX_RESULTS
|
525 |
+
? `<div class="text-center mt-4 p-6 bg-blue-50 rounded-lg">
|
526 |
+
<p class="text-gray-700 mb-3">You've reached the end of our dataset journey! (${MAX_RESULTS} results)</p>
|
527 |
+
<p class="text-gray-600 mb-4">Can't find what you're looking for? Why not create and share your own dataset?</p>
|
528 |
+
<div class="flex items-center justify-center gap-4">
|
529 |
+
<a href="https://huggingface.co/docs/datasets/upload_dataset"
|
530 |
+
target="_blank"
|
531 |
+
class="inline-flex items-center gap-2 text-blue-500 hover:text-blue-700">
|
532 |
+
<i data-lucide="external-link"></i>
|
533 |
+
Learn how to share your dataset on Hugging Face
|
534 |
+
</a>
|
535 |
<button
|
536 |
onclick="shareResults()"
|
537 |
+
class="flex items-center gap-1 text-sm px-3 py-1.5 bg-white border border-gray-200 rounded-lg hover:bg-gray-50"
|
538 |
+
title="Copy link to these search results"
|
539 |
>
|
540 |
+
<i data-lucide="link"></i>
|
541 |
+
Copy Search Link
|
542 |
</button>
|
543 |
+
</div>
|
544 |
+
</div>`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
: ""
|
546 |
}
|
547 |
`;
|
|
|
641 |
}
|
642 |
|
643 |
try {
|
644 |
+
await navigator.clipboard.writeText(currentURL.toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
645 |
|
646 |
+
// Show success message
|
647 |
+
const buttons = document.querySelectorAll(
|
648 |
+
'button[onclick="shareResults()"]'
|
649 |
+
);
|
650 |
+
buttons.forEach((button) => {
|
651 |
const originalHTML = button.innerHTML;
|
652 |
+
button.innerHTML =
|
653 |
+
'<i data-lucide="check"></i> Search Link Copied!';
|
654 |
+
button.classList.add(
|
655 |
+
"bg-green-50",
|
656 |
+
"border-green-200",
|
657 |
+
"text-green-600"
|
658 |
+
);
|
659 |
lucide.createIcons();
|
660 |
|
661 |
setTimeout(() => {
|
662 |
button.innerHTML = originalHTML;
|
663 |
+
button.classList.remove(
|
664 |
+
"bg-green-50",
|
665 |
+
"border-green-200",
|
666 |
+
"text-green-600"
|
667 |
+
);
|
668 |
lucide.createIcons();
|
669 |
}, 2000);
|
670 |
+
});
|
671 |
} catch (error) {
|
672 |
+
console.error("Error copying to clipboard:", error);
|
673 |
}
|
674 |
}
|
675 |
|