mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 06:10:44 +08:00
Leave mobile search context menu open if search fails
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
+8
-7
@@ -140,7 +140,7 @@
|
||||
}>();
|
||||
|
||||
let input = "";
|
||||
let searching = false;
|
||||
let loading = false;
|
||||
let shaking = false;
|
||||
|
||||
function shake() {
|
||||
@@ -154,13 +154,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
searching = true;
|
||||
loading = true;
|
||||
|
||||
const query = input;
|
||||
const searchResult = await searchProjectsAndProfiles(input, config);
|
||||
|
||||
if (searchResult.type === "nothing") {
|
||||
searching = false;
|
||||
shake();
|
||||
} else if (searchResult.type === "error") {
|
||||
// TODO: show some kind of notification to the user.
|
||||
@@ -168,11 +167,13 @@
|
||||
} else if (searchResult.type === "singleProfile") {
|
||||
input = "";
|
||||
navigate(`/${searchResult.id}`, { replace: true });
|
||||
dispatch("finished");
|
||||
} else if (searchResult.type === "singleProject") {
|
||||
input = "";
|
||||
navigate(`/seeds/${searchResult.seedHost}/${searchResult.id}`, {
|
||||
replace: true,
|
||||
});
|
||||
dispatch("finished");
|
||||
} else if (searchResult.type === "projectsAndProfiles") {
|
||||
// TODO: show some kind of notification about any errors to the user.
|
||||
input = "";
|
||||
@@ -180,11 +181,11 @@
|
||||
query,
|
||||
results: searchResult.projectsAndProfiles,
|
||||
});
|
||||
dispatch("finished");
|
||||
} else {
|
||||
unreachable(searchResult);
|
||||
}
|
||||
searching = false;
|
||||
dispatch("finished");
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -215,12 +216,12 @@
|
||||
<div class:shaking>
|
||||
<TextInput
|
||||
variant="dashed"
|
||||
disabled={searching}
|
||||
disabled={loading}
|
||||
bind:value={input}
|
||||
on:keydown={search}
|
||||
placeholder="Search a name or address…">
|
||||
<svelte:fragment slot="right">
|
||||
{#if searching}
|
||||
{#if loading}
|
||||
<Loading small />
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
|
||||
Reference in New Issue
Block a user