mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 08:00:06 +00:00
Merge pull request #2383 from liketrek/fix/mobile-markdown-place-description
fix(places): render markdown in the mobile place description
This commit is contained in:
@@ -9,6 +9,7 @@ import { useAddonStore } from '../../../../store/addonStore'
|
||||
import { useToast } from '../../../../components/shared/Toast'
|
||||
import { collectionsApi } from '../../../../api/collections'
|
||||
import PlaceAvatar from '../../../../components/shared/PlaceAvatar'
|
||||
import MarkdownText from '../../../../components/shared/MarkdownText'
|
||||
import { getCategoryIcon } from '../../../../components/shared/categoryIcons'
|
||||
import { resolveTrackColor } from '../../../../components/Map/trackColors'
|
||||
import MConfirmSheet from '../../settings/MConfirmSheet'
|
||||
@@ -350,7 +351,7 @@ export default function MPlacesBrowser({ planner, shell }: MPlacesBrowserProps)
|
||||
<button type="button" onClick={() => openRow(place)} className="flex min-w-0 flex-1 items-center gap-[11px] text-left">
|
||||
{selectMode && <SquareCheck big checked={selectedIds.has(place.id)} />}
|
||||
<PlaceAvatar place={place} category={cat} size={40} />
|
||||
<span className="min-w-0 flex-1">
|
||||
<div className="min-w-0 flex-1">
|
||||
<span className="flex items-center gap-[6px]">
|
||||
{/* Stroke in the track's colour — the mobile map is full-bleed
|
||||
with no sidebar, so this is the only thing tying a line to
|
||||
@@ -365,9 +366,9 @@ export default function MPlacesBrowser({ planner, shell }: MPlacesBrowserProps)
|
||||
<span className="truncate text-[0.8125rem] font-semibold text-m-ink">{place.name}</span>
|
||||
</span>
|
||||
{sub && (
|
||||
<span className="mt-px block truncate font-geist text-[0.65625rem] text-m-muted">{sub}</span>
|
||||
<MarkdownText clamp className="mt-px font-geist text-[0.65625rem] text-m-muted">{sub}</MarkdownText>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
{!selectMode && dayNumber != null && (
|
||||
<span className="flex-none whitespace-nowrap rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-[9px] py-1 font-geist text-[0.59375rem] font-bold uppercase tracking-[.05em] text-m-muted">
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
} from 'lucide-react'
|
||||
import type { LucideIcon } from 'lucide-react'
|
||||
import { useContextMenu, ContextMenu } from '../../../../components/shared/ContextMenu'
|
||||
import MarkdownText from '../../../../components/shared/MarkdownText'
|
||||
import { fmtTransitDuration } from '../../../../components/Planner/transitDisplay'
|
||||
import { formatTime } from '../../../../utils/formatters'
|
||||
import { useMPlanTimeline, type MPlanTimelineController } from './useMPlanTimeline'
|
||||
@@ -323,7 +324,7 @@ function UpNextCard({ tl, t, onOpen }: {
|
||||
)}
|
||||
<span className="min-w-0 truncate text-[1.125rem] font-bold">{place?.name}</span>
|
||||
</div>
|
||||
{sub && <div className="mt-[2px] truncate font-geist text-[0.75rem] text-m-muted">{sub}</div>}
|
||||
{sub && <MarkdownText clamp className="mt-[2px] font-geist text-[0.75rem] text-m-muted">{sub}</MarkdownText>}
|
||||
</div>
|
||||
<span className="ml-2 flex h-8 w-8 flex-none items-center justify-center rounded-full bg-m-act text-m-actfg">
|
||||
<ChevronRight size={16} strokeWidth={2.4} />
|
||||
|
||||
@@ -2,12 +2,9 @@ import { BedDouble, Car, ChevronDown, ChevronUp, Clock, Footprints, Pencil, Rout
|
||||
import type { ReactNode, MouseEvent, CSSProperties } from 'react'
|
||||
import PlaceAvatar from '../../../../components/shared/PlaceAvatar'
|
||||
import { getCategoryIcon } from '../../../../components/shared/categoryIcons'
|
||||
import Markdown from 'react-markdown'
|
||||
import remarkGfm from 'remark-gfm'
|
||||
import remarkBreaks from 'remark-breaks'
|
||||
import MarkdownText from '../../../../components/shared/MarkdownText'
|
||||
import { RES_ICONS, getNoteIcon } from '../../../../components/Planner/DayPlanSidebar.constants'
|
||||
import { noteSurface } from '../../../../components/Planner/noteSurface'
|
||||
import { markdownLinkComponents } from '../../../../components/shared/markdownLink'
|
||||
import { getDisplayTimeForDay, getSpanPhase } from '../../../../utils/dayMerge'
|
||||
import { formatTime, splitReservationDateTime } from '../../../../utils/formatters'
|
||||
import { transportSubtitle, type TransitMeta, type TransportEntry } from './planTimelineModel'
|
||||
@@ -193,7 +190,7 @@ export function PlaceRow({ assignment, fullPlace, linkedReservations, chrome, re
|
||||
{(time || sub) && (
|
||||
<div className="mt-[2px] flex min-w-0 items-center gap-1.5">
|
||||
{time && <span className={TIME_CHIP}>{time}</span>}
|
||||
{sub && <span className="min-w-0 truncate font-geist text-[0.71875rem] text-m-muted">{sub}</span>}
|
||||
{sub && <MarkdownText clamp className="min-w-0 font-geist text-[0.71875rem] text-m-muted">{sub}</MarkdownText>}
|
||||
</div>
|
||||
)}
|
||||
{bookingLines.slice(1).map(line => (
|
||||
@@ -207,7 +204,7 @@ export function PlaceRow({ assignment, fullPlace, linkedReservations, chrome, re
|
||||
// without opening the place sheet.
|
||||
<div className="mt-[2px] flex min-w-0 items-center gap-1">
|
||||
<StickyNote size={10} strokeWidth={2.2} className="flex-none text-m-faint" />
|
||||
<span className="min-w-0 truncate font-geist text-[0.65625rem] text-m-faint">{assignment.notes}</span>
|
||||
<MarkdownText clamp className="min-w-0 font-geist text-[0.65625rem] text-m-faint">{assignment.notes}</MarkdownText>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -571,9 +568,7 @@ export function NoteRow({ note, chrome, reorder, drag, onEdit }: {
|
||||
{detail && (
|
||||
// Rendered, not raw: a note written with the formatting bar would
|
||||
// otherwise read as `**asterisks**` on the phone.
|
||||
<div className="collab-note-md mt-px font-geist text-[0.71875rem] leading-[1.45] text-m-muted [overflow-wrap:anywhere]">
|
||||
<Markdown remarkPlugins={[remarkGfm, remarkBreaks]} components={markdownLinkComponents}>{detail}</Markdown>
|
||||
</div>
|
||||
<MarkdownText className="mt-px font-geist text-[0.71875rem] leading-[1.45] text-m-muted [overflow-wrap:anywhere]">{detail}</MarkdownText>
|
||||
)}
|
||||
</div>
|
||||
{chrome.editing && <span className="flex flex-none items-center gap-1.5">{reorder}</span>}
|
||||
|
||||
@@ -15,6 +15,7 @@ import { useSaveToCollectionStore } from '../../../../store/saveToCollectionStor
|
||||
import { collectionTargetFromPlace } from '../lib/collectionTarget'
|
||||
import { getCategoryIcon } from '../../../../components/shared/categoryIcons'
|
||||
import PlaceRating from '../../../../components/shared/StarRating'
|
||||
import MarkdownText from '../../../../components/shared/MarkdownText'
|
||||
import TrackColorPicker from '../../../../components/shared/TrackColorPicker'
|
||||
import { resolveTrackColor, inheritedTrackColor } from '../../../../components/Map/trackColors'
|
||||
import { avatarSrc } from '../../../../utils/avatarSrc'
|
||||
@@ -342,7 +343,7 @@ export default function MPlaceSheet({ planner, shell }: MTripSheetsProps) {
|
||||
|
||||
{place.description && (
|
||||
<div className={`mt-[10px] rounded-[14px] px-3 py-[10px] ${INNER_CLS}`}>
|
||||
<div className="font-geist text-[0.75rem] leading-[1.5] text-m-muted">{place.description}</div>
|
||||
<MarkdownText className="font-geist text-[0.75rem] leading-[1.5] text-m-muted [overflow-wrap:anywhere]">{place.description}</MarkdownText>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -350,7 +351,7 @@ export default function MPlaceSheet({ planner, shell }: MTripSheetsProps) {
|
||||
<>
|
||||
<Eyebrow className="mb-[6px] mt-3">{t('mobileTrip.notes')}</Eyebrow>
|
||||
<div className={`rounded-[14px] px-3 py-[10px] ${INNER_CLS}`}>
|
||||
<div className="whitespace-pre-wrap font-geist text-[0.75rem] leading-[1.5] text-m-muted">{place.notes}</div>
|
||||
<MarkdownText className="font-geist text-[0.75rem] leading-[1.5] text-m-muted [overflow-wrap:anywhere]">{place.notes}</MarkdownText>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user