mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
feat(mail-ingest): admin card, review mark, inbox events and links, translations
- Admin settings (desktop and phone, self-hosted only): the instance switch,
how mail arrives (IMAP or a signed webhook) with its fields, the address
template, the AI allowance per person and day, a connection test and the
status in counts. Changed fields only are saved; secrets stay masked.
- The review mark of an imported booking takes its mark off: the pill in the
desktop dialog and a row in the phone's transport sheet ('Looks right'),
through the ordinary booking update. Its hint no longer speaks of airports.
- The inbox follows mailInbox:changed and mailInbox:settings, and
?inbox=mail (the 'bookings waiting' notification) opens it.
- mailIngestRepo: the online-only path the views take, answers parsed
against the shared contracts.
- Dropped 'read with AI' and the unused mail-review contract: the server
reads a passing AI failure again on its own.
- mailInbox, mailAdmin and the new reservation, settings and notification
strings in all 28 locales; the pending notice is a plural group.
- The live flight line on the booking cards is one of the card's fields,
full width on the phone; the phone's live card keeps its map to the middle.
- Admin flight and mail cards sit in the left column.
This commit is contained in:
@@ -7,6 +7,7 @@ import type { useAdmin } from '../../../pages/admin/useAdmin'
|
||||
import MToggle from '../../components/MToggle'
|
||||
import { MBlockDisclosure, MProviderBlock, MTrekApiBlock } from './MApiProviderBlocks'
|
||||
import MAdminOidcCard from './MAdminOidcCard'
|
||||
import MMailIngestAdminCard from './MMailIngestAdminCard'
|
||||
import MSetPickerSheet from '../settings/MSetPickerSheet'
|
||||
import {
|
||||
MAdminButton,
|
||||
@@ -196,6 +197,9 @@ export default function MAdminSettingsSection({ admin, t }: MAdminSettingsSectio
|
||||
onChange={(v) => void handleToggleAuthSetting('flight_live_enabled', v, setFlightLive)}
|
||||
/>
|
||||
|
||||
{/* Booking mail import: self-hosted only, the operator runs the TREK Cloud relay (desktop parity). */}
|
||||
{!managed && <MMailIngestAdminCard />}
|
||||
|
||||
{/* Allowed file types */}
|
||||
<MAdminCard>
|
||||
<MAdminCardHead title={t('admin.fileTypes')} hint={t('admin.fileTypesHint')} />
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
import {
|
||||
TRANSPORTS,
|
||||
problemText,
|
||||
statusFacts,
|
||||
transportLabel,
|
||||
type MailAdminForm,
|
||||
type MailAdminProblem,
|
||||
} from '../../../components/Admin/mailIngest/mailIngestAdminModel';
|
||||
import { useMailIngestAdmin, type MailIngestAdmin } from '../../../components/Admin/mailIngest/useMailIngestAdmin';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import type { TranslationFn } from '../../../types';
|
||||
import { relativeTime } from '../../../utils/relativeTime';
|
||||
import MSegmented from '../../components/MSegmented';
|
||||
import MToggle from '../../components/MToggle';
|
||||
import {
|
||||
MAdminButton,
|
||||
MAdminCard,
|
||||
MAdminCardHead,
|
||||
MAdminField,
|
||||
MAdminInput,
|
||||
MAdminRow,
|
||||
MAdminSecretInput,
|
||||
} from './MAdminUi';
|
||||
|
||||
interface PartProps {
|
||||
admin: MailIngestAdmin;
|
||||
form: MailAdminForm;
|
||||
t: TranslationFn;
|
||||
}
|
||||
|
||||
/** The problem under a field, in the danger colour, or nothing. */
|
||||
function Problem({ admin, problem, t }: { admin: MailIngestAdmin; problem: MailAdminProblem; t: TranslationFn }) {
|
||||
if (!admin.problems.includes(problem)) return null;
|
||||
return <p className="mt-1 text-caption text-[color:var(--m-st-danger)]">{problemText(problem, t)}</p>;
|
||||
}
|
||||
|
||||
function ImapFields({ admin, form, t }: PartProps) {
|
||||
return (
|
||||
<>
|
||||
<MAdminField label={t('mailAdmin.imap.host')}>
|
||||
<MAdminInput
|
||||
value={form.imap_host}
|
||||
placeholder="imap.example.com"
|
||||
onChange={(e) => admin.set('imap_host', e.target.value)}
|
||||
/>
|
||||
</MAdminField>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<MAdminField label={t('mailAdmin.imap.port')}>
|
||||
<MAdminInput
|
||||
inputMode="numeric"
|
||||
value={form.imap_port}
|
||||
onChange={(e) => admin.set('imap_port', e.target.value)}
|
||||
/>
|
||||
<Problem admin={admin} problem="portInvalid" t={t} />
|
||||
</MAdminField>
|
||||
<MAdminField label={t('mailAdmin.imap.tls')}>
|
||||
<MSegmented
|
||||
value={form.imap_tls}
|
||||
onChange={(value) => admin.set('imap_tls', value)}
|
||||
options={[
|
||||
{ value: 'tls', label: 'TLS' },
|
||||
{ value: 'starttls', label: 'STARTTLS' },
|
||||
]}
|
||||
/>
|
||||
</MAdminField>
|
||||
</div>
|
||||
<MAdminField label={t('mailAdmin.imap.user')}>
|
||||
<MAdminInput
|
||||
autoComplete="off"
|
||||
value={form.imap_user}
|
||||
onChange={(e) => admin.set('imap_user', e.target.value)}
|
||||
/>
|
||||
</MAdminField>
|
||||
<MAdminField label={t('mailAdmin.imap.pass')}>
|
||||
<MAdminSecretInput
|
||||
autoComplete="new-password"
|
||||
value={form.imap_pass}
|
||||
onChange={(e) => admin.set('imap_pass', e.target.value)}
|
||||
/>
|
||||
</MAdminField>
|
||||
<MAdminField label={t('mailAdmin.imap.mailbox')} hint={t('mailAdmin.imap.mailboxHint')}>
|
||||
<MAdminInput value={form.imap_mailbox} onChange={(e) => admin.set('imap_mailbox', e.target.value)} />
|
||||
</MAdminField>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function WebhookFields({ admin, form, t }: PartProps) {
|
||||
return (
|
||||
<>
|
||||
<MAdminField label={t('mailAdmin.webhook.secret')} hint={t('mailAdmin.webhook.secretHint')}>
|
||||
<MAdminSecretInput
|
||||
autoComplete="new-password"
|
||||
value={form.webhook_secret}
|
||||
onChange={(e) => admin.set('webhook_secret', e.target.value)}
|
||||
/>
|
||||
<Problem admin={admin} problem="secretShort" t={t} />
|
||||
</MAdminField>
|
||||
<MAdminField label={t('mailAdmin.inboundUrl')} hint={t('mailAdmin.inboundUrlHint')}>
|
||||
<p className="break-all font-geist text-caption text-m-muted">{`${window.location.origin}/api/mail-ingest/inbound`}</p>
|
||||
</MAdminField>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** How the import runs, in counts only. */
|
||||
function Status({ admin, t, locale }: { admin: MailIngestAdmin; t: TranslationFn; locale: string }) {
|
||||
const status = admin.status;
|
||||
if (!status) return null;
|
||||
const facts = statusFacts(status);
|
||||
const lastRead = status.last_ok_at
|
||||
? relativeTime(Date.parse(status.last_ok_at), locale)
|
||||
: t('mailAdmin.status.never');
|
||||
return (
|
||||
<div className="mt-3 rounded-[12px] bg-[color:var(--m-ic)] px-3 py-[10px]">
|
||||
<p className="text-caption font-semibold text-m-ink">{t('mailAdmin.status.lastRead', { time: lastRead })}</p>
|
||||
<div className="mt-2 grid grid-cols-2 gap-x-3 gap-y-[6px]">
|
||||
{[
|
||||
{ label: t('mailAdmin.status.mails'), value: facts.mails },
|
||||
{ label: t('mailAdmin.status.added'), value: facts.added },
|
||||
{ label: t('mailAdmin.status.waiting'), value: facts.waiting },
|
||||
{ label: t('mailAdmin.status.failed'), value: facts.failed },
|
||||
].map((f) => (
|
||||
<div key={f.label} className="flex items-baseline justify-between gap-2">
|
||||
<span className="truncate text-caption text-m-faint">{f.label}</span>
|
||||
<span className="font-geist text-body font-bold tabular-nums text-m-ink">{f.value}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{status.last_error && <p className="mt-2 text-caption text-[color:var(--m-st-pending)]">{status.last_error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Setup({ admin, form, t, locale }: PartProps & { locale: string }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-3 px-[14px] pb-[14px] pt-1">
|
||||
<MAdminField label={t('mailAdmin.transport.label')}>
|
||||
<MSegmented
|
||||
value={form.transport}
|
||||
onChange={(value) => admin.set('transport', value)}
|
||||
options={TRANSPORTS.map((x) => ({ value: x, label: transportLabel(x, t) }))}
|
||||
/>
|
||||
</MAdminField>
|
||||
<MAdminField label={t('mailAdmin.template')} hint={t('mailAdmin.templateHint', { token: '{token}' })}>
|
||||
<MAdminInput
|
||||
value={form.address_template}
|
||||
placeholder="trek+{token}@example.com"
|
||||
onChange={(e) => admin.set('address_template', e.target.value)}
|
||||
/>
|
||||
<Problem admin={admin} problem="templateToken" t={t} />
|
||||
</MAdminField>
|
||||
{form.transport === 'imap' && <ImapFields admin={admin} form={form} t={t} />}
|
||||
{form.transport === 'webhook' && <WebhookFields admin={admin} form={form} t={t} />}
|
||||
<MAdminField label={t('mailAdmin.aiDaily')} hint={t('mailAdmin.aiDailyHint')}>
|
||||
<MAdminInput
|
||||
inputMode="numeric"
|
||||
value={form.ai_per_user_daily}
|
||||
onChange={(e) => admin.set('ai_per_user_daily', e.target.value)}
|
||||
/>
|
||||
<Problem admin={admin} problem="dailyInvalid" t={t} />
|
||||
</MAdminField>
|
||||
<p className="text-caption text-m-faint">{t('mailAdmin.envHint')}</p>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<MAdminButton busy={admin.saving} disabled={!admin.dirty || admin.problems.length > 0} onClick={admin.save}>
|
||||
{t('common.save')}
|
||||
</MAdminButton>
|
||||
<MAdminButton
|
||||
variant="ghost"
|
||||
busy={admin.testing}
|
||||
disabled={admin.dirty || form.transport === 'off'}
|
||||
onClick={admin.runTest}
|
||||
>
|
||||
{t('mailAdmin.test.run')}
|
||||
</MAdminButton>
|
||||
{admin.test && (
|
||||
<span
|
||||
className={`text-caption font-semibold ${admin.test.ok ? 'text-[color:var(--m-st-confirmed)]' : 'text-[color:var(--m-st-danger)]'}`}
|
||||
>
|
||||
{admin.test.ok ? t('mailAdmin.test.ok') : (admin.test.error ?? t('mailAdmin.test.failed'))}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<Status admin={admin} t={t} locale={locale} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The booking mail import in the phone's admin settings, the same card as on
|
||||
* the desktop (useMailIngestAdmin): the switch, how mail arrives, the address
|
||||
* template, the AI allowance, the test and the status. Self-hosted only.
|
||||
*/
|
||||
export default function MMailIngestAdminCard() {
|
||||
const { t, locale } = useTranslation();
|
||||
const admin = useMailIngestAdmin(true);
|
||||
return (
|
||||
<MAdminCard>
|
||||
<MAdminCardHead title={t('mailAdmin.title')} hint={t('mailAdmin.hint')} />
|
||||
<MAdminRow
|
||||
title={t('mailAdmin.enabled')}
|
||||
hint={t('mailAdmin.enabledHint')}
|
||||
trailing={
|
||||
<MToggle
|
||||
checked={admin.enabled}
|
||||
ariaLabel={t('mailAdmin.enabled')}
|
||||
disabled={!admin.loaded}
|
||||
onChange={admin.toggle}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{admin.enabled && admin.form && <Setup admin={admin} form={admin.form} t={t} locale={locale} />}
|
||||
</MAdminCard>
|
||||
);
|
||||
}
|
||||
@@ -1,18 +1,24 @@
|
||||
import { useEffect, type ReactElement } from 'react';
|
||||
import { useMailInboxLink } from '../../../components/MailIngest/useMailInboxLink';
|
||||
import { useAuthStore } from '../../../store/authStore';
|
||||
import { useMailIngestStore } from '../../../store/mailIngestStore';
|
||||
import { useMailIngestStore, watchMailInbox } from '../../../store/mailIngestStore';
|
||||
import MMailInboxSheet from './MMailInboxSheet';
|
||||
|
||||
/**
|
||||
* The phone shell's one inbox of bookings from forwarded mails: reads the
|
||||
* person's import settings once they are signed in (the user menu's badge
|
||||
* needs them) and mounts the sheet only where the import is on.
|
||||
* needs them), follows the server's inbox events, and mounts the sheet only
|
||||
* where the import is on.
|
||||
*/
|
||||
export default function MMailInboxHost(): ReactElement | null {
|
||||
const userId = useAuthStore((s) => s.user?.id);
|
||||
const settings = useMailIngestStore((s) => s.settings);
|
||||
useEffect(() => {
|
||||
if (userId) void useMailIngestStore.getState().loadSettings();
|
||||
if (!userId) return;
|
||||
void useMailIngestStore.getState().loadSettings();
|
||||
return watchMailInbox();
|
||||
}, [userId]);
|
||||
return settings?.available && settings.prefs.enabled ? <MMailInboxSheet /> : null;
|
||||
const on = !!settings?.available && settings.prefs.enabled;
|
||||
useMailInboxLink(on);
|
||||
return on ? <MMailInboxSheet /> : null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MailIngestInboxEntry } from '@trek/shared';
|
||||
import { ChevronLeft, Copy, FilePlus2, FileText, Inbox, Mail, PencilLine, Plus, Sparkles, Trash2 } from 'lucide-react';
|
||||
import { ChevronLeft, Copy, FilePlus2, FileText, Inbox, Mail, PencilLine, Plus, Trash2 } from 'lucide-react';
|
||||
import type { ReactElement } from 'react';
|
||||
import { entryDates, entryTitle, reasonText, type InboxAction } from '../../../components/MailIngest/mailInboxModel';
|
||||
import { useMailInbox } from '../../../components/MailIngest/useMailInbox';
|
||||
@@ -23,8 +23,6 @@ function icon(action: InboxAction): ReactElement {
|
||||
return <FilePlus2 size={15} strokeWidth={2} />;
|
||||
case 'manual':
|
||||
return <PencilLine size={15} strokeWidth={2} />;
|
||||
case 'readAi':
|
||||
return <Sparkles size={15} strokeWidth={2} />;
|
||||
case 'discard':
|
||||
return <Trash2 size={15} strokeWidth={2} />;
|
||||
}
|
||||
@@ -40,8 +38,6 @@ function label(action: InboxAction, t: (key: string) => string): string {
|
||||
return t('mailInbox.action.file');
|
||||
case 'manual':
|
||||
return t('mailInbox.action.manual');
|
||||
case 'readAi':
|
||||
return t('mailInbox.action.readAi');
|
||||
case 'discard':
|
||||
return t('mailInbox.action.discard');
|
||||
}
|
||||
@@ -97,8 +93,8 @@ function Entry({ entry, inbox }: { entry: MailIngestInboxEntry; inbox: ReturnTyp
|
||||
type="button"
|
||||
aria-label={t('mailInbox.settings.copy')}
|
||||
className={ROUND}
|
||||
onClick={async () => {
|
||||
if (await copyText(code)) toast.success(t('common.copied'));
|
||||
onClick={() => {
|
||||
void copyText(code).then((ok) => ok && toast.success(t('common.copied')));
|
||||
}}
|
||||
>
|
||||
<Copy size={15} strokeWidth={2} />
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { useCurrentFlightLegIndex, useFlightLiveCard } from '../../../components/Planner/flightLive/useFlightLiveCard';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import type { DelayTone } from '../../../utils/flightLiveModel';
|
||||
import { Field } from './tabs/tabChrome';
|
||||
|
||||
const DELAY_COLOR: Record<DelayTone, string> = {
|
||||
ok: 'var(--m-st-confirmed)',
|
||||
@@ -18,8 +20,9 @@ interface MFlightLiveStripProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* A flight's live state on the phone's transport cards: what is happening in
|
||||
* one line with the delay, and a thin bar across the card while it flies. A
|
||||
* A flight's live state on the phone's transport cards, as one of the card's
|
||||
* fields: what is happening in one line with the delay, and a thin bar along
|
||||
* the field's foot while it flies. A
|
||||
* tap opens the transport sheet with the full card. Nothing far ahead of the
|
||||
* flight (the card shows its date already), nothing once it is long over.
|
||||
*/
|
||||
@@ -32,37 +35,31 @@ export default function MFlightLiveStrip({ tripId, reservationId, onOpen, classN
|
||||
}
|
||||
|
||||
function Strip({ tripId, reservationId, legIndex, onOpen, className }: MFlightLiveStripProps & { legIndex: number }) {
|
||||
const { t } = useTranslation();
|
||||
const card = useFlightLiveCard(tripId, reservationId, legIndex);
|
||||
if (!card || card.view.stage === 'upcoming') return null;
|
||||
const { view } = card;
|
||||
// One of the card's own fields, full width: the label over the framed value, like the booking code below it.
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onOpen}
|
||||
className={`flex min-w-0 flex-col gap-[6px] rounded-[10px] border border-[color:var(--m-rowbr)] bg-m-card px-[10px] py-[7px] text-start ${className}`}
|
||||
>
|
||||
<span className="flex w-full min-w-0 items-center gap-2">
|
||||
<span className="min-w-0 flex-1 truncate text-caption font-semibold text-m-ink">{card.line}</span>
|
||||
{card.delay && card.delay.tone !== 'ok' && (
|
||||
<span
|
||||
className="flex-none font-geist text-caption font-bold tabular-nums"
|
||||
style={{ color: DELAY_COLOR[card.delay.tone] }}
|
||||
>
|
||||
{card.delay.text}
|
||||
<button type="button" onClick={onOpen} className={`block text-start ${className}`}>
|
||||
<Field label={t('reservations.status')} className="w-full">
|
||||
<span className="inline-flex max-w-full items-center gap-2 align-middle">
|
||||
<span className="min-w-0 truncate">{card.line}</span>
|
||||
{card.delay && card.delay.tone !== 'ok' && (
|
||||
<span className="flex-none tabular-nums" style={{ color: DELAY_COLOR[card.delay.tone] }}>
|
||||
{card.delay.text}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
{view.stage === 'airborne' && (
|
||||
<span className="-mx-[10px] -mb-[7px] mt-[6px] block h-[3px] bg-[color:var(--m-rowbr)]" aria-hidden="true">
|
||||
<span
|
||||
className="block h-full transition-[width] duration-700 motion-reduce:transition-none"
|
||||
style={{ width: `${Math.round(view.progress * 100)}%`, background: LIVE }}
|
||||
/>
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
{view.stage === 'airborne' && (
|
||||
<span
|
||||
className="block h-[3px] w-full overflow-hidden rounded-full bg-[color:var(--m-rowbr)]"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span
|
||||
className="block h-full rounded-full transition-[width] duration-700 motion-reduce:transition-none"
|
||||
style={{ width: `${Math.round(view.progress * 100)}%`, background: LIVE }}
|
||||
/>
|
||||
</span>
|
||||
)}
|
||||
</Field>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -127,15 +127,12 @@ export default function MFlightLiveCard({ tripId, reservationId, legIndex, legLa
|
||||
showPlane={view.stage !== 'upcoming' && view.stage !== 'soon'}
|
||||
dimPlane={view.stale}
|
||||
credits={card.attribution ? [card.attribution, FLIGHT_MAP_CREDIT] : [FLIGHT_MAP_CREDIT]}
|
||||
inset={0.36}
|
||||
className="!absolute inset-0 [--fm-ahead:var(--m-muted)] [--fm-code:var(--m-muted)] [--fm-end:var(--m-inner)] [--fm-flown:var(--m-st-info)] [--fm-halo:var(--m-inner)] [--fm-plane:var(--m-st-info)]"
|
||||
inset={0.06}
|
||||
className="flight-mini-map--narrow !absolute inset-y-2 end-[25%] start-[25%] [--fm-ahead:var(--m-muted)] [--fm-code:var(--m-muted)] [--fm-end:var(--m-inner)] [--fm-flown:var(--m-st-info)] [--fm-halo:var(--m-inner)] [--fm-plane:var(--m-st-info)]"
|
||||
/>
|
||||
<End label={t('reservations.span.departure')} code={leg.origin.code} city={leg.origin.name} cell={card.dep} />
|
||||
<div className="relative z-[1] flex items-end justify-center">
|
||||
<span className="rounded-full bg-[color:var(--m-inner)] px-[7px] py-px font-geist text-caption font-bold tracking-[.06em] text-m-muted shadow-sm">
|
||||
{leg.flight_number}
|
||||
</span>
|
||||
</div>
|
||||
{/* The middle column keeps the map clear; the flight number is in the sheet's title already. */}
|
||||
<div aria-hidden="true" />
|
||||
<End
|
||||
label={t('reservations.span.arrival')}
|
||||
code={leg.destination.code}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { AlertCircle, Check } from 'lucide-react';
|
||||
import { useTranslation } from '../../../../i18n';
|
||||
|
||||
interface MReviewNoticeProps {
|
||||
/** With the right to edit the booking: "Looks right" takes the mark off. */
|
||||
onConfirm?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The phone's counterpart of the review pill in the desktop dialog: an import
|
||||
* could not read every detail for sure, so the booking asks for a look. The
|
||||
* one action says it was checked; editing the booking works as always.
|
||||
*/
|
||||
export default function MReviewNotice({ onConfirm }: MReviewNoticeProps) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="mt-[14px] flex items-center gap-[10px] rounded-[14px] bg-[color-mix(in_srgb,var(--m-st-pending)_12%,transparent)] px-3 py-[10px]">
|
||||
<AlertCircle size={16} strokeWidth={2.2} className="flex-none text-[color:var(--m-st-pending)]" />
|
||||
<span className="min-w-0 flex-1 text-caption leading-snug text-m-ink">{t('reservations.needsReviewHint')}</span>
|
||||
{onConfirm && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onConfirm}
|
||||
className="flex h-[30px] flex-none items-center gap-1 rounded-full bg-[color:var(--m-inner)] px-[11px] font-geist text-caption font-bold text-m-ink shadow-sm"
|
||||
>
|
||||
<Check size={13} strokeWidth={2.4} />
|
||||
{t('reservations.reviewConfirm')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import { downloadAttachment, openAttachment } from '../../../../components/Plann
|
||||
import { flowText } from '../../../../utils/flowText'
|
||||
import { useFlightLiveLegs } from '../../../../store/flightLiveStore'
|
||||
import MFlightLiveCard from './MFlightLiveCard'
|
||||
import MReviewNotice from './MReviewNotice'
|
||||
|
||||
interface TransportSheetPayload {
|
||||
reservationId?: number
|
||||
@@ -231,6 +232,17 @@ export default function MTransportSheet({ planner, shell }: MTripSheetsProps) {
|
||||
</div>
|
||||
|
||||
<div className="m-scroll-fade mt-2 min-h-0 flex-1 overflow-y-auto px-[18px] pb-[18px] pt-[14px]">
|
||||
{/* ── An import could not read every detail for sure ── */}
|
||||
{!!res.needs_review && (
|
||||
<MReviewNotice
|
||||
onConfirm={canEdit ? () => {
|
||||
planner.tripActions.updateReservation(planner.tripId, res.id, { needs_review: 0 })
|
||||
.then(() => planner.toast.success(t('reservations.reviewConfirmed')))
|
||||
.catch(() => planner.toast.error(t('reservations.toast.updateError')))
|
||||
} : undefined}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* ── A stay: check-in, check-out, nights ── */}
|
||||
{hotelStats.length > 0 && (
|
||||
<div className="mt-[14px] flex gap-[6px]">
|
||||
|
||||
@@ -158,7 +158,7 @@ function TransportCard({ res, planner, shell, canEdit, compact }: {
|
||||
|
||||
{/* A flight TREK follows live: its moment in one line, on the compact card too. */}
|
||||
{res.type === 'flight' && (
|
||||
<MFlightLiveStrip tripId={planner.tripId} reservationId={res.id} onOpen={openDetail} className={compact ? 'mx-3 my-2' : 'mx-3 mt-[9px]'} />
|
||||
<MFlightLiveStrip tripId={planner.tripId} reservationId={res.id} onOpen={openDetail} className={compact ? 'mx-3 my-2 w-[calc(100%-24px)]' : 'mx-3 mt-[9px] w-[calc(100%-24px)]'} />
|
||||
)}
|
||||
|
||||
{/* Body — split around the booking code so the reveal can be its own
|
||||
|
||||
Reference in New Issue
Block a user