mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
feat(mail-ingest): inbox, settings and trip address UI on desktop and phone (wip)
This commit is contained in:
@@ -9,6 +9,7 @@ import { LLM_PHOTO_EXTENSIONS } from '@trek/shared'
|
||||
import { useBackgroundTasksStore } from '../../store/backgroundTasksStore'
|
||||
import { saveImportFiles } from '../../db/offlineDb'
|
||||
import { isEffectivelyOffline } from '../../sync/networkMode'
|
||||
import TripMailForward from '../MailIngest/TripMailForward'
|
||||
|
||||
interface BookingImportModalProps {
|
||||
isOpen: boolean
|
||||
@@ -209,6 +210,9 @@ export default function BookingImportModal({ isOpen, onClose, tripId, kind }: Bo
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* The other way in: forward the booking mail to the trip's own address. */}
|
||||
<TripMailForward tripId={tripId} />
|
||||
</div>
|
||||
|
||||
{/* Footer */}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { formatMoney } from '../../../utils/formatters'
|
||||
import { parseMeta, displayTitle, type CostTotal } from './bookingsModel'
|
||||
import type { BookingFacts } from './bookingFacts'
|
||||
import {
|
||||
AirTrailPill, BOX, Block, Field, FileRows, ReviewPill, RoundAction, RouteBox, StatusDot, TravelerChips, TypeChip, WhenFields,
|
||||
AirTrailPill, MailPill, BOX, Block, Field, FileRows, ReviewPill, RoundAction, RouteBox, StatusDot, TravelerChips, TypeChip, WhenFields,
|
||||
fs, toneOf, toneTint,
|
||||
} from './bookingParts'
|
||||
import { TransitLegs, transitSummary } from './transitParts'
|
||||
@@ -66,6 +66,7 @@ export default function BookingCard(p: BookingCardProps) {
|
||||
{!!r.needs_review && <ReviewPill />}
|
||||
</span>
|
||||
<AirTrailPill r={r} />
|
||||
<MailPill r={r} />
|
||||
{p.canEdit && <RoundAction label={t('common.edit')} onClick={p.onEdit}><Pencil size={12} strokeWidth={2} /></RoundAction>}
|
||||
{p.canEdit && <RoundAction label={t('common.delete')} onClick={p.onDelete} danger><Trash2 size={12} strokeWidth={2} /></RoundAction>}
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@ import { copyText } from '../../../utils/clipboard'
|
||||
import { fmtTransitDuration } from '../transitDisplay'
|
||||
import { parseMeta, displayTitle } from './bookingsModel'
|
||||
import { stayStats, type BookingFacts } from './bookingFacts'
|
||||
import { AirTrailPill, BOX, Eyebrow, Field, FileRows, ReviewPill, TravelerChips, fs, toneOf } from './bookingParts'
|
||||
import { AirTrailPill, MailPill, BOX, Eyebrow, Field, FileRows, ReviewPill, TravelerChips, fs, toneOf } from './bookingParts'
|
||||
import { TransitLegs, transitSummary } from './transitParts'
|
||||
import { BookingDialogHeader, StatusPill, TypePill } from './BookingDialogShell'
|
||||
import { DeleteButton, DialogButton, DialogFooter, DialogSection as Section, DialogShell, FooterSpacer, PILL } from '../../shared/DialogShell'
|
||||
@@ -145,6 +145,7 @@ export default function BookingDetailDialog(p: BookingDetailDialogProps) {
|
||||
)}
|
||||
{!!r.needs_review && <ReviewPill pill />}
|
||||
<AirTrailPill r={r} pill />
|
||||
<MailPill r={r} pill />
|
||||
{r.confirmation_number && (
|
||||
// The copy button rides in the pill's padding (-my-1), so this pill is as tall as its neighbours.
|
||||
<span className={`${PILL} gap-1 pe-1`}>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { formatMoney } from '../../../utils/formatters'
|
||||
import { TransitLegChips } from '../transitDisplay'
|
||||
import { displayTitle, parseMeta, type BookingGroup, type CostTotal } from './bookingsModel'
|
||||
import type { BookingFacts } from './bookingFacts'
|
||||
import { AirTrailPill, CountPill, EYEBROW, ReviewPill, RoundAction, StatusDot, TravelerStack, TypeTile, fs } from './bookingParts'
|
||||
import { AirTrailPill, CountPill, MailPill, EYEBROW, ReviewPill, RoundAction, StatusDot, TravelerStack, TypeTile, fs } from './bookingParts'
|
||||
|
||||
export interface BookingsListProps {
|
||||
groups: BookingGroup[]
|
||||
@@ -102,6 +102,7 @@ function Row({ r, p, facts, files, costs, t, locale }: {
|
||||
<span className="truncate font-semibold text-content" style={fs(13.5, 'body')}>{displayTitle(r)}</span>
|
||||
{!!r.needs_review && <ReviewPill />}
|
||||
<AirTrailPill r={r} />
|
||||
<MailPill r={r} />
|
||||
</div>
|
||||
{transit ? (
|
||||
<div className="mt-1"><TransitLegChips legs={Array.isArray(meta.transit?.legs) ? meta.transit.legs : []} size="sm" t={t} /></div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CSSProperties, ReactNode } from 'react'
|
||||
import { AlertCircle, ChevronDown, ChevronUp, Download, FileText, Plane } from 'lucide-react'
|
||||
import { AlertCircle, ChevronDown, ChevronUp, Download, FileText, Mail, Plane } from 'lucide-react'
|
||||
import type { Reservation, TripFile } from '../../../types'
|
||||
import type { ReservationTraveler } from '@trek/shared'
|
||||
import { useTranslation } from '../../../i18n'
|
||||
@@ -190,6 +190,27 @@ export function ReviewPill({ pill = false }: { pill?: boolean }) {
|
||||
* The AirTrail link of a booking. A multi-leg import is detached from sync by
|
||||
* design (#1535), which is not the same as a flight removed upstream (#1646).
|
||||
*/
|
||||
/** Added from a forwarded booking mail (mail-ingest): said quietly, so the person knows where it came from. */
|
||||
export function MailPill({ r, pill = false }: { r: Reservation; pill?: boolean }) {
|
||||
const { t } = useTranslation()
|
||||
if (r.external_source !== 'mail') return null
|
||||
return (
|
||||
<Tooltip label={t('mailInbox.fromMailHint')}>
|
||||
{pill ? (
|
||||
<span className={PILL} style={fs(12, 'body')}>
|
||||
<Mail size={13} strokeWidth={2.2} className="text-content-faint" />
|
||||
{t('mailInbox.fromMail')}
|
||||
</span>
|
||||
) : (
|
||||
<span className="inline-flex flex-none items-center gap-1 rounded-full bg-surface-tertiary px-2 py-[2px] font-geist font-bold uppercase tracking-[.03em] text-content-faint" style={fs(9)}>
|
||||
<Mail size={10} />
|
||||
{t('mailInbox.fromMail')}
|
||||
</span>
|
||||
)}
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
||||
export function AirTrailPill({ r, pill = false }: { r: Reservation; pill?: boolean }) {
|
||||
const { t } = useTranslation()
|
||||
if (r.external_source !== 'airtrail') return null
|
||||
|
||||
Reference in New Issue
Block a user