@autobusal/common 1.33.2 → 1.33.3
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/CHANGELOG.md +6 -0
- package/RouteItem/RouteItem.tsx +16 -1
- package/RouteItem/styles.ts +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.33.3
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **`RouteItem` shows a "from" price** next to the route name/code - the lowest fare across the route's own `prices`, using the row's own pre-formatted `adult_display` (same currency/decimal convention as everywhere else). Both `browse` and `view` modes get it; a route with no prices at all shows nothing, same as it always could.
|
|
8
|
+
|
|
3
9
|
## 1.33.2
|
|
4
10
|
|
|
5
11
|
### Added
|
package/RouteItem/RouteItem.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
import { TFunction } from 'i18next';
|
|
3
3
|
import { HiOutlineInformationCircle, HiOutlineClock, HiArrowCircleRight } from 'react-icons/hi';
|
|
4
4
|
import More from './More/More';
|
|
5
|
-
import { Container, About, Image, Logo, Information, Name, Code, ButtonMore, Locations, Location, City, Iso, Date, Arrow, Order, LinkOrder } from './styles';
|
|
5
|
+
import { Container, About, Image, Logo, Information, Name, Code, Price, ButtonMore, Locations, Location, City, Iso, Date, Arrow, Order, LinkOrder } from './styles';
|
|
6
6
|
import { RouteData } from '@autobusal/providers/types/routes';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
@@ -16,6 +16,19 @@ const RouteItem = ({ type, route, t }: Props): JSX.Element => {
|
|
|
16
16
|
|
|
17
17
|
const lastLocation = route.locations.length - 1;
|
|
18
18
|
|
|
19
|
+
// Edited: Ferjolt Ozuni - Date: 2026-08-11
|
|
20
|
+
// The cheapest fare on this route, same "from" semantics as everywhere
|
|
21
|
+
// else a lowest price is shown (Facts.price_from, results-page cards) -
|
|
22
|
+
// `prices` is one row per from/to leg the route sells, not one row for
|
|
23
|
+
// the whole journey, so the honest "from" figure is the minimum across
|
|
24
|
+
// all of them. Uses the row's OWN `adult_display` rather than
|
|
25
|
+
// reformatting `adult` itself - the server already applied this label's
|
|
26
|
+
// currency symbol/decimal convention, and re-deriving that here would
|
|
27
|
+
// risk disagreeing with every other price on the site.
|
|
28
|
+
const cheapest = route.prices.length > 0
|
|
29
|
+
? route.prices.reduce((min, price) => (price.adult < min.adult ? price : min))
|
|
30
|
+
: null;
|
|
31
|
+
|
|
19
32
|
return (
|
|
20
33
|
<Container className="box">
|
|
21
34
|
<About>
|
|
@@ -30,6 +43,8 @@ const RouteItem = ({ type, route, t }: Props): JSX.Element => {
|
|
|
30
43
|
|
|
31
44
|
<Code>{ route.code }</Code>
|
|
32
45
|
|
|
46
|
+
{ cheapest && <Price>{ t('route_item.price_from', { price: cheapest.adult_display }) }</Price> }
|
|
47
|
+
|
|
33
48
|
<ButtonMore type="button" onClick={ () => setShow(!show) }>
|
|
34
49
|
<HiOutlineInformationCircle />
|
|
35
50
|
{ t('route_item.info') }
|
package/RouteItem/styles.ts
CHANGED
|
@@ -60,6 +60,12 @@ export const Code = styled.div`
|
|
|
60
60
|
font-size: ${ props => props.theme.size.xs };
|
|
61
61
|
`;
|
|
62
62
|
|
|
63
|
+
export const Price = styled.div`
|
|
64
|
+
font-weight: 700;
|
|
65
|
+
color: ${ props => props.theme.primary.normal };
|
|
66
|
+
font-size: ${ props => props.theme.size.s };
|
|
67
|
+
`;
|
|
68
|
+
|
|
63
69
|
export const ButtonMore = styled.button`
|
|
64
70
|
display: flex;
|
|
65
71
|
align-items: center;
|