@autobusal/routes-order 1.40.2 → 1.40.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.
@@ -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">
@@ -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
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/routes-order",
3
- "version": "1.40.2",
3
+ "version": "1.40.3",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts",