@autobusal/routes-search 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/RoutesSearch.tsx CHANGED
@@ -152,6 +152,7 @@ const RoutesSearch = ({ type, from, to, departure, _return, adultsNo, childrenNo
152
152
  <Autocomplete
153
153
  key={ `from-${ picked.from ?? '' }` }
154
154
  name="from"
155
+ label={ t('routes_search.from', { ns: 'common' }) }
155
156
  defaultValue={ picked.from ?? from }
156
157
  data={ cities }
157
158
  validation="required"
@@ -173,6 +174,7 @@ const RoutesSearch = ({ type, from, to, departure, _return, adultsNo, childrenNo
173
174
  <Autocomplete
174
175
  key={ `to-${ picked.to ?? '' }` }
175
176
  name="to"
177
+ label={ t('routes_search.to', { ns: 'common' }) }
176
178
  defaultValue={ picked.to ?? to }
177
179
  data={ cities }
178
180
  validation="required"
@@ -198,6 +200,7 @@ const RoutesSearch = ({ type, from, to, departure, _return, adultsNo, childrenNo
198
200
  <Calendar
199
201
  type="picker"
200
202
  name="departure"
203
+ label={ t('routes_search.departure', { ns: 'common' }) }
201
204
  defaultValue={ departure }
202
205
  t={ t }
203
206
  validation="required"
@@ -225,6 +228,7 @@ const RoutesSearch = ({ type, from, to, departure, _return, adultsNo, childrenNo
225
228
  <Calendar
226
229
  type="picker"
227
230
  name="_return"
231
+ label={ t('routes_search.return', { ns: 'common' }) }
228
232
  defaultValue={ _return }
229
233
  minDate={ departureDate }
230
234
  t={ t }
@@ -242,7 +246,8 @@ const RoutesSearch = ({ type, from, to, departure, _return, adultsNo, childrenNo
242
246
  <Item>
243
247
  <Title>{ t('routes_search.passengers', { ns: 'common' }) }</Title>
244
248
 
245
- <Passengers
249
+ <Passengers
250
+ label={ t('routes_search.passengers', { ns: 'common' }) }
246
251
  defaultAdults={ adultsNo }
247
252
  defaultChildren={ childrenNo }
248
253
  defaultBabies={ babiesNo }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/routes-search",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
package/utilities.ts CHANGED
@@ -6,15 +6,41 @@ export const getCities = (cities: CityData[], t: TFunction<'common'>): Autocompl
6
6
  const data: AutocompleteData[] = [];
7
7
 
8
8
  cities.forEach(city => {
9
+ /*
10
+ * Claude - Date: 2026-08-21
11
+ *
12
+ * Every spelling this place answers to, so the box matches what the
13
+ * visitor TYPES rather than what their interface language happens to
14
+ * call the place. `aliases` comes from /api/cities/browse and holds the
15
+ * name in all 15 languages plus historical and colloquial variants -
16
+ * "Solun", "Selanik", "Θεσσαλονίκη" and "Salonic" all reach
17
+ * Thessaloniki. The country name and the slug go in too: the slug is
18
+ * what appears in the URL, so somebody pasting or half-remembering one
19
+ * finds the city.
20
+ *
21
+ * These are NEVER displayed - `name` is what shows, resolved to the
22
+ * visitor's own language server-side.
23
+ */
24
+ const search = [
25
+ ...(city.aliases ?? []),
26
+ city.country?.name ?? '',
27
+ city.slug
28
+ ].filter(Boolean);
29
+
9
30
  data.push({
10
31
  name: `${ city.name }, ${ city.country?.name ?? '' } (${ t('all_stations', { ns: 'common' }) })`,
11
- value: `${ city.slug }`
32
+ value: `${ city.slug }`,
33
+ search
12
34
  });
13
35
 
14
36
  city.stops?.forEach(stop => {
15
37
  data.push({
16
38
  name: `${ city.name }, ${ city.country?.name ?? '' } (${ stop.name })`,
17
- value: `${ city.slug }:${ stop.id }`
39
+ value: `${ city.slug }:${ stop.id }`,
40
+ // the stop's own name as well - station names are not translated
41
+ // (they are what is written on the building) but they are certainly
42
+ // searched for
43
+ search: [ ...search, stop.name ]
18
44
  });
19
45
  });
20
46
  });