--- import BaseLayout from "../layouts/BaseLayout.astro"; import { Header } from "../components/layout/Header"; import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card"; import { Avatar, AvatarFallback, AvatarImage } from "../components/ui/avatar"; import { Button } from "../components/ui/button"; import { Badge } from "../components/ui/badge"; import { verifyToken } from "../lib/auth"; import { getDb } from "../lib/db"; import { eq, inArray } from "drizzle-orm"; import { stars, follows, cachedRepos, cachedUsers } from "../lib/db/schema"; import { Star, Users, GitFork, Server, ExternalLink, Compass, Sparkles, LogOut, BookOpen, UserCheck } from "lucide-react"; const token = Astro.cookies.get("community_session")?.value; if (!token) { return Astro.redirect("/auth/login"); } const user = await verifyToken(token); if (!user) { return Astro.redirect("/auth/login"); } const db = getDb() as any; // Fetch Starred Repos const starredRows = await db.query.stars.findMany({ where: eq(stars.userId, user.sub) }).catch(() => []); const starredRepoIds = starredRows.map((r: any) => r.repoId); let starredRepos: any[] = []; if (starredRepoIds.length > 0) { starredRepos = await db.query.cachedRepos.findMany({ where: inArray(cachedRepos.id, starredRepoIds), with: { instance: true } }).catch(() => []); } // Fetch Followed Users const followedRows = await db.query.follows.findMany({ where: eq(follows.followerId, user.sub) }).catch(() => []); const followedUsernames = followedRows.map((f: any) => f.followeeId); let followedProfiles: any[] = []; if (followedUsernames.length > 0) { followedProfiles = await db.query.cachedUsers.findMany({ where: inArray(cachedUsers.username, followedUsernames), with: { instance: true } }).catch(() => []); } ---
{user.username?.[0] || "U"}

Welcome back, @{user.username}

Your personalized dashboard across the federated OpenCodeHub network.

Starred Repositories ({starredRepos.length})

{starredRepos.length === 0 ? (

No starred repositories yet

Browse the community network to star projects you like.

) : ( starredRepos.map((repo: any) => (
{repo.fullName} {repo.instance?.name && ( {repo.instance.name} )}

{repo.description || "No description"}

{repo.starCount || 0}
)) )}

Following ({followedProfiles.length})

{followedProfiles.length === 0 ? (

Not following anyone yet

Follow developers across federated nodes to keep up with their public projects.

) : ( followedProfiles.map((profile: any) => (
{profile.username}
@{profile.username} {profile.instance?.name || "Federated Node"}
)) )}