No hacks
This commit is contained in:
parent
e3e8a4522e
commit
58bb3cb4f8
9 changed files with 49 additions and 174 deletions
|
|
@ -55,18 +55,6 @@ const MapPageSelectionPane = lazy(() =>
|
|||
const UpgradeModal = lazy(() => import('../ui/UpgradeModal'));
|
||||
const Joyride = lazy(() => import('react-joyride'));
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__demoRecording?: boolean;
|
||||
__demoOpenBestHexagon?: () => string | null;
|
||||
__demoMapSettled?: boolean;
|
||||
__demoMapSettleVersion?: number;
|
||||
__demoMapIdle?: boolean;
|
||||
__demoMapIdleVersion?: number;
|
||||
__demoSelectionReady?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
function MapFallback() {
|
||||
return (
|
||||
<div className="flex h-full w-full items-center justify-center bg-warm-100 dark:bg-navy-950">
|
||||
|
|
@ -231,10 +219,6 @@ export default function MapPage({
|
|||
travelTimeEntries: entries,
|
||||
shareCode,
|
||||
});
|
||||
const demoMapHasData = mapData.usePostcodeView
|
||||
? mapData.postcodeData.length > 0
|
||||
: mapData.data.length > 0;
|
||||
|
||||
const handleAiFilterSubmit = useCallback(
|
||||
async (query: string) => {
|
||||
// Build context from current filters for conversational refinement
|
||||
|
|
@ -432,48 +416,6 @@ export default function MapPage({
|
|||
setRightPaneTab(initialTab);
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
useEffect(() => {
|
||||
if (!window.__demoRecording) return;
|
||||
void import('./MapPageSelectionPane');
|
||||
void import('./AreaPane');
|
||||
void import('./PropertiesPane');
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!window.__demoRecording) return;
|
||||
window.__demoMapSettled = !mapData.loading && demoMapHasData;
|
||||
if (window.__demoMapSettled) {
|
||||
window.__demoMapSettleVersion = (window.__demoMapSettleVersion ?? 0) + 1;
|
||||
}
|
||||
return () => {
|
||||
window.__demoMapSettled = false;
|
||||
};
|
||||
}, [demoMapHasData, mapData.loading]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!window.__demoRecording) return;
|
||||
window.__demoSelectionReady = Boolean(selectedHexagon && areaStats && !loadingAreaStats);
|
||||
return () => {
|
||||
window.__demoSelectionReady = false;
|
||||
};
|
||||
}, [areaStats, loadingAreaStats, selectedHexagon]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!window.__demoRecording) return;
|
||||
window.__demoOpenBestHexagon = () => {
|
||||
const best = mapData.data.reduce<(typeof mapData.data)[number] | null>((winner, item) => {
|
||||
if (!winner || item.count > winner.count) return item;
|
||||
return winner;
|
||||
}, null);
|
||||
if (!best) return null;
|
||||
handleHexagonClick(best.h3);
|
||||
return best.h3;
|
||||
};
|
||||
return () => {
|
||||
delete window.__demoOpenBestHexagon;
|
||||
};
|
||||
}, [handleHexagonClick, mapData.data]);
|
||||
|
||||
// Navigate to a specific postcode on mount (e.g. from saved properties)
|
||||
useEffect(() => {
|
||||
if (!initialPostcode) return;
|
||||
|
|
@ -1124,7 +1066,6 @@ export default function MapPage({
|
|||
onClose={handleCloseSelection}
|
||||
renderAreaPane={renderAreaPane}
|
||||
renderPropertiesPane={renderPropertiesPane}
|
||||
demoReady={Boolean(areaStats && !loadingAreaStats)}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue