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
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"dompurify": "^3.1.6",
"driver.js": "^1.4.0",
"fflate": "^0.8.3",
"html-to-image": "^1.11.13",
"idb-keyval": "^6.2.4",
Expand Down
5 changes: 5 additions & 0 deletions src/components/GoalTracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ export function useGoalTracker() {
if (e) e.preventDefault();
setCreating(true);
setCreateError(null);
if (target <= 0) {
setCreateError("Target must be greater than 0.");
setCreating(false);
return;
}

try {
const result = await submitGoalWithRefresh({
Expand Down
80 changes: 80 additions & 0 deletions src/components/OnboardingTour.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"use client";

import { useEffect, useCallback } from "react";
import { driver } from "driver.js";
import "driver.js/dist/driver.css";

const TOUR_STEPS = [
{
element: "#widget-contribution-graph",
popover: {
title: "Contribution Graph",
description: "See your daily GitHub commit activity. Switch between 7, 14, 30, and 90 day views.",
},
},
{
element: "#widget-streak",
popover: {
title: "Streak Tracker",
description: "Your current commit streak — how many days in a row you've pushed code.",
},
},
{
element: "#widget-pr-metrics",
popover: {
title: "PR Analytics",
description: "Average review time, merge rate, and open vs closed pull request counts.",
},
},
{
element: "#widget-top-repos",
popover: {
title: "Top Repositories",
description: "Your most active repos ranked by commits. Click column headers to sort.",
},
},
{
element: "#widget-goals",
popover: {
title: "Weekly Goals",
description: "Set coding targets and track your progress automatically.",
},
},
];

async function markTourSeen() {
try {
await fetch("/api/user/settings", {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ seen_onboarding: true }),
});
} catch {
// silent fail — not critical
}
}

export default function OnboardingTour() {
const startTour = useCallback(() => {
const driverObj = driver({
showProgress: true,
animate: true,
allowClose: true,
steps: TOUR_STEPS,
onDestroyStarted: () => {
markTourSeen();
driverObj.destroy();
},
});

driverObj.drive();
}, []);

useEffect(() => {
if (typeof window !== "undefined" && window.navigator.webdriver) return;
const timer = setTimeout(startTour, 800);
return () => clearTimeout(timer);
}, [startTour]);

return null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE users ADD COLUMN IF NOT EXISTS seen_onboarding BOOLEAN DEFAULT FALSE;
Loading