init enumerate

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-04-11 20:43:30 +02:00
parent f53380fbd9
commit a0fceb36df
8 changed files with 793 additions and 7 deletions

View File

@@ -9,6 +9,8 @@
let redirecting = $state(false);
let redirectTarget = $state("");
let demo = $state(false);
let prefill = $state({ target: "", type: "" });
let ready = $state(false);
onMount(async () => {
loadSearches();
@@ -20,10 +22,20 @@
const params = new URLSearchParams(window.location.search);
const target = params.get("target");
const type = params.get("type");
const fillOnly = params.get("fillOnly") === "true";
if (target && type) {
// Clean URL before launching so a refresh doesn't re-trigger
// Clean URL before acting so a refresh doesn't re-trigger
window.history.replaceState({}, "", window.location.pathname);
if (fillOnly) {
prefill = { target, type };
ready = true;
return;
}
ready = true;
await handleSearch(target, type, params.get("profile") || "default");
} else {
ready = true;
}
});
@@ -77,8 +89,8 @@
Searching <span class="font-mono text-base-content/90">{redirectTarget}</span>...
</p>
</div>
{:else}
<SearchBar onSearch={handleSearch} {demo} />
{:else if ready}
<SearchBar onSearch={handleSearch} {demo} initialTarget={prefill.target} initialType={prefill.type} />
{/if}
</div>