{user.first_name || user.username}'s Profile | AdventureLog
{#if user.profile_pic}
Profile
{:else}
{#if user.first_name && user.last_name} Profile {:else} Profile {/if}
{/if}
{#if user && user.first_name && user.last_name}

{user.first_name} {user.last_name}

{:else}

{user.username}

{/if}

@{user.username}

{#if user && user.date_joined}
{$t('profile.member_since')} {new Date(user.date_joined).toLocaleDateString(undefined, { timeZone: 'UTC', year: 'numeric', month: 'long' })}
{/if} {#if stats && stats.location_count > 0}
{achievementLevel}
{/if}
{#if stats}

{$t('profile.travel_statistics')}

{$t('profile.your_journey_at_a_glance')}

{$t('locations.locations')}
{stats.location_count}
{achievementLevel}
{$t('navbar.collections')}
{stats.trips_count}
{$t('profile.planned_trips')}
{$t('profile.visited_countries')}
{stats.visited_country_count}
{worldExplorationPercentage}% {$t('home.of_world')} {stats.visited_country_count}/{stats.total_countries}
{$t('profile.visited_regions')}
{stats.visited_region_count}
{regionExplorationPercentage}% {$t('profile.explored')} {stats.visited_region_count}/{stats.total_regions}
{$t('profile.visited_cities')}
{stats.visited_city_count}
{cityExplorationPercentage}% {$t('profile.discovered')} {stats.visited_city_count}/{stats.total_cities}
{#if stats.activities_overall && stats.activities_overall.total_count > 0}

{$t('adventures.activity_statistics')}

{$t('adventures.activity_statistics_description')}

{$t('adventures.total_activities')}
{stats.activities_overall.total_count}
{$t('adventures.recorded_sessions')}
{$t('adventures.total_distance')}
{getDistance(stats.activities_overall.total_distance)}
{$t('adventures.distance_covered')}
{$t('adventures.moving_time')}
{formatTime(stats.activities_overall.total_moving_time)}
{$t('adventures.active_duration')}
{$t('adventures.elevation_gain')}
{getElevation(stats.activities_overall.total_elevation_gain)}
{$t('adventures.total_climbed')}

{$t('adventures.activity_breakdown_by_category')}

{#each Object.entries(stats.activities_by_category) as [categoryKey, categoryData]} {@const config = categoryConfig[categoryKey]} {@const isExpanded = expandedCategories.has(categoryKey)}
toggleCategory(categoryKey)} on:keydown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleCategory(categoryKey); } }} >
{config.name}

{categoryData.count} {$t('adventures.activities_text')}

{getDistance(categoryData.total_distance)}
{getElevation(categoryData.total_elevation_gain)} {$t('adventures.elevation')}
{#if isExpanded}
Time
{formatTime(categoryData.total_moving_time)}
Avg Speed
{getSpeed(categoryData.avg_speed)}
Max Distance
{getDistance(categoryData.max_distance)}
{#if categoryData.total_calories > 0}
{$t('adventures.calories')}
{Math.round(categoryData.total_calories)}
{/if}
{#if Object.keys(categoryData.sports).length > 1}
Sport Types
{#each Object.entries(categoryData.sports) as [sportType, sportData]}
{sportType}
{sportData.count} {$t('adventures.activities_text')}
{getDistance(sportData.total_distance)}
{getElevation(sportData.total_elevation_gain)} elev
{/each}
{/if}
{/if}
{/each}
{/if}
{/if}

{$t('auth.user_locations')}

{$t('profile.public_location_experiences')}

{#if adventures && adventures.length > 0}
{adventures.length} {adventures.length === 1 ? $t('locations.location') : $t('locations.locations')}
{/if}
{#if adventures && adventures.length === 0}

{$t('auth.no_public_locations')}

{$t('profile.no_shared_adventures')}

{:else}
{#each adventures as adventure}
{/each}
{/if}

{$t('auth.user_collections')}

{$t('profile.planned_trips')}

{#if collections && collections.length > 0}
{collections.length} {collections.length === 1 ? $t('adventures.collection') : $t('navbar.collections')}
{/if}
{#if collections && collections.length === 0}

{$t('auth.no_public_collections')}

{$t('profile.no_shared_collections')}

{:else}
{#each collections as collection}
{/each}
{/if}