@autobusal/routes-order 1.40.2 → 1.41.0
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/Checkout/Checkout.tsx +8 -2
- package/Checkout/Sidebar/Sidebar.tsx +5 -3
- package/Found/Route/Route.tsx +21 -2
- package/Found/Route/styles.ts +46 -0
- package/package.json +1 -1
package/Checkout/Checkout.tsx
CHANGED
|
@@ -445,19 +445,24 @@ const Checkout = ({ values, step1, step2, step3, isPartner, t, onStore, onBack }
|
|
|
445
445
|
* collected or undefined, so a failure stops the chain with the offending
|
|
446
446
|
* form's own error messages already on screen.
|
|
447
447
|
*/
|
|
448
|
+
const [ payNotice, setPayNotice ] = useState<string | null>(null);
|
|
449
|
+
|
|
448
450
|
const onPay = async (): Promise<void> => {
|
|
451
|
+
// Claude - 2026-11-05: under the Pay button, in the site's own look (they were alert()s)
|
|
449
452
|
if (action === undefined) {
|
|
450
|
-
|
|
453
|
+
setPayNotice(t('routes_order.step5.choose_payment'));
|
|
451
454
|
|
|
452
455
|
return;
|
|
453
456
|
}
|
|
454
457
|
|
|
455
458
|
if (addonWhatsapp && addonWhatsappNumber.trim().length < 5) {
|
|
456
|
-
|
|
459
|
+
setPayNotice(t('routes_order.step5.addons.whatsapp.phone_error'));
|
|
457
460
|
|
|
458
461
|
return;
|
|
459
462
|
}
|
|
460
463
|
|
|
464
|
+
setPayNotice(null);
|
|
465
|
+
|
|
461
466
|
let person: PersonData | undefined;
|
|
462
467
|
|
|
463
468
|
await passenger.handleSubmit((data) => { person = data; })();
|
|
@@ -650,6 +655,7 @@ const Checkout = ({ values, step1, step2, step3, isPartner, t, onStore, onBack }
|
|
|
650
655
|
pending={ isPending }
|
|
651
656
|
t={ t }
|
|
652
657
|
onPay={ onPay }
|
|
658
|
+
notice={ payNotice }
|
|
653
659
|
payments={ (
|
|
654
660
|
<Payments
|
|
655
661
|
selected={ action ?? '' }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TFunction } from 'i18next';
|
|
2
2
|
import { MdDone } from 'react-icons/md';
|
|
3
3
|
import { AiOutlineInfoCircle } from 'react-icons/ai';
|
|
4
|
-
import { Button } from '@autobusal/common';
|
|
4
|
+
import { Button, FormNotice } from '@autobusal/common';
|
|
5
5
|
import About from '../../Step5/Summary/About/About';
|
|
6
6
|
import Amount from '../../Step5/Summary/Amount/Amount';
|
|
7
7
|
import { Container, Panel, Actions, Notice, Local } from './styles';
|
|
@@ -54,6 +54,8 @@ interface Props {
|
|
|
54
54
|
pending: boolean
|
|
55
55
|
t: TFunction<'common'>
|
|
56
56
|
onPay: () => void
|
|
57
|
+
/* Claude - 2026-11-05: why Pay did not go ahead, said under the button */
|
|
58
|
+
notice?: string | null
|
|
57
59
|
/** coupon form, rendered directly above the totals it affects */
|
|
58
60
|
children?: React.ReactNode
|
|
59
61
|
/** payment-method picker, rendered directly above the button that uses it */
|
|
@@ -70,7 +72,7 @@ interface Props {
|
|
|
70
72
|
* page and scrolled away while add-ons were being ticked - so the number
|
|
71
73
|
* changed out of sight of the person it was changing for.
|
|
72
74
|
*/
|
|
73
|
-
const Sidebar = ({ step1, step2, step3, fare, addons, coupon, total, local, surcharge, comission, action, single, pending, t, onPay, children, payments }: Props): JSX.Element => (
|
|
75
|
+
const Sidebar = ({ step1, step2, step3, fare, addons, coupon, total, local, surcharge, comission, action, single, pending, t, onPay, notice, children, payments }: Props): JSX.Element => (
|
|
74
76
|
<Container>
|
|
75
77
|
<Panel className="box">
|
|
76
78
|
<SubTitle>
|
|
@@ -158,7 +160,7 @@ const Sidebar = ({ step1, step2, step3, fare, addons, coupon, total, local, surc
|
|
|
158
160
|
onClick={ onPay }
|
|
159
161
|
/>
|
|
160
162
|
|
|
161
|
-
{ action === undefined && (
|
|
163
|
+
{ notice ? <FormNotice message={ notice } /> : action === undefined && (
|
|
162
164
|
<Notice>{ t('routes_order.step5.choose_payment') }</Notice>
|
|
163
165
|
) }
|
|
164
166
|
</Actions>
|
package/Found/Route/Route.tsx
CHANGED
|
@@ -3,12 +3,12 @@ import { TFunction } from 'i18next';
|
|
|
3
3
|
import { HiOutlineArrowNarrowRight, HiOutlineDocumentText, HiChevronDown, HiChevronUp } from 'react-icons/hi';
|
|
4
4
|
import { BiHourglass } from 'react-icons/bi';
|
|
5
5
|
import { RiBus2Line } from 'react-icons/ri';
|
|
6
|
-
import { MdOutlineAltRoute } from 'react-icons/md';
|
|
6
|
+
import { MdOutlineAltRoute, MdEventSeat } from 'react-icons/md';
|
|
7
7
|
import { formatDuration, splitPrice } from '../refine';
|
|
8
8
|
import { Button, RouteFeature, Information, Rating } from '@autobusal/common';
|
|
9
9
|
import { useGetSettings } from '@autobusal/providers/services';
|
|
10
10
|
import { createDate, getDayParts } from '@autobusal/utilities';
|
|
11
|
-
import { Container, ButtonDetails, SpecialOffer, FavoriteStop, Trip, Company, Location, Stop, Iso, Time, Price, Amount, Decimals, Currency, PriceNotice, SeatsLeft, LinkCompany, CodeCompany, Details, Detail, ButtonPolicy, TitleDetail, FeaturesItems, Leaves, Day, NextDay, Standard, Stops, StopsItems, StopRow, StopTime, StopDay, StopBorder } from './styles';
|
|
11
|
+
import { Container, ButtonDetails, SpecialOffer, FavoriteStop, Trip, Company, Location, Stop, Iso, Time, Price, Amount, Decimals, Currency, PriceNotice, SeatsLeft, SeatsCompact, LinkCompany, CodeCompany, Details, Detail, ButtonPolicy, TitleDetail, FeaturesItems, Leaves, Day, NextDay, Standard, Stops, StopsItems, StopRow, StopTime, StopDay, StopBorder } from './styles';
|
|
12
12
|
import { FoundData } from '@autobusal/providers/types/routes';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -195,6 +195,25 @@ const Route = ({ data, type, date, passengers, t, onSave }: Props): JSX.Element
|
|
|
195
195
|
<MdOutlineAltRoute />
|
|
196
196
|
{ data.code }
|
|
197
197
|
</CodeCompany>
|
|
198
|
+
|
|
199
|
+
{ /* Claude - 2026-09-27 (Ferjolt: "on small screens, can we show the
|
|
200
|
+
Seats left inline with operator logo and route code, on the
|
|
201
|
+
right side of the row?"). A seat and the number rather than the
|
|
202
|
+
sentence: the row is short on a phone, and a seat icon ALONE
|
|
203
|
+
could be read as "choose your seat" (a paid add-on) - the
|
|
204
|
+
number is what makes it a count. The full sentence stays for
|
|
205
|
+
screen readers and as the tooltip. Phones only; wider screens
|
|
206
|
+
keep the sentence under the price. */ }
|
|
207
|
+
{ seats !== null && (
|
|
208
|
+
<SeatsCompact
|
|
209
|
+
$low={ seats <= LOW_SEATS }
|
|
210
|
+
title={ t('routes_order.step2.route.seats_left', { count: seats }) }
|
|
211
|
+
aria-label={ t('routes_order.step2.route.seats_left', { count: seats }) }
|
|
212
|
+
>
|
|
213
|
+
<MdEventSeat aria-hidden="true" />
|
|
214
|
+
{ seats }
|
|
215
|
+
</SeatsCompact>
|
|
216
|
+
) }
|
|
198
217
|
</Company>
|
|
199
218
|
|
|
200
219
|
<Location $side="from">
|
package/Found/Route/styles.ts
CHANGED
|
@@ -157,6 +157,18 @@ export const Company = styled.div`
|
|
|
157
157
|
flex-wrap: wrap;
|
|
158
158
|
gap: 8px;
|
|
159
159
|
margin-bottom: 4px;
|
|
160
|
+
|
|
161
|
+
/*
|
|
162
|
+
* Claude - 2026-09-27: the operator's rating as ONE star and the number
|
|
163
|
+
* ("★ 4.3 (3)") on a phone. Measured at 375px: logo 96 + five stars and
|
|
164
|
+
* the score 120 + route code 77 + the seats count 48 is 365px on a 315px
|
|
165
|
+
* row, so the seats count wrapped to a line of its own. The full five
|
|
166
|
+
* stars stay on wider screens, and the whole summary is the tooltip
|
|
167
|
+
* (Rating's title). The rating is the only span before the seats count.
|
|
168
|
+
*/
|
|
169
|
+
& > span:first-of-type svg:not(:first-child) {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
/**
|
|
@@ -1051,7 +1063,41 @@ export const SeatsLeft = styled.span<{ $low: boolean }>`
|
|
|
1051
1063
|
font-weight: ${ props => (props.$low ? 700 : 400) };
|
|
1052
1064
|
color: ${ props => (props.$low ? props.theme.font.error : props.theme.font.faded) };
|
|
1053
1065
|
|
|
1066
|
+
// Claude - 2026-09-27: on a phone the count moves up to the operator row
|
|
1067
|
+
// (SeatsCompact) - one place to read it, not two
|
|
1068
|
+
@media (max-width: 639px) {
|
|
1069
|
+
display: none;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1054
1072
|
@media (min-width: 768px) {
|
|
1055
1073
|
text-align: center;
|
|
1056
1074
|
}
|
|
1057
1075
|
`;
|
|
1076
|
+
|
|
1077
|
+
/*
|
|
1078
|
+
* Claude - 2026-09-27 (Ferjolt): the seats count on a phone - a seat and the
|
|
1079
|
+
* number, pushed to the right end of the operator row (logo, rating, route
|
|
1080
|
+
* code). Same emphasis as SeatsLeft when few are left.
|
|
1081
|
+
*/
|
|
1082
|
+
export const SeatsCompact = styled.span<{ $low: boolean }>`
|
|
1083
|
+
display: none;
|
|
1084
|
+
|
|
1085
|
+
@media (max-width: 639px) {
|
|
1086
|
+
display: inline-flex;
|
|
1087
|
+
align-items: center;
|
|
1088
|
+
gap: 4px;
|
|
1089
|
+
margin-left: auto;
|
|
1090
|
+
padding: 2px 8px;
|
|
1091
|
+
border-radius: 100px;
|
|
1092
|
+
background: ${ props => (props.$low ? 'rgba(204, 51, 51, .1)' : props.theme.background.neutral) };
|
|
1093
|
+
color: ${ props => (props.$low ? props.theme.font.error : props.theme.font.faded) };
|
|
1094
|
+
font-size: ${ props => props.theme.size.xs };
|
|
1095
|
+
font-weight: 700;
|
|
1096
|
+
line-height: 1.4;
|
|
1097
|
+
white-space: nowrap;
|
|
1098
|
+
|
|
1099
|
+
svg {
|
|
1100
|
+
font-size: 1.15em;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
`;
|