diff --git a/client/pages/Dashboard.tsx b/client/pages/Dashboard.tsx index a8fffb6c..f3ef2e79 100644 --- a/client/pages/Dashboard.tsx +++ b/client/pages/Dashboard.tsx @@ -4,6 +4,7 @@ import Layout from "@/components/Layout"; import { Button } from "@/components/ui/button"; import { useAuth } from "@/contexts/AuthContext"; import { aethexToast } from "@/lib/aethex-toast"; +import { supabase } from "@/lib/supabase"; import { aethexProjectService, aethexAchievementService, @@ -60,6 +61,7 @@ export default function Dashboard() { const [isLoading, setIsLoading] = useState(true); const [projects, setProjects] = useState([]); const [achievements, setAchievements] = useState([]); + const [profileCompletion, setProfileCompletion] = useState(0); const [stats, setStats] = useState({ activeProjects: 0, completedTasks: 0, @@ -126,6 +128,18 @@ export default function Dashboard() { } }; + const computeProfileCompletion = (p: any) => { + const checks = [ + !!p?.full_name, + !!p?.bio, + !!p?.location, + !!p?.avatar_url, + !!(p?.website_url || p?.github_url || p?.linkedin_url || p?.twitter_url), + ]; + const pct = Math.round((checks.filter(Boolean).length / checks.length) * 100); + setProfileCompletion(pct); + }; + const loadDashboardData = async () => { try { setIsLoading(true); @@ -226,7 +240,7 @@ export default function Dashboard() { } // Show profile setup if no profile exists, but allow dashboard to continue - const showProfileSetup = !profile; + const showProfileSetup = !profile || profileCompletion < 80; const statsDisplay = [ { @@ -543,6 +557,24 @@ export default function Dashboard() { setLocationInput(e.target.value)} /> +