mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 16:10:07 +00:00
feat(places): say when a place has an address but no coordinates (#2837)
A place saved with a typed address and no search pick, link or map point gets no coordinates, so it never shows on the map, and nothing said why. The place form warns under the address while that is so, and the inspector, the phone's place sheet and both place lists mark such a place. No geocoding on save; the form stays unchanged for a service stop, which explains a missing position itself.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { ReactNode, useEffect, useMemo, useState } from 'react'
|
||||
import {
|
||||
Bookmark, CheckCheck, CheckCircle2, Download, ListChecks, Loader2, Plus,
|
||||
Bookmark, CheckCheck, CheckCircle2, Download, ListChecks, Loader2, MapPinOff, Plus,
|
||||
SlidersHorizontal, Tag, Trash2, X,
|
||||
} from 'lucide-react'
|
||||
import MDancingTrek from '../../../components/MDancingTrek'
|
||||
@@ -26,6 +26,7 @@ import { filterPool, firstPlannedDayNumbers, plannedPlaceIds } from './placesBro
|
||||
import { MCategoryFilterList, MRatingFloorChips, SquareCheck } from './MPlacesFilterControls'
|
||||
import { countActivePlacesFilters } from '../../../../utils/placesFilter'
|
||||
import { usePlacesPool } from '../../../../components/Planner/usePlacesPool'
|
||||
import { addressWithoutCoordinates } from '../../../../components/Planner/placeCoordinates'
|
||||
|
||||
/**
|
||||
* Fullscreen places pool (mode === 'browse'): All/Unplanned/Tracks filter
|
||||
@@ -340,6 +341,16 @@ export default function MPlacesBrowser({ planner, shell }: MPlacesBrowserProps)
|
||||
)}
|
||||
<CatIcon size={12} strokeWidth={2.2} className="flex-none" style={{ color: cat?.color || 'var(--m-muted)' }} />
|
||||
<span dir="auto" className="truncate text-[0.8125rem] font-semibold text-m-ink">{place.name}</span>
|
||||
{/* A typed address without coordinates: this place has no marker (#2837). */}
|
||||
{addressWithoutCoordinates(place) && (
|
||||
<MapPinOff
|
||||
size={12}
|
||||
strokeWidth={2.2}
|
||||
role="img"
|
||||
aria-label={t('places.noCoordinates')}
|
||||
className="flex-none text-[color:var(--m-st-pending)]"
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
{sub && (
|
||||
<MarkdownText clamp className="mt-px font-geist text-[0.65625rem] text-m-muted">{sub}</MarkdownText>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useMemo, useRef, useState, type ClipboardEvent } from 'react'
|
||||
import { MapPin } from 'lucide-react'
|
||||
import { MapPin, MapPinOff } from 'lucide-react'
|
||||
import MSheet from '../../../components/MSheet'
|
||||
import {
|
||||
DEFAULT_FORM,
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
type PlaceFormData,
|
||||
} from '../../../../components/Planner/PlaceFormModal.helpers'
|
||||
import { usePlaceForm } from '../../../../components/Planner/usePlaceForm'
|
||||
import { addressWithoutCoordinates } from '../../../../components/Planner/placeCoordinates'
|
||||
import { Eyebrow, FIELD_AREA_CLS, FIELD_CLS, FormSheetBody, FormSheetFooter, FormSheetHeader } from './PlSheetChrome'
|
||||
import { useAddonStore } from '../../../../store/addonStore'
|
||||
import type { BookingExpenseRequest } from '../../../../components/Planner/BookingCostsSection.types'
|
||||
@@ -331,6 +332,13 @@ export default function MPlaceEditSheet({ planner, onOpenExpense }: MPlaceEditSh
|
||||
className={`${FIELD_CLS} flex-1 text-[0.8125rem] [font-variant-numeric:tabular-nums]`}
|
||||
/>
|
||||
</div>
|
||||
{/* An address typed without coordinates puts nothing on the map (#2837). */}
|
||||
{addressWithoutCoordinates(form) && (
|
||||
<p className="mt-1.5 flex items-start gap-1.5 text-caption text-m-muted">
|
||||
<MapPinOff size={13} strokeWidth={2} aria-hidden="true" className="mt-px flex-none text-[color:var(--m-st-pending)]" />
|
||||
{t('places.noCoordinatesFormHint')}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<Eyebrow className="mb-[6px] mt-3 uppercase">{t('places.formCategory')}</Eyebrow>
|
||||
<PlCategoryPicker planner={planner} value={form.category_id} onChange={id => handleChange('category_id', id)} />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useMemo, useRef, useState } from 'react'
|
||||
import DawarichIcon from '../../../../components/shared/DawarichIcon'
|
||||
import {
|
||||
Bookmark, ChevronRight, ExternalLink, Map as MapIcon, Navigation, Paperclip,
|
||||
Bookmark, ChevronRight, ExternalLink, Map as MapIcon, MapPinOff, Navigation, Paperclip,
|
||||
Pencil, Phone, Plus, Route, RouteOff, Sparkles, Trash2, Upload, X,
|
||||
} from 'lucide-react'
|
||||
import MSheet from '../../../components/MSheet'
|
||||
@@ -24,6 +24,7 @@ import { safeHttpUrl } from '../../../../utils/safeUrl'
|
||||
import { openFile } from '../../../../utils/fileDownload'
|
||||
import { filesForPlace } from '../../../../utils/placeFiles'
|
||||
import { navigationTargetLabel, getNavigationTargets, openNavigationTarget } from '../../../../components/Planner/placeNavigation'
|
||||
import { addressWithoutCoordinates } from '../../../../components/Planner/placeCoordinates'
|
||||
import { NavigationMenu } from '../../../../components/shared/NavigationMenu'
|
||||
import { getPlaceBookings } from '../../../../utils/dayMerge'
|
||||
import type { Assignment, Day, Reservation, TripMember } from '../../../../types'
|
||||
@@ -219,6 +220,13 @@ export default function MPlaceSheet({ planner, shell }: MTripSheetsProps) {
|
||||
{place.address && (
|
||||
<div className="mt-[2px] font-geist text-[0.6875rem] leading-[1.4] text-m-muted"><bdi>{place.address}</bdi></div>
|
||||
)}
|
||||
{/* A typed address that never got coordinates: no marker, and the sheet says why (#2837). */}
|
||||
{addressWithoutCoordinates(place) && (
|
||||
<div className="mt-[3px] flex items-center gap-1 text-caption font-semibold text-[color:var(--m-st-pending)]">
|
||||
<MapPinOff size={12} strokeWidth={2.2} aria-hidden="true" className="flex-none" />
|
||||
{t('places.noCoordinates')}
|
||||
</div>
|
||||
)}
|
||||
{/* The category under the name and address, as wide as its name:
|
||||
squeezed under the photo it was cut to "Shoppi…". */}
|
||||
{category && (
|
||||
|
||||
Reference in New Issue
Block a user