Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 98 additions & 99 deletions src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import DiscussionsWidget from "@/components/DiscussionsWidget";
import CommunityMetrics from "@/components/CommunityMetrics";
import GoalTracker from "@/components/GoalTracker";
import TodayFocusHero from "@/components/TodayFocusHero";
import DashboardHeader from "@/components/DashboardHeader";
import StreakTracker from "@/components/StreakTracker";
import TopRepos from "@/components/TopRepos";
Expand Down Expand Up @@ -101,136 +102,134 @@ export default async function DashboardPage() {
if (!session) redirect("/");
// If the JWT callback detected that the GitHub token has been revoked,
// redirect to the landing page so the user must re-authenticate.
const userName = session.user?.name ?? null;
if (session.error === "TokenRevoked") redirect("/");

return (
<DashboardSSEProvider>
<div className="min-h-screen bg-[var(--background)] p-4 text-[var(--foreground)] transition-colors md:p-8">
<DashboardHeader />
<div className="mb-6 flex justify-end items-center gap-2">
<Link
href="/wrapped"
className="rounded-lg border border-[var(--accent)] bg-[var(--accent-soft)] px-4 py-2 text-sm font-semibold text-[var(--accent)] hover:opacity-90 transition-opacity min-w-[140px] flex items-center justify-center"
>
Year in Code
</Link>
<Link
href="/dashboard/settings"
className="secondary-button flex min-w-[140px] items-center justify-center rounded-xl px-4 py-2 text-sm font-medium"
>
Settings
</Link>
<ExportButton />
</div>
<StreakAtRiskBanner />

<div className="mb-6 mt-6">
<Link href="/wrapped">
<div className="relative overflow-hidden rounded-xl bg-gradient-to-r from-purple-600 via-pink-600 to-fuchsia-600 p-6 shadow-lg transition-transform hover:scale-[1.01]">
<div className="relative z-10 flex items-center justify-between">
<div>
<h2 className="text-2xl font-bold text-white">Your Year in Code is here! ✨</h2>
<p className="mt-1 text-white/90">Discover your top languages, longest streaks, and coding habits of the year.</p>
</div>
<div className="rounded-full bg-white px-6 py-2 font-bold text-purple-600">
View Wrapped
</div>
<div className="mt-6 space-y-6">
<TodayFocusHero userName={userName} />

<div className="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-end">
<Link
href="/wrapped"
className="inline-flex w-full min-w-0 items-center justify-center rounded-lg border border-[var(--accent)] bg-[var(--accent-soft)] px-4 py-2 text-sm font-semibold text-[var(--accent)] transition-opacity hover:opacity-90 sm:w-auto sm:min-w-[140px]"
>
Year in Code
</Link>
<Link
href="/dashboard/settings"
className="secondary-button inline-flex w-full min-w-0 items-center justify-center rounded-xl px-4 py-2 text-sm font-medium sm:w-auto sm:min-w-[140px]"
>
Settings
</Link>
<div className="w-full sm:w-auto">
<ExportButton />
</div>
<div className="absolute -right-10 -top-10 h-40 w-40 rounded-full bg-white/20 blur-3xl"></div>
<div className="absolute -bottom-10 -left-10 h-40 w-40 rounded-full bg-black/20 blur-3xl"></div>
</div>
</Link>
</div>

<div className="mb-6">
<WeeklySummaryCard />
</div>
<StreakAtRiskBanner />

<div>
<Link href="/wrapped">
<div className="relative overflow-hidden rounded-xl bg-gradient-to-r from-purple-600 via-pink-600 to-fuchsia-600 p-5 shadow-lg transition-transform hover:scale-[1.01] sm:p-6">
<div className="relative z-10 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0">
<h2 className="text-xl font-bold text-white sm:text-2xl">Your Year in Code is here! ✨</h2>
<p className="mt-1 text-sm text-white/90 sm:text-base">Discover your top languages, longest streaks, and coding habits of the year.</p>
</div>
<div className="inline-flex w-full justify-center rounded-full bg-white px-5 py-2 font-bold text-purple-600 sm:w-auto sm:px-6">
View Wrapped
</div>
</div>
<div className="absolute -right-10 -top-10 h-40 w-40 rounded-full bg-white/20 blur-3xl"></div>
<div className="absolute -bottom-10 -left-10 h-40 w-40 rounded-full bg-black/20 blur-3xl"></div>
</div>
</Link>
</div>

<div className="mb-6">
<AIMentorWidget />
</div>
<WeeklySummaryCard />

<div className="mb-6">
<PersonalRecords />
</div>
<AIMentorWidget />

{/* Row 1: Contribution graph + Streak + Local Coding Time */}
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div className="lg:col-span-2">
<ContributionGraph />
<div className="mt-6">
<ContributionHeatmap />
<PersonalRecords />
{/* Row 1: Contribution graph + Streak + Local Coding Time */}
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
<div className="min-w-0 lg:col-span-2">
<ContributionGraph />
<div className="mt-6">
<ContributionHeatmap />
</div>
<div className="mt-6">
<FriendComparison />
</div>
</div>

<div className="min-w-0">
<StreakTracker />
<LocalCodingTime />
<div className="mt-6">
<CodingTimeWidget />
</div>
</div>
</div>
<div className="mt-6">
<FriendComparison />

{/* Row 2: PR metrics, community metrics, PR breakdown & Time Chart */}
<div className="mt-6 grid grid-cols-1 gap-6 md:grid-cols-2 xl:grid-cols-4">
<PRMetrics />
<CommunityMetrics />
<PRBreakdownChart />
<CommitTimeChart />
</div>
{/* Row 2b: Activity Ring Chart */}
<div className="mt-6">
<RepoAnalyticsExplorer />
<ActivityRingChart />
</div>
</div>

<div>
<StreakTracker />
<LocalCodingTime />
<div className="mt-6">
<CodingTimeWidget />
<CodingActivityInsightsCard />
</div>
</div>
</div>

{/* Row 2: PR metrics, community metrics, PR breakdown & Time Chart */}
<div className="mt-6 grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-6">
<PRMetrics />
<CommunityMetrics />
<PRBreakdownChart />
<CommitTimeChart />
</div>
{/* Row 2b: Activity Ring Chart */}
<div className="mt-6">
<ActivityRingChart />
</div>

<div className="mt-6">
<CodingActivityInsightsCard />
</div>

<div className="mt-6">
<PRReviewTrendChart />
</div>
<div className="mt-6">
<PRReviewTrendChart />
</div>

{/* Row 3: Issue metrics + CI analytics */}
<div className="mt-6 grid grid-cols-1 lg:grid-cols-3 gap-6">
<div className="lg:col-span-2">
<IssueMetrics />
</div>
<CIAnalytics />
</div>
<div className="mt-6 grid grid-cols-1 gap-6 lg:grid-cols-3">
<div className="min-w-0 lg:col-span-2">
<IssueMetrics />
</div>
<CIAnalytics />
</div>
{/* Row 3b: Discussion activity */}
<div className="mt-6">
<DiscussionsWidget />
</div>
<div className="mt-6">
<DiscussionsWidget />
</div>

{/* Row 4: Pinned repositories */}
<div className="mt-6">
<PinnedRepos />
</div>
<div className="mt-6">
<PinnedRepos />
</div>

{/* Row 5: Inactive repository reminder */}
<div className="mt-6">
<InactiveRepositoriesCard />
</div>
<div className="mt-6">
<InactiveRepositoriesCard />
</div>

{/* Row 6: Top repos + Language breakdown + Goal tracker */}
<div className="mt-6 grid grid-cols-1 lg:grid-cols-3 gap-6">
<TopRepos />
<LanguageBreakdown />
<GoalTracker />
</div>
<div className="mt-6 grid grid-cols-1 gap-6 lg:grid-cols-3">
<TopRepos />
<LanguageBreakdown />
<GoalTracker />
</div>

{/* Row 7: Recent GitHub activity */}
<div className="mt-6">
<RecentActivity />
</div>
<div className="mt-6">
<RecentActivity />
</div>
</div>
</div>
</DashboardSSEProvider>
);
Expand Down
Loading
Loading