Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/components/MapView.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,15 @@ function renderRoute(route: RouteResult, selected: number) {
const pts: [number, number][] = []
if (it) {
const nodes = [it.legs[0]?.fromCoords, ...it.legs.map((l) => l.toCoords)].filter(Boolean) as [number, number][]
nodes.forEach((c, i) => {
// A loop and not `forEach`: inside a callback TypeScript widens `map` back to nullable,
// the guard at the top of the function no longer covering it.
for (const [i, c] of nodes.entries()) {
pts.push(c)
if (i > 0 && i < nodes.length - 1) {
const el = dot('#14b8b0', 14)
markers.set(`__via_${i}__`, new maplibregl.Marker({ element: el }).setLngLat([c[1], c[0]]).addTo(map))
}
})
}
if (nodes.length > 1) {
map.addSource('route-line', {
type: 'geojson',
Expand Down
2 changes: 1 addition & 1 deletion app/components/RoutePanel.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { RouteResult } from '~~/shared/types'

const props = defineProps<{
defineProps<{
route: (RouteResult & { truncated?: boolean }) | null | undefined
pending: boolean
error: unknown
Expand Down
2 changes: 1 addition & 1 deletion app/components/SearchBar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { SearchMode } from '~~/shared/types'
import { todayISO, lastBookableISO, BOOKING_WINDOW_DAYS } from '~~/shared/window'
import { cleanString } from '~~/server/utils/normalize'
import { cleanString } from '~~/shared/normalize'

type BarMode = SearchMode | 'route'
/** How dates are picked. The search mode follows from it, it is never chosen directly. */
Expand Down
2 changes: 1 addition & 1 deletion app/components/StationInput.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { cleanString } from '~~/server/utils/normalize'
import { cleanString } from '~~/shared/normalize'

/** Station field with autocomplete, built to live *inside* a bordered group: it has no
* border or background of its own, and its label is inline. */
Expand Down
2 changes: 1 addition & 1 deletion app/composables/useStations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cleanString } from '~~/server/utils/normalize'
import { cleanString } from '~~/shared/normalize'

export function useStations() {
const { data: stations } = useFetch<string[]>('/api/stations', {
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@
},
"devDependencies": {
"@nuxt/eslint": "^1.16.0",
"@nuxt/image": "^2.1.0",
"@nuxt/test-utils": "^4.1.0",
"@vue/test-utils": "^2.4.11",
"eslint": "^10.8.0",
"happy-dom": "^20.11.1",
"typescript": "~6.0.3",
"vitest": "^4.1.10",
"vue-tsc": "^3.3.9"
Expand Down
Loading
Loading