Skip to content

Commit 52e9004

Browse files
committed
feat(Maps): maps use full page by default
1 parent c3278ef commit 52e9004

File tree

4 files changed

+36
-59
lines changed

4 files changed

+36
-59
lines changed

admin/inertia/components/maps/MapComponent.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import maplibregl from 'maplibre-gl'
33
import 'maplibre-gl/dist/maplibre-gl.css'
44
import { Protocol } from 'pmtiles'
55
import { useEffect } from 'react'
6-
import { useWindowSize } from 'usehooks-ts'
76

87
export default function MapComponent() {
9-
const { width = 0, height = 0 } = useWindowSize()
108

119
// Add the PMTiles protocol to maplibre-gl
1210
useEffect(() => {
@@ -22,11 +20,8 @@ export default function MapComponent() {
2220
<Map
2321
reuseMaps
2422
style={{
25-
width: width,
26-
height: height - 175,
27-
borderRadius: '5px',
28-
boxShadow: '0 0 4px rgba(0,0,0,0.3)',
29-
backgroundColor: '#fff',
23+
width: '100%',
24+
height: '100vh',
3025
}}
3126
mapStyle={`http://${window.location.hostname}:${window.location.port}/api/maps/styles`}
3227
mapLib={maplibregl}
@@ -36,8 +31,8 @@ export default function MapComponent() {
3631
zoom: 3.5,
3732
}}
3833
>
39-
<NavigationControl />
40-
<FullscreenControl />
34+
<NavigationControl style={{ marginTop: '110px', marginRight: '36px' }} />
35+
<FullscreenControl style={{ marginTop: '30px', marginRight: '36px' }} />
4136
</Map>
4237
</MapProvider>
4338
)

admin/inertia/pages/maps.tsx

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,40 @@ export default function Maps(props: {
1818
return (
1919
<MapsLayout>
2020
<Head title="Maps" />
21-
<div className="flex border-b border-gray-900/10 p-4 justify-between">
22-
<Link href="/home" className="flex items-center">
23-
<IconArrowLeft className="mr-2" size={24} />
24-
<p className="text-lg text-gray-600">Back to Home</p>
25-
</Link>
26-
<Link href="/settings/maps">
27-
<StyledButton variant="primary" icon="IconSettings">
28-
Manage Map Regions
29-
</StyledButton>
30-
</Link>
31-
</div>
32-
<div className="w-full min-h-screen flex flex-col items-center justify-center py-4 mx-4">
21+
<div className="relative w-full h-screen overflow-hidden">
22+
{/* Nav and alerts are overlayed */}
23+
<div className="absolute top-0 left-0 right-0 z-50 flex justify-between p-4 bg-gray-50 backdrop-blur-sm shadow-sm">
24+
<Link href="/home" className="flex items-center">
25+
<IconArrowLeft className="mr-2" size={24} />
26+
<p className="text-lg text-gray-600">Back to Home</p>
27+
</Link>
28+
<Link href="/settings/maps" className='mr-4'>
29+
<StyledButton variant="primary" icon="IconSettings">
30+
Manage Map Regions
31+
</StyledButton>
32+
</Link>
33+
</div>
3334
{alertMessage && (
34-
<AlertWithButton
35-
title={alertMessage}
36-
type="warning"
37-
variant="solid"
38-
className="w-full !mb-4"
39-
buttonProps={{
40-
variant: 'secondary',
41-
children: 'Go to Map Settings',
42-
icon: 'IconSettings',
43-
onClick: () => {
44-
window.location.href = '/settings/maps'
45-
},
46-
}}
47-
/>
35+
<div className="absolute top-20 left-4 right-4 z-50">
36+
<AlertWithButton
37+
title={alertMessage}
38+
type="warning"
39+
variant="solid"
40+
className="w-full"
41+
buttonProps={{
42+
variant: 'secondary',
43+
children: 'Go to Map Settings',
44+
icon: 'IconSettings',
45+
onClick: () => {
46+
window.location.href = '/settings/maps'
47+
},
48+
}}
49+
/>
50+
</div>
4851
)}
49-
<MapComponent />
52+
<div className="absolute inset-0">
53+
<MapComponent />
54+
</div>
5055
</div>
5156
</MapsLayout>
5257
)

admin/package-lock.json

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admin/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@
119119
"tar": "^7.5.6",
120120
"tesseract.js": "^7.0.0",
121121
"url-join": "^5.0.0",
122-
"usehooks-ts": "^3.1.1",
123122
"yaml": "^2.8.0"
124123
},
125124
"hotHook": {

0 commit comments

Comments
 (0)