@ -174,16 +174,18 @@
: aria - busy = "loadingProfile || savingProfile"
> < / textarea >
< div class = "flex items-center mb-4" >
< input
v - model = "includeUserProfileLocation"
type = "checkbox"
class = "mr-2"
@ change = "onLocationCheckboxChange"
/ >
< label for = "includeUserProfileLocation" > Include Location < / label >
< span class = "text-xs text-slate-400 ml-2" > ( Debug : { { isMapReady ? 'Map Ready' : 'Map Loading' } } ) < / span >
< / div >
< div class = "flex items-center mb-4" >
< input
v - model = "includeUserProfileLocation"
type = "checkbox"
class = "mr-2"
@ change = "onLocationCheckboxChange"
/ >
< label for = "includeUserProfileLocation" > Include Location < / label >
< span class = "text-xs text-slate-400 ml-2"
> ( Debug : { { isMapReady ? "Map Ready" : "Map Loading" } } ) < / s p a n
>
< / div >
< div v-if ="includeUserProfileLocation" class="mb-4 aspect-video" >
< p class = "text-sm mb-2 text-slate-500" >
The location you choose will be shared with the world until you remove
@ -918,15 +920,18 @@ export default class AccountViewView extends Vue {
created ( ) {
this . notify = createNotifyHelpers ( this . $notify ) ;
/ / F i x L e a f l e t i c o n i s s u e s i n m o d e r n b u n d l e r s
/ / T h i s p r e v e n t s t h e " C a n n o t r e a d p r o p e r t i e s o f u n d e f i n e d ( r e a d i n g ' D e f a u l t ' ) " e r r o r
if ( L . Icon . Default ) {
delete ( L . Icon . Default . prototype as any ) . _getIconUrl ;
delete ( L . Icon . Default . prototype as { _getIconUrl ? : unknown } )
. _getIconUrl ;
L . Icon . Default . mergeOptions ( {
iconRetinaUrl : 'https://unpkg.com/leaflet@1.7.1/dist/images/marker-icon-2x.png' ,
iconUrl : 'https://unpkg.com/leaflet@1.7.1/dist/images/marker-icon.png' ,
shadowUrl : 'https://unpkg.com/leaflet@1.7.1/dist/images/marker-shadow.png' ,
iconRetinaUrl :
"https://unpkg.com/leaflet@1.7.1/dist/images/marker-icon-2x.png" ,
iconUrl : "https://unpkg.com/leaflet@1.7.1/dist/images/marker-icon.png" ,
shadowUrl :
"https://unpkg.com/leaflet@1.7.1/dist/images/marker-shadow.png" ,
} ) ;
}
}
@ -955,7 +960,7 @@ export default class AccountViewView extends Vue {
this . userProfileLatitude = profile . latitude ;
this . userProfileLongitude = profile . longitude ;
this . includeUserProfileLocation = profile . includeLocation ;
/ / I n i t i a l i z e m a p r e a d y s t a t e i f l o c a t i o n i s i n c l u d e d
if ( profile . includeLocation ) {
this . isMapReady = false ; / / W i l l b e s e t t o t r u e w h e n m a p i s r e a d y
@ -1543,12 +1548,18 @@ export default class AccountViewView extends Vue {
try {
logger . debug ( "Map ready event fired, map object:" , map ) ;
/ / d o i n g t h i s h e r e i n s t e a d o f o n t h e l - m a p e l e m e n t a v o i d s a r e c e n t e r i n g a f t e r a d r a g t h e n z o o m a t s t a r t u p
const zoom = this . userProfileLatitude && this . userProfileLongitude ? 12 : 2 ;
const zoom =
this . userProfileLatitude && this . userProfileLongitude ? 12 : 2 ;
const lat = this . userProfileLatitude || 0 ;
const lng = this . userProfileLongitude || 0 ;
map . setView ( [ lat , lng ] , zoom ) ;
this . isMapReady = true ;
logger . debug ( "Map ready state set to true, coordinates:" , [ lat , lng ] , "zoom:" , zoom ) ;
logger . debug (
"Map ready state set to true, coordinates:" ,
[ lat , lng ] ,
"zoom:" ,
zoom ,
) ;
} catch ( error ) {
logger . error ( "Error in onMapReady:" , error ) ;
this . isMapReady = true ; / / S e t t o t r u e e v e n o n e r r o r t o p r e v e n t i n f i n i t e l o a d i n g
@ -1560,7 +1571,7 @@ export default class AccountViewView extends Vue {
/ / C h e c k i f m a p r e f i s a v a i l a b l e
const mapRef = this . $refs . profileMap ;
logger . debug ( "Map ref:" , mapRef ) ;
/ / T r y t o s e t m a p r e a d y a f t e r c o m p o n e n t i s m o u n t e d
setTimeout ( ( ) => {
this . isMapReady = true ;
@ -1597,9 +1608,9 @@ export default class AccountViewView extends Vue {
longitude : this . userProfileLongitude ,
includeLocation : this . includeUserProfileLocation ,
} ;
logger . debug ( "Saving profile data:" , profileData ) ;
const success = await this . profileService . saveProfile (
this . activeDid ,
profileData ,
@ -1628,7 +1639,7 @@ export default class AccountViewView extends Vue {
this . userProfileLatitude = updated . latitude ;
this . userProfileLongitude = updated . longitude ;
this . includeUserProfileLocation = updated . includeLocation ;
/ / R e s e t m a p r e a d y s t a t e w h e n t o g g l i n g l o c a t i o n
if ( ! updated . includeLocation ) {
this . isMapReady = false ;
@ -1679,7 +1690,7 @@ export default class AccountViewView extends Vue {
}
} catch ( error ) {
logger . error ( "Error in deleteProfile component method:" , error ) ;
/ / S h o w m o r e s p e c i f i c e r r o r m e s s a g e i f a v a i l a b l e
if ( error instanceof Error ) {
this . notify . error ( error . message ) ;
@ -1710,7 +1721,10 @@ export default class AccountViewView extends Vue {
onLocationCheckboxChange ( ) : void {
try {
logger . debug ( "Location checkbox changed, new value:" , this . includeUserProfileLocation ) ;
logger . debug (
"Location checkbox changed, new value:" ,
this . includeUserProfileLocation ,
) ;
if ( ! this . includeUserProfileLocation ) {
/ / L o c a t i o n c h e c k b o x w a s u n c h e c k e d , c l e a n u p m a p s t a t e
this . isMapReady = false ;
@ -1721,7 +1735,7 @@ export default class AccountViewView extends Vue {
/ / L o c a t i o n c h e c k b o x w a s c h e c k e d , s t a r t m a p i n i t i a l i z a t i o n t i m e o u t
this . isMapReady = false ;
logger . debug ( "Location checked, starting map initialization timeout" ) ;
/ / T r y t o s e t m a p r e a d y a f t e r a s h o r t d e l a y t o a l l o w V u e t o r e n d e r
setTimeout ( ( ) => {
if ( ! this . isMapReady ) {
@ -1729,7 +1743,7 @@ export default class AccountViewView extends Vue {
this . isMapReady = true ;
}
} , 1000 ) ; / / 1 s e c o n d d e l a y
this . handleMapInitFailure ( ) ;
}
} catch ( error ) {