diff --git a/src/lib/components/EmailUpdates/EmailUpdatesForm.svelte b/src/lib/components/EmailUpdates/EmailUpdatesForm.svelte index 25bf33ad..b105e9bb 100644 --- a/src/lib/components/EmailUpdates/EmailUpdatesForm.svelte +++ b/src/lib/components/EmailUpdates/EmailUpdatesForm.svelte @@ -1,5 +1,6 @@
@@ -106,20 +120,44 @@
-

Last updated: {compatibilityMeta.last_updated}

+
+
+ + + {matches.size}/{total} · + updated {compatibilityMeta.last_updated} + +
+
+ + {#if filter} + + {/if} +
+
{#each Object.entries(vehicles) as [make, cars]} {#if cars.length !== 0} {@const brand_img_path = `/src/lib/images/vehicles/brand-icons/Logo-${make}.png`} -
+ {@const matchCount = cars.filter(car => matches.has(car.name)).length} +
{#if brand_images[brand_img_path]} {make} car brand {/if} -

{make} ({cars.length})

+

{make} ({matchCount})

{#each cars as car_info} -
+
@@ -196,6 +234,13 @@ {/each} {/if} {/each} + + {#if matches.size === 0} +
+ openpilot doesn't support {filter} yet + Get an email when it does → +
+ {/if}
@@ -308,10 +353,95 @@ } } - .last-updated { - text-align: center; + .filter-card { + margin: 3rem 0; + padding: 3rem; + background-color: var(--color-card-background); + border: 1px solid rgba(0, 0, 0, .4); + } + + @media screen and (max-width: 768px) { + .filter-card { + padding: 2rem 1rem; + } + } + + .filter-head { + display: flex; + flex-wrap: wrap; + align-items: baseline; + justify-content: space-between; + gap: 0.25rem 1rem; + margin-bottom: 0.5rem; + } + + .filter-label { + font-size: 1.125rem; + font-weight: 700; + } + + .filter-meta { + color: rgba(0, 0, 0, 0.55); + font-size: 1rem; font-style: italic; - margin-bottom: 1rem; + } + + .filter-meta .count { + color: #000; + font-size: 1.125rem; + font-style: normal; + font-weight: 700; + opacity: 0; + transition: opacity 0.1s; + } + + .filter-meta .count.searching { + opacity: 1; + } + + .filter-field { + position: relative; + } + + .vehicle-filter { + box-sizing: border-box; + width: 100%; + padding: 1rem 3rem 1rem 1rem; + color: #000; + font: inherit; + background: #fff; + border: 1px solid #000; + + &:focus-visible { + outline: 2px solid #000; + outline-offset: -3px; + } + + &::-webkit-search-cancel-button { + display: none; + } + } + + .clear { + position: absolute; + top: 0; + right: 13px; + height: 100%; + padding: 0; + cursor: pointer; + background-color: transparent; + border: none; + } + + .no-matches { + display: grid; + gap: 0.5rem; + justify-items: center; + margin-top: 2rem; + padding: 2rem; + text-align: center; + background-color: var(--color-card-background); + border: 1px solid rgba(0, 0, 0, 0.4); } /* TODO: extract shared card class */ @@ -516,4 +646,9 @@ #faq { margin-bottom: 3rem; } + + /* Last, so it beats the `display` the rows and make headers set for themselves */ + .filtered-out { + display: none; + }