Skip to content

Commit

Permalink
fix: ensure modal displays 'No results found' when search yields no r…
Browse files Browse the repository at this point in the history
…esults
  • Loading branch information
tarunsinghofficial committed Aug 30, 2024
1 parent e6aa74a commit 2cceb1d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
function routeSelected(event) {
const route = event.detail.route;
const routeId = route?.id || searchQuery;
alert(`TODO: show route ${routeId}`);
alert(`TODO: show route ${routeId}`);
closeModal();
}
Expand Down Expand Up @@ -80,9 +80,17 @@
</ModalPane>
{/if}
{#if searchResults && (searchResults.stopSearchResults?.list?.length > 0 || searchResults.routeSearchResults?.list?.length > 0)}
{#if searchResults}
<ModalPane on:close={closeModal}>
<SearchResults {searchResults} on:routeSelected={routeSelected} on:stopSelected={stopSelected} />
{#if searchResults.stopSearchResults?.list?.length > 0 || searchResults.routeSearchResults?.list?.length > 0}
<SearchResults
{searchResults}
on:routeSelected={routeSelected}
on:stopSelected={stopSelected}
/>
{:else}
<p class="p-4 text-center">No results found.</p>
{/if}
</ModalPane>
{/if}
Expand Down

0 comments on commit 2cceb1d

Please sign in to comment.