-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add search via image description, and error handling
- Loading branch information
Showing
8 changed files
with
99 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
<div> | ||
<.back navigate={~p"/"}>Back</.back> | ||
<form class="mt-4" name="emoji-search" id="emoji-search" phx-submit="search"> | ||
<.form for={@form} class="mt-4" name="emoji-search" id="emoji-search" phx-submit="search"> | ||
<label for="search" class="block text-sm font-medium text-gray-700">Emoji Search</label> | ||
<div class="relative mt-1 flex items-center"> | ||
<input | ||
<.input | ||
type="text" | ||
name="query" | ||
value={@query} | ||
field={@form[:query]} | ||
id="query" | ||
required="true" | ||
class="block w-full rounded-md border-gray-300 pr-12 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" | ||
/> | ||
</div> | ||
</form> | ||
<br /> | ||
<.input | ||
field={@form[:search_via_images]} | ||
type="checkbox" | ||
label="Search via image description (experimental)" | ||
id="exact" | ||
class="ml-2" | ||
/> | ||
</.form> | ||
|
||
<div :if={@loading} class="mt-2 animate-pulse">Searching...</div> | ||
|
||
<ul :if={not @loading} role="list" class="mt-4 gap-6 grid grid-cols-3 divide-y divide-gray-200"> | ||
<li :for={{prediction, _distance} <- @results}> | ||
<li :for={{prediction, distance} <- @results}> | ||
<EmojiWeb.Components.emoji id={prediction.id} prediction={prediction} /> | ||
<div class="mt-2"> | ||
<.badge text={"Search distance: #{distance |> round()}"} /> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> |