-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix dialog, work on bus route search
- Loading branch information
Showing
11 changed files
with
97 additions
and
73 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...3cc09502e0cb38357555f35ef693f39e29f1.json → ...92922859b44999b8ec88721c834e6436a5c5.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...63b5f30fefbf9d0b6554918ba9c004a892c9.json → ...6fd92f4f8d931ba88b7b2533b7201500e7c3.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,26 +1,88 @@ | ||
<script lang="ts"> | ||
import { persisted } from 'svelte-persisted-store'; | ||
import { CircleX } from 'lucide-svelte'; | ||
import List from '$lib/components/List.svelte'; | ||
import Trigger from '$lib/components/RouteAlert/Trigger.svelte'; | ||
export let route_ids: string[]; | ||
export let bus_route_ids: string[]; | ||
export let title: string = 'Alerts'; | ||
export let manage_height: boolean = true; | ||
export let show_search = false; | ||
// if (!route_ids.length) route_ids = all_route_ids; | ||
// if (!bus_route_ids.length) bus_route_ids = $bus_routes.map((r) => r.id); | ||
let list_el: List; | ||
let search_term = ''; | ||
$: shown_bus_route_ids = bus_route_ids; | ||
let tab_value = persisted(`${title.toLowerCase()}_tab`, 'Train'); | ||
</script> | ||
|
||
<List class={$$props.class ?? 'max-h-[calc(100dvh-7.5rem)]'} bind:manage_height bind:title> | ||
<List | ||
bind:this={list_el} | ||
bind:tab_value | ||
class={$$props.class ?? 'max-h-[calc(100dvh-7.5rem)]'} | ||
bind:manage_height | ||
bind:title | ||
> | ||
<div slot="train" class="divide-y divide-neutral-800"> | ||
{#each route_ids as route_id (route_id)} | ||
<Trigger {route_id} route_type="route_alert" /> | ||
{/each} | ||
</div> | ||
|
||
<div slot="bus"> | ||
{#each bus_route_ids as route_id (route_id)} | ||
{#each shown_bus_route_ids as route_id (route_id)} | ||
<Trigger {route_id} route_type="bus_route_alert" /> | ||
{/each} | ||
</div> | ||
|
||
{#if show_search && $tab_value === 'Bus'} | ||
<div class="relative"> | ||
<input | ||
bind:value={search_term} | ||
on:input={(e) => { | ||
if (search_term === '') { | ||
shown_bus_route_ids = bus_route_ids; | ||
search_term = ''; | ||
return; | ||
} | ||
|
||
shown_bus_route_ids = bus_route_ids.filter((route_id) => | ||
route_id.includes(search_term.toUpperCase()) | ||
); | ||
list_el.scrollIntoView(); | ||
}} | ||
type="search" | ||
placeholder="Search bus route" | ||
class="search-stops text-indigo-200 max-w-[calc(100dvw)] pl-10 z-20 w-full h-12 rounded bg-neutral-900 shadow-2xl border-neutral-800/20 ring-1 ring-inset ring-neutral-700 placeholder:text-neutral-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600" | ||
/> | ||
<button | ||
aria-label="Clear search" | ||
class="z-30 w-6 h-6 text-indigo-600 hover:text-indigo-700 active:text-indigo-700 absolute right-2 my-auto top-1/2 transform -translate-y-1/2" | ||
on:click={() => { | ||
shown_bus_route_ids = bus_route_ids; | ||
search_term = ''; | ||
}} | ||
> | ||
<CircleX /> | ||
</button> | ||
</div> | ||
{/if} | ||
</List> | ||
|
||
<style lang="postcss"> | ||
.search-stops { | ||
background-image: url('/search.svg'); | ||
background-position: 10px 10px; | ||
background-repeat: no-repeat; | ||
} | ||
/* Remove default styles from search */ | ||
input[type='search']::-webkit-search-decoration, | ||
input[type='search']::-webkit-search-cancel-button, | ||
input[type='search']::-webkit-search-results-button, | ||
input[type='search']::-webkit-search-results-decoration { | ||
-webkit-appearance: none; | ||
} | ||
</style> |
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 |
---|---|---|
|
@@ -12,4 +12,5 @@ | |
route_ids={all_route_ids} | ||
bus_route_ids={$bus_routes.map((r) => r.id)} | ||
manage_height={false} | ||
show_search | ||
/> |