feat: implement user profile page with statistics, contribution map, and activity timeline

- Add userService for profile and activity API calls
- Create UserProfilePage with tabbed interface (overview, reports, events, activity)
- Display user statistics (reports count, events count, impact score)
- Implement personal contribution map showing all user report locations
- Add activity timeline with different activity types
- Enable profile editing for own profile (first name, last name, username)
- Update UserProfile component to link to profile page
- Add /profile/:userId route to App
- Install react-leaflet for map integration
- Requirements: 6.3, 6.4, 6.5
This commit is contained in:
2025-11-16 21:13:26 +00:00
parent 5cbdb8f284
commit f02f23e185
10 changed files with 728 additions and 5 deletions

View File

@@ -14,6 +14,12 @@ export function UserProfile() {
navigate('/');
};
const handleViewProfile = () => {
if (user?.id) {
navigate(`/profile/${user.id}`);
}
};
if (!isLoaded) {
return (
<div className="flex items-center space-x-3">
@@ -30,7 +36,10 @@ export function UserProfile() {
return (
<div className="flex items-center space-x-4">
<div className="flex items-center space-x-3">
<button
onClick={handleViewProfile}
className="flex items-center space-x-3 hover:opacity-80 transition-opacity"
>
{user.imageUrl && (
<img
src={user.imageUrl}
@@ -38,7 +47,7 @@ export function UserProfile() {
className="h-10 w-10 rounded-full object-cover border-2 border-gray-200"
/>
)}
<div className="hidden md:block">
<div className="hidden md:block text-left">
<p className="text-sm font-medium text-gray-900">
{user.fullName || user.username || 'User'}
</p>
@@ -46,7 +55,7 @@ export function UserProfile() {
{user.primaryEmailAddress?.emailAddress}
</p>
</div>
</div>
</button>
<button
onClick={handleSignOut}
className="px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"