mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 14:15:44 +00:00
giveme git commit message 50 char
This commit is contained in:
@@ -39,6 +39,8 @@ interface WindowRow {
|
||||
windowClosesAt: string | null;
|
||||
docReviewEndsAt: string | null;
|
||||
paymentPhaseEndsAt: string | null;
|
||||
/** End of the payment drain tail — pending payments may settle until then. */
|
||||
paymentDrainEndsAt?: string | null;
|
||||
bookingWindowStatus: string;
|
||||
bookingCycleNo: number;
|
||||
departureDate: string;
|
||||
@@ -94,16 +96,29 @@ const COUNTDOWN_TEXT: Partial<
|
||||
PRE_WINDOW: { label: "Opens in", expiredText: "Opening now…" },
|
||||
OPEN: { label: "Closes in", expiredText: "Review starting…" },
|
||||
DOC_REVIEW: { label: "Doc review ends in", expiredText: "Payment starting…" },
|
||||
PAYMENT: { label: "Payment ends in", expiredText: "Closing…" },
|
||||
PAYMENT: { label: "Payment ends in", expiredText: "Finalizing…" },
|
||||
};
|
||||
|
||||
function phaseCountdown(
|
||||
w: WindowRow,
|
||||
): { label: string; deadline: string; expiredText: string } | null {
|
||||
function phaseCountdown(w: WindowRow): {
|
||||
label: string;
|
||||
deadline: string;
|
||||
expiredText: string;
|
||||
graceDeadline?: string | null;
|
||||
graceLabel?: string;
|
||||
} | null {
|
||||
const state = bookingWindowUiState(w);
|
||||
const text = COUNTDOWN_TEXT[state.kind];
|
||||
if (!state.countdownTo || !text) return null;
|
||||
return { ...text, deadline: state.countdownTo };
|
||||
// Once the pay deadline lapses, pending payments still settle during the
|
||||
// drain tail — count it down as "processing" instead of a stale "closing".
|
||||
const grace =
|
||||
state.kind === "PAYMENT" && w.paymentDrainEndsAt
|
||||
? {
|
||||
graceDeadline: w.paymentDrainEndsAt,
|
||||
graceLabel: "Processing payments — closes in",
|
||||
}
|
||||
: undefined;
|
||||
return { ...text, deadline: state.countdownTo, ...grace };
|
||||
}
|
||||
|
||||
/** Badge label + Mantine color per UI state — same state the countdown uses. */
|
||||
@@ -225,6 +240,8 @@ function WindowCard({ w }: { w: WindowRow }) {
|
||||
deadline={cd.deadline}
|
||||
label={cd.label}
|
||||
expiredText={cd.expiredText}
|
||||
graceDeadline={cd.graceDeadline}
|
||||
graceLabel={cd.graceLabel}
|
||||
size="xs"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user