2
2
3
3
import 'leaflet/dist/leaflet.css' ;
4
4
import './MapCenter.css' ;
5
+ import Image from 'next/image' ;
5
6
6
7
import { useTranslations } from 'next-intl' ;
7
8
import { useState , useEffect , useContext , useRef } from 'react' ;
@@ -27,8 +28,8 @@ import logger from '../../../../logger.config.mjs';
27
28
// Define the crosshair icon for the center of the map
28
29
const crosshairIcon = new L . Icon ( {
29
30
iconUrl : '/images/icons/crosshair.png' ,
30
- iconSize : [ 80 , 80 ] ,
31
- iconAnchor : [ 40 , 40 ] ,
31
+ iconSize : [ 100 , 100 ] ,
32
+ iconAnchor : [ 60 , 60 ] ,
32
33
} ) ;
33
34
34
35
interface MapCenterProps {
@@ -45,6 +46,8 @@ const MapCenter = ({ entryType }: MapCenterProps) => {
45
46
const { currentUser, autoLoginUser } = useContext ( AppContext ) ;
46
47
const mapRef = useRef < L . Map | null > ( null ) ;
47
48
49
+ const isSigningInUser = false ;
50
+
48
51
useEffect ( ( ) => {
49
52
if ( ! currentUser ) {
50
53
logger . info ( "User not logged in; attempting auto-login.." ) ;
@@ -144,6 +147,10 @@ const MapCenter = ({ entryType }: MapCenterProps) => {
144
147
145
148
const bounds = L . latLngBounds ( L . latLng ( - 90 , - 180 ) , L . latLng ( 90 , 180 ) ) ;
146
149
150
+ const handleLocationButtonClick = ( ) => { // Temporary placeholders for handling errors
151
+ console . log ( 'Location Button Clicked' )
152
+ }
153
+
147
154
return (
148
155
< div className = "search-container" >
149
156
< p className = "search-text" >
@@ -175,24 +182,59 @@ const MapCenter = ({ entryType }: MapCenterProps) => {
175
182
< MapHandler />
176
183
< RecenterAutomatically position = { center } />
177
184
</ MapContainer >
178
- < div className = "absolute bottom-8 z-10 flex justify-center px-6 right-0 left-0 m-auto pointer-events-none" >
185
+
186
+ < div className = "absolute bottom-8 z-10 flex justify-start px-6 right-0 left-0 m-auto pointer-events-none" >
179
187
{ /* Add Set Map Center Button */ }
180
188
< div className = "pointer-events-auto" >
181
189
< Button
182
190
label = { entryType === 'sell'
183
191
? t ( 'SCREEN.SELLER_REGISTRATION.SELLER_SELL_CENTER' )
184
- : t ( 'SHARED.SEARCH_CENTER' )
185
- }
192
+ : t ( 'SHARED.SEARCH_CENTER' ) }
186
193
onClick = { setMapCenter }
187
194
styles = { {
188
- borderRadius : '10px' ,
189
195
color : '#ffc153' ,
190
- paddingLeft : '50px' ,
191
- paddingRight : '50px'
196
+ height : '50px' ,
197
+ padding : '20px' ,
198
+ fontSize : '22px' ,
192
199
} }
193
200
/>
194
201
</ div >
195
202
</ div >
203
+ < div className = "absolute bottom-8 z-10 flex justify-end px-6 right-0 left-0 m-auto pointer-events-none" >
204
+ { /* Find Me Button */ }
205
+ < div className = "pointer-events-auto" >
206
+ < Button
207
+ icon = {
208
+ < Image
209
+ src = "/images/shared/my_location.png"
210
+ width = { 40 }
211
+ height = { 40 }
212
+ alt = "my location"
213
+ />
214
+ }
215
+ styles = { {
216
+ borderRadius : '50%' ,
217
+ width : '55px' ,
218
+ height : '55px' ,
219
+ padding : '0px' ,
220
+ } }
221
+ onClick = { handleLocationButtonClick }
222
+ disabled = { isSigningInUser }
223
+ />
224
+ </ div >
225
+ </ div >
226
+ { /* Static Scope - should always be centered */ }
227
+ < div className = "absolute z-10 pointer-events-none top-[54.2%] left-[49.4%] transform -translate-x-1/2 -translate-y-1/2 w-20 h-20 sm:w-16 sm:h-16" >
228
+ < img
229
+ src = "/images/icons/scope.png"
230
+ alt = "Scope"
231
+ className = "w-full h-full"
232
+ style = { {
233
+ width : '65px' ,
234
+ height : '65px'
235
+ } }
236
+ />
237
+ </ div >
196
238
{ showPopup && (
197
239
< ConfirmDialogX
198
240
toggle = { ( ) => setShowPopup ( false ) }
0 commit comments