This commit is contained in:
Andras Schmelczer 2026-03-08 21:29:15 +00:00
parent 5f30928c64
commit 74d6dd7bf8
10 changed files with 306 additions and 149 deletions

View file

@ -84,10 +84,16 @@ export default function AreaPane({
}
return (
<div className="flex flex-col h-full">
<div className="p-3 border-b border-warm-200 dark:border-warm-700">
<div className="flex justify-between items-center">
<div className="flex items-center gap-2">
<div className="relative h-full">
<div className="absolute top-2 right-2 z-20">
<IconButton onClick={onClose} title="Close">
<CloseIcon />
</IconButton>
</div>
<div className="h-full overflow-y-auto">
<div className="p-3">
<div className="flex items-center gap-2 pr-8">
<div>
<h2 className="text-sm font-semibold dark:text-warm-100">
{isPostcode ? hexagonId : 'Area Statistics'}
@ -100,35 +106,29 @@ export default function AreaPane({
<div className="w-3 h-3 border-2 border-teal-600 dark:border-teal-400 border-t-transparent rounded-full animate-spin" />
)}
</div>
<IconButton onClick={onClose} title="Close">
<CloseIcon />
</IconButton>
</div>
{propertyCount != null && (
<p className="text-sm text-warm-600 dark:text-warm-400 mt-1">
{propertyCount.toLocaleString()} properties
{propertyCount != null && (
<p className="text-sm text-warm-600 dark:text-warm-400 mt-1">
{propertyCount.toLocaleString()} properties
</p>
)}
<p className="text-xs text-warm-500 dark:text-warm-400 mt-1">
Stats for {isPostcode ? 'current and historical' : 'all'} properties
in this {isPostcode ? 'postcode' : 'area'}
{Object.keys(filters).length > 0 ? ' matching all active filters' : ''}
</p>
)}
<p className="text-xs text-warm-500 dark:text-warm-400 mt-1">
Stats for {isPostcode ? 'current and historical' : 'all'} properties
in this {isPostcode ? 'postcode' : 'area'}
{Object.keys(filters).length > 0 ? ' matching all active filters' : ''}
</p>
{stats && stats.count > 0 && (
<button
onClick={onViewProperties}
className="mt-2 w-full text-sm py-1.5 rounded bg-teal-600 hover:bg-teal-700 text-white font-medium"
>
View {stats.count.toLocaleString()} Properties
</button>
)}
</div>
{stats && stats.count > 0 && (
<button
onClick={onViewProperties}
className="mt-2 w-full text-sm py-1.5 rounded bg-teal-600 hover:bg-teal-700 text-white font-medium"
>
View {stats.count.toLocaleString()} Properties
</button>
)}
</div>
{hexagonLocation && stats && (
<ExternalSearchLinks location={hexagonLocation} filters={filters} />
)}
<div className="flex-1 overflow-y-auto">
{hexagonLocation && stats && (
<ExternalSearchLinks location={hexagonLocation} filters={filters} />
)}
{loading && !stats ? (
<LoadingSkeleton />
) : stats ? (

View file

@ -296,10 +296,15 @@ export default function MapPage({
}, [mapData.data, mapData.postcodeData, mapData.usePostcodeView]);
useEffect(() => {
if (screenshotMode && !mapData.loading && mapData.data.length > 0) {
window.__screenshot_ready = true;
if (screenshotMode && !mapData.loading) {
const hasData = mapData.usePostcodeView
? mapData.postcodeData.length > 0
: mapData.data.length > 0;
if (hasData) {
window.__screenshot_ready = true;
}
}
}, [screenshotMode, mapData.loading, mapData.data.length]);
}, [screenshotMode, mapData.loading, mapData.data.length, mapData.postcodeData.length, mapData.usePostcodeView]);
if (screenshotMode) {
return (
@ -519,6 +524,14 @@ export default function MapPage({
onClose={() => setMobileDrawerOpen(false)}
renderArea={renderAreaPane}
renderProperties={renderPropertiesPane}
tab={selection.rightPaneTab}
onTabChange={(t) => {
if (t === 'properties') {
selection.handlePropertiesTabClick();
} else {
selection.setRightPaneTab(t);
}
}}
/>
)}

View file

@ -50,7 +50,7 @@ export function PropertiesPane({
}
return (
<div className="flex flex-col h-full">
<div className="h-full overflow-y-auto">
{showInfo && (
<InfoPopup
title="Property Data"
@ -76,7 +76,7 @@ export function PropertiesPane({
</InfoPopup>
)}
<div className="p-2 border-b border-warm-200 dark:border-navy-700">
<div className="p-2">
<SearchInput
value={search}
onChange={setSearch}
@ -85,7 +85,7 @@ export function PropertiesPane({
/>
</div>
<div className="flex-1 overflow-y-auto">
<div>
{loading && properties.length === 0 ? (
<PropertyLoadingSkeleton />
) : (

View file

@ -1,9 +1,12 @@
import { useRef, useEffect, useCallback } from 'react';
import { useState, useRef, useEffect, useCallback } from 'react';
import { Slider } from '../ui/Slider';
import { IconButton } from '../ui/IconButton';
import { PillToggle } from '../ui/PillToggle';
import { PlaceSearchInput } from '../ui/PlaceSearchInput';
import InfoPopup from '../ui/InfoPopup';
import { CloseIcon } from '../ui/icons/CloseIcon';
import { EyeIcon } from '../ui/icons/EyeIcon';
import { InfoIcon } from '../ui/icons/InfoIcon';
import { MapPinIcon } from '../ui/icons/MapPinIcon';
import { CarIcon } from '../ui/icons/CarIcon';
import { BicycleIcon } from '../ui/icons/BicycleIcon';
@ -50,6 +53,7 @@ export function TravelTimeCard({
}: TravelTimeCardProps) {
const search = useLocationSearch(mode);
const containerRef = useRef<HTMLDivElement>(null);
const [showBestInfo, setShowBestInfo] = useState(false);
// Close dropdown on outside click
useEffect(() => {
@ -100,43 +104,52 @@ export function TravelTimeCard({
</div>
</div>
{/* Destination search */}
<div ref={containerRef} className="relative">
<PlaceSearchInput
search={search}
onSelect={selectResult}
placeholder={slug ? 'Change destination...' : 'Search destination...'}
size="xs"
inputClassName="w-full px-2 py-1 text-xs rounded border border-warm-200 dark:border-warm-600 bg-white dark:bg-warm-800 text-navy-950 dark:text-warm-200 placeholder-warm-400 dark:placeholder-warm-500 outline-none focus:ring-1 focus:ring-teal-400"
portal
/>
{slug && label && (
<div className="flex items-center gap-1 mt-1">
<MapPinIcon className="w-3 h-3 text-red-500 shrink-0" />
<span className="text-xs text-warm-600 dark:text-warm-300">
{label}
</span>
</div>
)}
</div>
{/* Destination */}
{slug && label ? (
<div className="flex items-center gap-1.5 px-2 py-1 rounded border border-warm-200 dark:border-warm-700 bg-warm-50 dark:bg-warm-800">
<MapPinIcon className="w-3 h-3 text-red-500 shrink-0" />
<span className="text-xs text-navy-950 dark:text-warm-200 flex-1 truncate">
{label}
</span>
<button
onClick={() => onSetDestination('', '')}
className="text-warm-400 hover:text-warm-700 dark:hover:text-warm-300 shrink-0"
title="Clear destination"
>
<CloseIcon className="w-3 h-3" />
</button>
</div>
) : (
<div ref={containerRef} className="relative">
<PlaceSearchInput
search={search}
onSelect={selectResult}
placeholder="Search stations..."
size="xs"
inputClassName="w-full px-2 py-1 text-xs rounded border border-warm-200 dark:border-warm-600 bg-white dark:bg-warm-800 text-navy-950 dark:text-warm-200 placeholder-warm-400 dark:placeholder-warm-500 outline-none focus:ring-1 focus:ring-teal-400"
portal
/>
</div>
)}
{/* Best-case toggle — transit only, shown when destination is set */}
{slug && mode === 'transit' && (
<label className="flex items-center gap-1.5 cursor-pointer">
<input
type="checkbox"
checked={useBest}
onChange={onToggleBest}
className="accent-teal-600 rounded"
/>
<span className="text-xs text-warm-600 dark:text-warm-300">
Best case
</span>
<span className="text-[10px] text-warm-400 dark:text-warm-500">
(optimal departure)
</span>
</label>
<div className="flex items-center gap-1.5">
<PillToggle label="Best case" active={useBest} onClick={onToggleBest} size="xs" />
<IconButton onClick={() => setShowBestInfo(true)} title="What is best case?">
<InfoIcon className="w-3 h-3" />
</IconButton>
</div>
)}
{showBestInfo && (
<InfoPopup title="Best case travel time" onClose={() => setShowBestInfo(false)}>
<p className="text-sm text-warm-700 dark:text-warm-300 leading-relaxed">
Uses the <strong>5th percentile</strong> travel time the fastest realistic journey
if you time your departure to catch optimal connections. The default uses the{' '}
<strong>median</strong>, representing a typical journey regardless of when you leave.
</p>
</InfoPopup>
)}
{/* Time range slider — only show when we have data */}

View file

@ -145,14 +145,14 @@ export default function MobileMenu({
{/* Auth buttons */}
<div>
{user ? (
<div className="flex items-center justify-between px-4 py-2">
<div className="flex items-center justify-between gap-3 px-4 py-2">
<span className="text-sm text-warm-300 truncate">{user.email}</span>
<button
onClick={() => {
onLogout();
onClose();
}}
className="text-sm text-warm-400 hover:text-white"
className="shrink-0 text-sm text-warm-400 hover:text-white"
>
Log out
</button>

View file

@ -69,7 +69,7 @@ export function useTravelTime(initial?: TravelTimeInitial) {
(index: number) => {
setEntries((prev) =>
prev.map((entry, i) =>
i === index ? { ...entry, useBest: !entry.useBest, timeRange: null } : entry
i === index ? { ...entry, useBest: !entry.useBest } : entry
)
);
},