fix: input defocus on market and transactions page

This commit is contained in:
Face 2025-05-31 13:55:56 +03:00
parent bb7062987b
commit 0e68eb8c42
2 changed files with 27 additions and 5 deletions

View file

@ -135,10 +135,19 @@
function performSearch() {
currentPage = 1;
updateURL();
fetchMarketData();
}
function updateSearchUrl() {
updateURL();
}
function handleSearchKeydown(event: KeyboardEvent) {
if (event.key === 'Enter') {
updateSearchUrl();
}
}
$effect(() => {
if (searchQuery !== previousSearchQueryForEffect) {
debouncedSearch();
@ -253,6 +262,8 @@
bind:value={searchQuery}
placeholder="Search coins by name or symbol..."
class="pl-10 pr-4"
onblur={updateSearchUrl}
onkeydown={handleSearchKeydown}
/>
</div>
@ -434,8 +445,8 @@
<div class="flex items-center gap-3">
<CoinIcon icon={coin.icon} symbol={coin.symbol} size={8} />
<div>
<h3 class="text-lg font-semibold leading-tight truncate">{coin.name}</h3>
<p class="text-muted-foreground text-sm truncate">*{coin.symbol}</p>
<h3 class="truncate text-lg font-semibold leading-tight">{coin.name}</h3>
<p class="text-muted-foreground truncate text-sm">*{coin.symbol}</p>
</div>
</div>
<div class="text-right">

View file

@ -122,10 +122,19 @@
function performSearch() {
currentPage = 1;
updateURL();
fetchTransactions();
}
function updateSearchUrl() {
updateURL();
}
function handleSearchKeydown(event: KeyboardEvent) {
if (event.key === 'Enter') {
updateSearchUrl();
}
}
$effect(() => {
if (searchQuery !== previousSearchQueryForEffect) {
debouncedSearch();
@ -271,6 +280,8 @@
bind:value={searchQuery}
placeholder="Search by coin name or symbol..."
class="pl-10 pr-4"
onblur={updateSearchUrl}
onkeydown={handleSearchKeydown}
/>
</div>