Connect prompt creation flow and document API

This commit is contained in:
nachbaisabel committed 2026-05-30 17:11:42 +02:00
1 parent 863cf3e0ef
commit 691bc72681
16 files changed
+567 -54

No files matched your search

+16 -24
View File
@@ -93,24 +93,6 @@
</select>
</div>
<!-- Search -->
<div style="margin-bottom: 24px">
<input
id="search-input"
type="text"
placeholder="Search prompts..."
style="
width: 100%;
padding: 10px 16px;
border: 1px solid #e2e8f0;
border-radius: 30px;
font-size: 0.95rem;
outline: none;
background: #f8fafc;
"
/>
</div>
<!-- Prompts Grid -->
<div class="prompts-grid" id="prompts-grid"></div>
@@ -426,7 +408,7 @@
function renderCard(p) {
const locked = !p.canAccess && p.tierLevel != null;
const img = p._img || MARKET_IMAGES[cardIndex++ % MARKET_IMAGES.length];
const img = p.exampleImageUrl || p._img || MARKET_IMAGES[cardIndex++ % MARKET_IMAGES.length];
return `
<div class="prompt-card">
<img src="${img}" alt="${p.title}" class="prompt-img">
@@ -456,7 +438,7 @@
const grid = document.getElementById("prompts-grid");
const emptyEl = document.getElementById("market-empty");
const errorEl = document.getElementById("market-error");
const search = document.getElementById("search-input").value.trim();
const search = document.getElementById("topbarSearchInput")?.value.trim() || "";
const [sortBy, ascending] = document
.getElementById("sort-select")
.value.split("|");
@@ -605,10 +587,20 @@
document
.getElementById("sort-select")
.addEventListener("change", loadPrompts);
document.getElementById("search-input").addEventListener("input", () => {
clearTimeout(searchTimeout);
searchTimeout = setTimeout(loadPrompts, 400);
});
function wireMarketplaceTopbarSearch() {
const input = document.getElementById("topbarSearchInput");
if (!input || input.dataset.marketplaceSearchReady === "true") return;
input.dataset.marketplaceSearchReady = "true";
input.addEventListener("input", () => {
clearTimeout(searchTimeout);
searchTimeout = setTimeout(loadPrompts, 400);
});
}
const topbarObserver = new MutationObserver(wireMarketplaceTopbarSearch);
topbarObserver.observe(document.body, { childList: true, subtree: true });
wireMarketplaceTopbarSearch();
// Make openPayment global
window.openPayment = openPayment;