From d22f121ef3754020e69818a37d51dc6d8ec4a1b0 Mon Sep 17 00:00:00 2001 From: Rituja Sinha Date: Wed, 20 May 2026 20:13:07 +0530 Subject: [PATCH 1/2] feat: add getting started prompt for new users --- src/app/(app)/dashboard/page.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app/(app)/dashboard/page.tsx b/src/app/(app)/dashboard/page.tsx index e3be321a..1dc4c7c2 100644 --- a/src/app/(app)/dashboard/page.tsx +++ b/src/app/(app)/dashboard/page.tsx @@ -46,6 +46,7 @@ export default async function DashboardPage() { const xp = profile?.xp ?? 0; const level = profile?.level ?? 0; + const isNewUser = xp === 0 && (profile?.github_total_merges ?? 0) === 0; const { needed, next } = xpToNextLevel(xp); const nextLevel = next ?? level; @@ -148,6 +149,17 @@ export default async function DashboardPage() {
+ {isNewUser && ( +
+

Getting Started

+ +
    +
  • 1. Connect your GitHub
  • +
  • 2. Browse and claim an issue
  • +
  • 3. Submit a PR
  • +
+
+ )} {/* Header */}
From 78dd86c7af79a6adc976ca11666a8b80c3dd5d3c Mon Sep 17 00:00:00 2001 From: Ayush Patel Date: Sat, 30 May 2026 11:54:21 +0530 Subject: [PATCH 2/2] fix: rebase onto main dashboard, add isNewUser getting-started checklist --- src/app/(app)/dashboard/page.tsx | 152 +++++++++---------------------- 1 file changed, 41 insertions(+), 111 deletions(-) diff --git a/src/app/(app)/dashboard/page.tsx b/src/app/(app)/dashboard/page.tsx index b3552565..1652cade 100644 --- a/src/app/(app)/dashboard/page.tsx +++ b/src/app/(app)/dashboard/page.tsx @@ -36,122 +36,12 @@ export default async function DashboardPage() { .eq('id', user.id) .maybeSingle(); - const xp = profile?.xp ?? 0; - const level = profile?.level ?? 0; - const isNewUser = xp === 0 && (profile?.github_total_merges ?? 0) === 0; - const { needed, next } = xpToNextLevel(xp); - const nextLevel = next ?? level; - - // Read stats from Redis cache, fall back to profile data - const cacheKey = `gh:dashboard:${user.id}`; - let dashCache = await cacheGet(cacheKey); - - if (!dashCache) { - dashCache = { - merges: (profile?.github_total_merges as number | null) ?? null, - streak: (profile?.github_streak as number | null) ?? null, - syncedAt: (profile?.github_stats_synced_at as string | null) ?? null, - }; - await cacheSet(cacheKey, dashCache, 300); - } - - // Query pull_requests directly (populated by webhooks) - const { data: prsData } = await service - .from('pull_requests') - .select( - 'id, github_pr_id, repo_full_name, number, title, state, url, github_created_at, merged_at', - ) - .eq('author_user_id', user.id) - .order('github_created_at', { ascending: false }); - - const prs = (prsData ?? []) as GitHubPR[]; - - // Active Issues: claimed recommendations only - const { data: claimedRecs } = await service - .from('recommendations') - .select( - ` - id, - status, - xp_reward, - linked_pr_url, - difficulty, - issues ( - title, - repo_full_name, - url - ) - `, - ) - .eq('user_id', user.id) - .eq('status', 'claimed') - .limit(2); - - const claimedPrUrls = (claimedRecs ?? []) - .map((r: any) => r.linked_pr_url) - .filter(Boolean) as string[]; - - const recsResult = await getRecommendations(); - let recs: any[] = []; - if (isOk(recsResult)) { - recs = recsResult.data; - } - - // Mentor points - const { data: mentorEvents } = await service - .from('xp_events') - .select('xp_delta') - .eq('user_id', user.id) - .in('source', ['review', 'help_review']); - const mentorPoints = mentorEvents?.reduce((acc, e) => acc + (e.xp_delta || 0), 0) || 0; - - // Leaderboard - const { data: leaders } = await service - .from('profiles') - .select('github_handle, xp') - .order('xp', { ascending: false }) - .limit(4); - - // Mentees - const { data: menteesData } = await service - .from('help_requests') - .select('id, pr_url, status, user_id') - .eq('resolved_by', user.id) - .in('status', ['open', 'escalated']) - .limit(2); - - let enrichedMentees: any[] = []; - if (menteesData && menteesData.length > 0) { - const userIds = menteesData.map((m: any) => m.user_id); - const { data: menteeProfiles } = await service - .from('profiles') - .select('id, github_handle') - .in('id', userIds); - enrichedMentees = menteesData.map((m: any) => { - const p = menteeProfiles?.find((p) => p.id === m.user_id); - return { ...m, github_handle: p?.github_handle || 'Unknown' }; - }); - } - - const merges = dashCache.merges; - const streak = dashCache.streak; - const syncedAt = dashCache.syncedAt; + const isNewUser = (profile?.xp ?? 0) === 0 && (profile?.github_total_merges ?? 0) === 0; return (
- {isNewUser && ( -
-

Getting Started

- -
    -
  • 1. Connect your GitHub
  • -
  • 2. Browse and claim an issue
  • -
  • 3. Submit a PR
  • -
-
- )} {/* Header */}
@@ -172,6 +62,46 @@ export default async function DashboardPage() { + {/* Getting Started — shown only to new users with 0 XP and 0 merges */} + {isNewUser && ( +
+

Getting Started

+

+ Welcome! Here's how to earn your first XP on MergeShip. +

+
    +
  1. + + 1 + + + Connect your GitHub account via the{' '} + + settings page + + +
  2. +
  3. + + 2 + + + Browse and claim an issue from the{' '} + + Issues page + + +
  4. +
  5. + + 3 + + Submit a PR and get it merged to earn XP +
  6. +
+
+ )} + {/* Main Columns */}
{/* Left Column */}