From 325e30d77c8afbd23e461d627ffd8680bc28daf0 Mon Sep 17 00:00:00 2001 From: Tadjaur Date: Sun, 25 Aug 2024 09:18:55 +0100 Subject: [PATCH] Fix map preview not loading --- packages/app/components/card/LargeCard.tsx | 7 ++----- packages/map/src/Map.native.tsx | 2 +- packages/map/src/Map.tsx | 2 +- packages/map/src/index.tsx | 1 + server/src/controllers/mapPreview/index.ts | 6 ++---- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/app/components/card/LargeCard.tsx b/packages/app/components/card/LargeCard.tsx index 822c979b5..1868503cf 100644 --- a/packages/app/components/card/LargeCard.tsx +++ b/packages/app/components/card/LargeCard.tsx @@ -126,13 +126,10 @@ const loadStyles = (theme: any) => { flexDirection: 'column', alignItems: 'center', textAlign: 'center', - padding: - Platform.OS === 'web' - ? currentTheme.size.cardPadding - : currentTheme.size.mobilePadding, + padding: Platform.OS === 'web' ? '5%' : currentTheme.size.mobilePadding, paddingHorizontal: currentTheme.padding.paddingInside, marginBottom: 20, - height: Platform.OS === 'web' ? 650 : '23%', + height: Platform.OS === 'web' ? 'calc(min( 80vh, 80vw))' : '23%', minHeight: 350, overflow: 'hidden', }, diff --git a/packages/map/src/Map.native.tsx b/packages/map/src/Map.native.tsx index 5f8aecd0f..a7ff393ad 100644 --- a/packages/map/src/Map.native.tsx +++ b/packages/map/src/Map.native.tsx @@ -32,7 +32,7 @@ import { import MapButtonsOverlay from './MapButtonsOverlay'; import { gpx as toGeoJSON } from '@tmcw/togeojson'; -import { useNativeMap } from 'app/hooks/map/useNativeMap'; +import { useNativeMap } from './hooks/useNativeMap'; import * as DocumentPicker from 'expo-document-picker'; import * as FileSystem from 'expo-file-system'; import { DOMParser } from 'xmldom'; diff --git a/packages/map/src/Map.tsx b/packages/map/src/Map.tsx index 1dba4ff63..a06d7e25e 100644 --- a/packages/map/src/Map.tsx +++ b/packages/map/src/Map.tsx @@ -32,7 +32,7 @@ const WebMap: FC = ({ shape: shapeProp }) => { const handleGpxUpload = useGpxUpload(setShape); const element = ( - + {showModal || isPolygonOrMultiPolygon(shape) ? ( = ({ { } const newResponse = new Response(response.body, { + status: 200, headers: { 'Content-Type': 'image/png', }, }); - console.log('newResponse', newResponse); - - // return newResponse; - return ctx.json(newResponse, 200); + return newResponse; } catch (error) { console.log(error); return ctx.json({ error: error.message }, 400);