-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Implement user profile page and a comprehensive reputation sysem #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
0xdevcollins
merged 5 commits into
boundlessfi:main
from
Dprof-in-tech:feat-implement-profile-page
Feb 11, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e7ad534
feat: Implement user profile page and a comprehensive reputation syst…
Dprof-in-tech 55f5fa7
refactor: optimize mock completion history generation with `useMemo` …
Dprof-in-tech bf05010
feat: Improve profile page error handling with distinct 404 and gener…
Dprof-in-tech ec622d6
Merge branch 'main' into feat-implement-profile-page
Dprof-in-tech 430f270
fix: Default `reputation.stats.totalCompleted` to 0 when calculating …
Dprof-in-tech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -118,6 +118,7 @@ | |
| * { | ||
| @apply border-border outline-ring/50; | ||
| } | ||
|
|
||
| body { | ||
| @apply bg-background text-foreground; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| "use client"; | ||
|
|
||
| import { useContributorReputation } from "@/hooks/use-reputation"; | ||
| import { ReputationCard } from "@/components/reputation/reputation-card"; | ||
| import { CompletionHistory } from "@/components/reputation/completion-history"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { Skeleton } from "@/components/ui/skeleton"; | ||
| import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; | ||
| import { AlertCircle, ChevronLeft } from "lucide-react"; | ||
| import Link from "next/link"; | ||
| import { useParams } from "next/navigation"; | ||
| import { useMemo } from "react"; | ||
|
|
||
| export default function ProfilePage() { | ||
| const params = useParams(); | ||
| const userId = params.userId as string; | ||
| const { data: reputation, isLoading, error } = useContributorReputation(userId); | ||
|
|
||
| const MAX_MOCK_HISTORY = 50; | ||
|
|
||
| const mockHistory = useMemo(() => { | ||
| if (!reputation) return []; | ||
| const count = Math.min(reputation.stats.totalCompleted ?? 0, MAX_MOCK_HISTORY); | ||
| return Array(count).fill(null).map((_, i) => ({ | ||
| id: `bounty-${i}`, | ||
| bountyId: `b-${i}`, | ||
| bountyTitle: `Implemented feature #${100 + i}`, | ||
| projectName: "Drips Protocol", | ||
| projectLogoUrl: null, | ||
| difficulty: ["BEGINNER", "INTERMEDIATE", "ADVANCED"][i % 3] as "BEGINNER" | "INTERMEDIATE" | "ADVANCED", | ||
| rewardAmount: 500, | ||
| rewardCurrency: "USDC", | ||
| claimedAt: "2023-01-01T00:00:00Z", | ||
| completedAt: "2024-01-15T12:00:00Z", | ||
| completionTimeHours: 48, | ||
| maintainerRating: 5, | ||
| maintainerFeedback: "Great work!", | ||
| pointsEarned: 150 | ||
| })); | ||
| }, [reputation]); | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (isLoading) { | ||
| return ( | ||
| <div className="container mx-auto py-8"> | ||
| <Skeleton className="h-10 w-32 mb-8" /> | ||
| <div className="grid grid-cols-1 md:grid-cols-3 gap-8"> | ||
| <Skeleton className="h-[400px] md:col-span-1" /> | ||
| <Skeleton className="h-[400px] md:col-span-2" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| if (error) { | ||
| // Check if it's a 404 (Not Found) | ||
| const apiError = error as { status?: number; message?: string }; | ||
| const isNotFound = apiError?.status === 404 || apiError?.message?.includes("404"); | ||
|
|
||
| if (isNotFound) { | ||
| return ( | ||
| <div className="container mx-auto py-16 text-center"> | ||
| <AlertCircle className="w-12 h-12 mx-auto text-muted-foreground mb-4" /> | ||
| <h1 className="text-2xl font-bold mb-2">Profile Not Found</h1> | ||
| <p className="text-muted-foreground mb-6"> | ||
| We could not find a reputation profile for this user. | ||
| </p> | ||
| <Button asChild variant="outline"> | ||
| <Link href="/">Return Home</Link> | ||
| </Button> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| // Generic Error | ||
| return ( | ||
| <div className="container mx-auto py-16 text-center"> | ||
| <AlertCircle className="w-12 h-12 mx-auto text-destructive mb-4" /> | ||
| <h1 className="text-2xl font-bold mb-2">Something went wrong</h1> | ||
| <p className="text-muted-foreground mb-6"> | ||
| We encountered an error while loading the profile. | ||
| </p> | ||
| <Button variant="outline" onClick={() => window.location.reload()}> | ||
| Try Again | ||
| </Button> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| if (!reputation) { | ||
| return ( | ||
| <div className="container mx-auto py-16 text-center"> | ||
| <AlertCircle className="w-12 h-12 mx-auto text-muted-foreground mb-4" /> | ||
| <h1 className="text-2xl font-bold mb-2">Profile Not Found</h1> | ||
| <p className="text-muted-foreground mb-6"> | ||
| We could not find a reputation profile for this user. | ||
| </p> | ||
| <Button asChild variant="outline"> | ||
| <Link href="/">Return Home</Link> | ||
| </Button> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="container max-w-6xl mx-auto py-8 px-4"> | ||
| <Button asChild variant="ghost" size="sm" className="mb-6 -ml-2 text-muted-foreground"> | ||
| <Link href="/"> | ||
| <ChevronLeft className="w-4 h-4 mr-1" /> | ||
| Back to Home | ||
| </Link> | ||
| </Button> | ||
|
|
||
| <div className="grid grid-cols-1 lg:grid-cols-12 gap-8"> | ||
| {/* Left Sidebar: Reputation Card */} | ||
| <div className="lg:col-span-4 space-y-6"> | ||
| <ReputationCard reputation={reputation} /> | ||
|
|
||
| {/* Additional Sidebar Info could go here */} | ||
| </div> | ||
|
|
||
| {/* Main Content: Activity & History */} | ||
| <div className="lg:col-span-8"> | ||
| <Tabs defaultValue="history" className="w-full"> | ||
| <TabsList className="w-full justify-start border-b rounded-none h-auto p-0 bg-transparent"> | ||
| <TabsTrigger | ||
| value="history" | ||
| className="rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent px-4 py-3" | ||
| > | ||
| Bounty History | ||
| </TabsTrigger> | ||
| <TabsTrigger | ||
| value="analytics" | ||
| className="rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent px-4 py-3" | ||
| > | ||
| Analytics | ||
| </TabsTrigger> | ||
| </TabsList> | ||
|
|
||
| <TabsContent value="history" className="mt-6"> | ||
| <h2 className="text-xl font-bold mb-4">Activity History</h2> | ||
| <CompletionHistory | ||
| records={mockHistory} | ||
| description={`Showing the last ${mockHistory.length} completed bounties.`} | ||
| /> | ||
| </TabsContent> | ||
|
|
||
| <TabsContent value="analytics" className="mt-6"> | ||
| <div className="p-8 border rounded-lg text-center text-muted-foreground bg-secondary/5"> | ||
| Detailed analytics coming soon. | ||
| </div> | ||
| </TabsContent> | ||
| </Tabs> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { useContributorReputation } from "@/hooks/use-reputation"; | ||
| import { ReputationTooltip } from "@/components/reputation/reputation-tooltip"; | ||
| import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; | ||
| import { Skeleton } from "@/components/ui/skeleton"; | ||
| import Link from "next/link"; | ||
|
|
||
| interface ParticipantCardProps { | ||
| userId: string; | ||
| label?: string; | ||
| } | ||
|
|
||
| export function ParticipantCard({ userId, label }: ParticipantCardProps) { | ||
| const { data: reputation, isLoading } = useContributorReputation(userId); | ||
|
|
||
| if (isLoading) { | ||
| return ( | ||
| <div className="flex items-center gap-3"> | ||
| <Skeleton className="h-10 w-10 rounded-full" /> | ||
| <div className="space-y-1"> | ||
| <Skeleton className="h-4 w-24" /> | ||
| <Skeleton className="h-3 w-16" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| if (!reputation) { | ||
| return ( | ||
| <div className="flex items-center gap-3 opacity-70"> | ||
| <Avatar className="h-10 w-10"> | ||
| <AvatarFallback>?</AvatarFallback> | ||
| </Avatar> | ||
| <div className="text-sm"> | ||
| <div className="font-medium">Unknown User</div> | ||
| <div className="text-xs text-muted-foreground">ID: {userId}</div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="space-y-1"> | ||
| {label && <div className="text-xs font-medium text-muted-foreground">{label}</div>} | ||
| <ReputationTooltip reputation={reputation}> | ||
| <Link href={`/profile/${userId}`} className="flex items-center gap-3 group"> | ||
| <Avatar className="h-10 w-10 border border-border group-hover:border-primary transition-colors"> | ||
| <AvatarImage src={reputation.avatarUrl || undefined} /> | ||
| <AvatarFallback>{reputation.displayName?.[0] || "?"}</AvatarFallback> | ||
| </Avatar> | ||
| <div className="text-sm"> | ||
| <div className="font-bold group-hover:text-primary transition-colors"> | ||
| {reputation.displayName} | ||
| </div> | ||
| <div className="text-xs text-muted-foreground flex items-center gap-1"> | ||
| {reputation.tier} | ||
| <span className="w-1 h-1 rounded-full bg-muted-foreground/50" /> | ||
| {reputation.totalScore} pts | ||
| </div> | ||
| </div> | ||
| </Link> | ||
| </ReputationTooltip> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.