Skip to content

Commit b9b65d0

Browse files
committed
Fix app search page
1 parent 081ea20 commit b9b65d0

File tree

2 files changed

+76
-25
lines changed

2 files changed

+76
-25
lines changed

lib/plexus_web/components/core_components.ex

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ defmodule PlexusWeb.CoreComponents do
1515
Icons are provided by [heroicons](https://heroicons.com). See `icon/1` for usage.
1616
"""
1717
use Phoenix.Component
18+
19+
use Phoenix.VerifiedRoutes,
20+
endpoint: PlexusWeb.Endpoint,
21+
router: PlexusWeb.Router,
22+
statics: PlexusWeb.static_paths()
23+
1824
use Gettext, backend: PlexusWeb.Gettext
1925

2026
alias Phoenix.LiveView.JS
@@ -642,15 +648,16 @@ defmodule PlexusWeb.CoreComponents do
642648
)
643649

644650
~H"""
645-
<div class="flex">
646-
<div class="aspect-h-1 aspect-w-1 w-24 h-24 bg-white overflow-hidden">
651+
<div class="flex bg-gray-100">
652+
<div class="aspect-h-1 aspect-w-1 w-24 h-24 overflow-hidden">
647653
<img
648654
src={icon_url(@app)}
649655
alt={@app.name <> " Icon"}
656+
loading="lazy"
650657
class="h-full w-full object-cover object-center"
651658
/>
652659
</div>
653-
<div class="flex-1 flex items-center justify-between bg-white truncate">
660+
<div class="flex-1 flex items-center justify-between truncate">
654661
<div class="flex-1 px-4 py-2 text-md leading-5 truncate">
655662
<div class="truncate text-gray-900 font-semibold transition ease-in-out duration-150">
656663
{@app.name}
@@ -663,32 +670,32 @@ defmodule PlexusWeb.CoreComponents do
663670
</p>
664671
</div>
665672
</div>
666-
<div class="flex flex-col justify-between bg-white">
673+
<div class="flex flex-col justify-between bg-gray-900">
667674
<div
668675
title="DeGoogled Score"
669676
class={[
670677
"flex flex-1 items-center justify-center w-24 text-white text-sm leading-5 font-medium",
671-
@native_level == :unrated && "bg-gray-700",
672-
@native_level == :borked && "bg-red-800",
673-
@native_level == :bronze && "bg-amber-800",
674-
@native_level == :silver && "bg-slate-300 text-black",
675-
@native_level == :gold && "bg-amber-200 black"
678+
@native_level == :unrated && "bg-linear-45 from-indigo-500 to-indigo-900",
679+
@native_level == :borked && "bg-linear-45 from-broken-500 to-broken-900",
680+
@native_level == :bronze && "bg-linear-45 from-bronze-400 to-bronze-800",
681+
@native_level == :silver && "bg-linear-45 from-silver-300 to-silver-700",
682+
@native_level == :gold && "bg-linear-45 from-gold-500 to-gold-900"
676683
]}
677684
>
678-
{@app.scores.native.numerator}
685+
<img src={~p"/images/de_googled.svg"} width="24" />
679686
</div>
680687
<div
681688
title="MicroG Score"
682689
class={[
683690
"flex flex-1 items-center justify-center w-24 text-white text-sm leading-5 font-medium",
684-
@micro_g_level == :unrated && "bg-gray-700",
685-
@micro_g_level == :borked && "bg-red-800",
686-
@micro_g_level == :bronze && "bg-amber-800",
687-
@micro_g_level == :silver && "bg-slate-300 text-black",
688-
@micro_g_level == :gold && "bg-amber-200 text-black"
691+
@micro_g_level == :unrated && "bg-linear-45 from-indigo-500 to-indigo-900",
692+
@micro_g_level == :borked && "bg-linear-45 from-broken-500 to-broken-900",
693+
@micro_g_level == :bronze && "bg-linear-45 from-bronze-400 to-bronze-800",
694+
@micro_g_level == :silver && "bg-linear-45 from-silver-300 to-silver-700",
695+
@micro_g_level == :gold && "bg-linear-45 from-gold-500 to-gold-900"
689696
]}
690697
>
691-
&mu;{@app.scores.micro_g.numerator}
698+
<img src={~p"/images/micro_g.svg"} width="24" />
692699
</div>
693700
</div>
694701
</div>

lib/plexus_web/live/app_live/index.html.heex

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,59 @@
1010
phx-submit="search"
1111
>
1212
<.focus_wrap id="focus-first-search">
13-
<.input field={@form[:search]} label="Search" phx-debounce="300" />
13+
<div class="mt-2 flex">
14+
<div class="-mr-px grid grow grid-cols-1 focus-within:relative">
15+
<input
16+
phx-debounce="300"
17+
aria-label="Search apps"
18+
type="text"
19+
name={@form[:search].name}
20+
value={Phoenix.HTML.Form.normalize_value("text", @form[:search].value)}
21+
id="query"
22+
class="col-start-1 row-start-1 block w-full rounded-l-md bg-white py-1.5 pr-3 pl-10 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:pl-9 sm:text-sm/6"
23+
placeholder="Search app name or package..."
24+
/>
25+
<svg
26+
xmlns="http://www.w3.org/2000/svg"
27+
fill="none"
28+
viewBox="0 0 24 24"
29+
stroke-width="1.5"
30+
stroke="currentColor"
31+
class="pointer-events-none col-start-1 row-start-1 ml-3 size-5 self-center text-gray-400 sm:size-4"
32+
>
33+
<path
34+
stroke-linecap="round"
35+
stroke-linejoin="round"
36+
d="M10.5 1.5H8.25A2.25 2.25 0 0 0 6 3.75v16.5a2.25 2.25 0 0 0 2.25 2.25h7.5A2.25 2.25 0 0 0 18 20.25V3.75a2.25 2.25 0 0 0-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3"
37+
/>
38+
</svg>
39+
</div>
40+
<button
41+
type="submit"
42+
class="flex shrink-0 items-center gap-x-1.5 rounded-r-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 outline-1 -outline-offset-1 outline-gray-300 hover:bg-gray-50 focus:relative focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600"
43+
>
44+
<svg
45+
xmlns="http://www.w3.org/2000/svg"
46+
fill="none"
47+
aria-hidden="true"
48+
data-slot="icon"
49+
viewBox="0 0 24 24"
50+
stroke-width="1.5"
51+
stroke="currentColor"
52+
class="-ml-0.5 size-4 text-gray-400"
53+
>
54+
<path
55+
stroke-linecap="round"
56+
stroke-linejoin="round"
57+
d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"
58+
/>
59+
</svg>
60+
</button>
61+
</div>
1462
</.focus_wrap>
1563
</.simple_form>
1664

17-
<ul
65+
<div
1866
id="apps"
1967
phx-update="stream"
2068
phx-viewport-top={@page > 1 && "prev-page"}
@@ -26,15 +74,11 @@
2674
if(@page == 1, do: "pt-10", else: "pt-[calc(200vh)]")
2775
]}
2876
>
29-
<li :for={{id, app} <- @streams.apps} id={id} class="col-span-1 shadow-xs rounded-md">
77+
<div :for={{id, app} <- @streams.apps} id={id} class="col-span-1 shadow-xs">
3078
<.card app={app} navigate={~p"/"} />
31-
</li>
32-
</ul>
79+
</div>
80+
</div>
3381

3482
<div :if={@no_results?} class="mt-5 text-[50px] text-center">
3583
No Results
3684
</div>
37-
38-
<div :if={@end_of_timeline? and not @no_results?} class="mt-5 text-[50px] text-center">
39-
End of List
40-
</div>

0 commit comments

Comments
 (0)