kaafil-react-uikit 0.11.4 → 0.11.5

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 CHANGED
@@ -6,6 +6,28 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this package uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
  While on `0.x` a minor bump may carry a breaking change; the entry will say so.
8
8
 
9
+ ## [0.11.5] — 2026-09-18
10
+
11
+ ### Fixed
12
+
13
+ - **The trip picker counted a leader's whole history, not their live trips.**
14
+ `KaafilManagerApp` skipped the picker only when `trips.length === 1`, while
15
+ the comment beside it already claimed "2+ live trips". So a leader who had
16
+ run eight departures this year and was standing on their ninth got a list of
17
+ finished trips as the first screen of an offline-first field app, with the
18
+ one that mattered somewhere down it. The rule now counts trips that are
19
+ `IN_PROGRESS`: exactly one live trip opens directly, however much history
20
+ sits behind it. Zero live trips keeps the old behaviour, so a leader whose
21
+ only assignment has not started yet still opens straight into it; two or more
22
+ live trips is a real question and still gets the picker.
23
+
24
+ - **The picker listed trips in the server's order.** A February departure that
25
+ finished could sit above the two a leader is actually running. Rows are now
26
+ ordered by what the reader is looking for — under way, then confirmed, then
27
+ postponed, then completed, then cancelled — and within a status by start
28
+ date. The array is copied before sorting, so `useManagerMe()`'s own `trips[]`
29
+ is not reordered for other consumers.
30
+
9
31
  ## [0.11.4] — 2026-09-15
10
32
 
11
33
  ### Changed
@@ -13299,15 +13299,28 @@ function TripListRow({ trip, onSelect, style }) {
13299
13299
  }
13300
13300
  );
13301
13301
  }
13302
+ var STATUS_RANK = {
13303
+ IN_PROGRESS: 0,
13304
+ CONFIRMED: 1,
13305
+ POSTPONED: 2,
13306
+ COMPLETED: 3,
13307
+ CANCELLED: 4
13308
+ };
13309
+ function byUrgency(a, b) {
13310
+ const rank = STATUS_RANK[a.status] - STATUS_RANK[b.status];
13311
+ if (rank !== 0) return rank;
13312
+ return a.startDate < b.startDate ? -1 : a.startDate > b.startDate ? 1 : 0;
13313
+ }
13302
13314
  function TripListScreen({
13303
13315
  trips,
13304
13316
  onSelect,
13305
13317
  TripListItemComponent
13306
13318
  }) {
13307
13319
  const { t } = chunk5ORJRFXZ_cjs.useKaafilChrome();
13320
+ const ordered = [...trips].sort(byUrgency);
13308
13321
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-manager-app__trip-list", children: [
13309
13322
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-eyebrow kf-manager-app__trip-list-eyebrow", children: t("chrome.managerApp.tripList.eyebrow") }),
13310
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-manager-app__trip-list-rows", children: trips.map((trip) => /* @__PURE__ */ jsxRuntime.jsx(TripListItemComponent, { trip, onSelect }, trip.tripRef)) })
13323
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-manager-app__trip-list-rows", children: ordered.map((trip) => /* @__PURE__ */ jsxRuntime.jsx(TripListItemComponent, { trip, onSelect }, trip.tripRef)) })
13311
13324
  ] });
13312
13325
  }
13313
13326
  function KaafilManagerApp(props) {
@@ -13399,7 +13412,9 @@ function ReadyKaafilManagerApp(props) {
13399
13412
  ] });
13400
13413
  }
13401
13414
  const { trips, manager, syncedAt } = managerMe;
13402
- const resolvedTripRef = controlledTripRef ?? internalTripRef ?? (trips.length === 1 ? trips[0]?.tripRef : void 0);
13415
+ const liveTrips = trips.filter((trip) => trip.status === "IN_PROGRESS");
13416
+ const onlyReasonableTrip = liveTrips.length === 1 ? liveTrips[0]?.tripRef : trips.length === 1 ? trips[0]?.tripRef : void 0;
13417
+ const resolvedTripRef = controlledTripRef ?? internalTripRef ?? onlyReasonableTrip;
13403
13418
  const currentTrip = trips.find((trip) => trip.tripRef === resolvedTripRef);
13404
13419
  if (currentTrip === void 0) {
13405
13420
  return /* @__PURE__ */ jsxRuntime.jsxs(ManagerShell, { header: { title: surfaceTitle }, components: shellComponents, style, children: [