|
|
@ -182,7 +182,6 @@ |
|
|
|
@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 v-if="includeUserProfileLocation" class="mb-4 aspect-video"> |
|
|
|
<p class="text-sm mb-2 text-slate-500"> |
|
|
@ -1541,14 +1540,12 @@ export default class AccountViewView extends Vue { |
|
|
|
|
|
|
|
onMapReady(map: L.Map): void { |
|
|
|
try { |
|
|
|
logger.debug("Map ready event fired, map object:", map); |
|
|
|
// doing this here instead of on the l-map element avoids a recentering after a drag then zoom at startup |
|
|
|
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); |
|
|
|
} catch (error) { |
|
|
|
logger.error("Error in onMapReady:", error); |
|
|
|
this.isMapReady = true; // Set to true even on error to prevent infinite loading |
|
|
@ -1556,27 +1553,18 @@ export default class AccountViewView extends Vue { |
|
|
|
} |
|
|
|
|
|
|
|
onMapMounted(): void { |
|
|
|
logger.debug("Map component mounted"); |
|
|
|
// Check if map ref is available |
|
|
|
const mapRef = this.$refs.profileMap; |
|
|
|
logger.debug("Map ref:", mapRef); |
|
|
|
|
|
|
|
// Try to set map ready after component is mounted |
|
|
|
setTimeout(() => { |
|
|
|
this.isMapReady = true; |
|
|
|
logger.debug("Map ready set to true after mounted"); |
|
|
|
}, 500); |
|
|
|
} |
|
|
|
|
|
|
|
// Fallback method to handle map initialization failures |
|
|
|
private handleMapInitFailure(): void { |
|
|
|
logger.debug("Starting map initialization timeout (5 seconds)"); |
|
|
|
setTimeout(() => { |
|
|
|
if (!this.isMapReady) { |
|
|
|
logger.warn("Map failed to initialize, forcing ready state"); |
|
|
|
this.isMapReady = true; |
|
|
|
} else { |
|
|
|
logger.debug("Map initialized successfully, timeout not needed"); |
|
|
|
} |
|
|
|
}, 5000); // 5 second timeout |
|
|
|
} |
|
|
@ -1598,8 +1586,6 @@ export default class AccountViewView extends Vue { |
|
|
|
includeLocation: this.includeUserProfileLocation, |
|
|
|
}; |
|
|
|
|
|
|
|
logger.debug("Saving profile data:", profileData); |
|
|
|
|
|
|
|
const success = await this.profileService.saveProfile( |
|
|
|
this.activeDid, |
|
|
|
profileData, |
|
|
@ -1664,7 +1650,6 @@ export default class AccountViewView extends Vue { |
|
|
|
|
|
|
|
async deleteProfile(): Promise<void> { |
|
|
|
try { |
|
|
|
logger.debug("Attempting to delete profile for DID:", this.activeDid); |
|
|
|
const success = await this.profileService.deleteProfile(this.activeDid); |
|
|
|
if (success) { |
|
|
|
this.notify.success(ACCOUNT_VIEW_CONSTANTS.SUCCESS.PROFILE_DELETED); |
|
|
@ -1673,7 +1658,6 @@ export default class AccountViewView extends Vue { |
|
|
|
this.userProfileLongitude = 0; |
|
|
|
this.includeUserProfileLocation = false; |
|
|
|
this.isMapReady = false; // Reset map state |
|
|
|
logger.debug("Profile deleted successfully, UI state reset"); |
|
|
|
} else { |
|
|
|
this.notify.error(ACCOUNT_VIEW_CONSTANTS.ERRORS.PROFILE_DELETE_ERROR); |
|
|
|
} |
|
|
@ -1710,22 +1694,18 @@ export default class AccountViewView extends Vue { |
|
|
|
|
|
|
|
onLocationCheckboxChange(): void { |
|
|
|
try { |
|
|
|
logger.debug("Location checkbox changed, new value:", this.includeUserProfileLocation); |
|
|
|
if (!this.includeUserProfileLocation) { |
|
|
|
// Location checkbox was unchecked, clean up map state |
|
|
|
this.isMapReady = false; |
|
|
|
this.userProfileLatitude = 0; |
|
|
|
this.userProfileLongitude = 0; |
|
|
|
logger.debug("Location unchecked, map state reset"); |
|
|
|
} else { |
|
|
|
// Location checkbox was checked, start map initialization timeout |
|
|
|
this.isMapReady = false; |
|
|
|
logger.debug("Location checked, starting map initialization timeout"); |
|
|
|
|
|
|
|
// Try to set map ready after a short delay to allow Vue to render |
|
|
|
setTimeout(() => { |
|
|
|
if (!this.isMapReady) { |
|
|
|
logger.debug("Setting map ready after timeout"); |
|
|
|
this.isMapReady = true; |
|
|
|
} |
|
|
|
}, 1000); // 1 second delay |
|
|
|