kaafil-react-uikit 0.11.3 → 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.
@@ -13298,15 +13298,28 @@ function TripListRow({ trip, onSelect, style }) {
13298
13298
  }
13299
13299
  );
13300
13300
  }
13301
+ var STATUS_RANK = {
13302
+ IN_PROGRESS: 0,
13303
+ CONFIRMED: 1,
13304
+ POSTPONED: 2,
13305
+ COMPLETED: 3,
13306
+ CANCELLED: 4
13307
+ };
13308
+ function byUrgency(a, b) {
13309
+ const rank = STATUS_RANK[a.status] - STATUS_RANK[b.status];
13310
+ if (rank !== 0) return rank;
13311
+ return a.startDate < b.startDate ? -1 : a.startDate > b.startDate ? 1 : 0;
13312
+ }
13301
13313
  function TripListScreen({
13302
13314
  trips,
13303
13315
  onSelect,
13304
13316
  TripListItemComponent
13305
13317
  }) {
13306
13318
  const { t } = useKaafilChrome();
13319
+ const ordered = [...trips].sort(byUrgency);
13307
13320
  return /* @__PURE__ */ jsxs("div", { className: "kf-manager-app__trip-list", children: [
13308
13321
  /* @__PURE__ */ jsx("p", { className: "kf-eyebrow kf-manager-app__trip-list-eyebrow", children: t("chrome.managerApp.tripList.eyebrow") }),
13309
- /* @__PURE__ */ jsx("div", { className: "kf-manager-app__trip-list-rows", children: trips.map((trip) => /* @__PURE__ */ jsx(TripListItemComponent, { trip, onSelect }, trip.tripRef)) })
13322
+ /* @__PURE__ */ jsx("div", { className: "kf-manager-app__trip-list-rows", children: ordered.map((trip) => /* @__PURE__ */ jsx(TripListItemComponent, { trip, onSelect }, trip.tripRef)) })
13310
13323
  ] });
13311
13324
  }
13312
13325
  function KaafilManagerApp(props) {
@@ -13398,7 +13411,9 @@ function ReadyKaafilManagerApp(props) {
13398
13411
  ] });
13399
13412
  }
13400
13413
  const { trips, manager, syncedAt } = managerMe;
13401
- const resolvedTripRef = controlledTripRef ?? internalTripRef ?? (trips.length === 1 ? trips[0]?.tripRef : void 0);
13414
+ const liveTrips = trips.filter((trip) => trip.status === "IN_PROGRESS");
13415
+ const onlyReasonableTrip = liveTrips.length === 1 ? liveTrips[0]?.tripRef : trips.length === 1 ? trips[0]?.tripRef : void 0;
13416
+ const resolvedTripRef = controlledTripRef ?? internalTripRef ?? onlyReasonableTrip;
13402
13417
  const currentTrip = trips.find((trip) => trip.tripRef === resolvedTripRef);
13403
13418
  if (currentTrip === void 0) {
13404
13419
  return /* @__PURE__ */ jsxs(ManagerShell, { header: { title: surfaceTitle }, components: shellComponents, style, children: [