Skip to content
Merged
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
9 changes: 8 additions & 1 deletion packages/admin-ui/src/status-badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const badgeVariants = cva(
variants: {
status: {
active: "bg-green-100 text-green-800",
coming_soon: "bg-amber-100 text-amber-800",
killed: "bg-red-100 text-red-800",
},
},
Expand All @@ -20,8 +21,14 @@ interface StatusBadgeProps extends VariantProps<typeof badgeVariants> {
className?: string;
}

const STATUS_LABELS: Record<string, string> = {
active: "Active",
coming_soon: "Coming Soon",
killed: "Killed",
};

export function StatusBadge({ status, className }: StatusBadgeProps) {
const label = status === "active" ? "Active" : "Killed";
const label = STATUS_LABELS[status ?? "active"] ?? "Killed";
return (
<span className={clsx(badgeVariants({ status }), className)}>
{label}
Expand Down
4 changes: 3 additions & 1 deletion src/app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default async function AdminDashboardPage() {
);

const activeCount = projects.filter((p) => p.status === "active").length;
const comingSoonCount = projects.filter((p) => p.status === "coming_soon").length;
const killedCount = projects.filter((p) => p.status === "killed").length;
const totalMmr = projects
.filter((p) => p.status === "active")
.reduce((sum, p) => sum + p.price_cents, 0);
Expand All @@ -42,7 +44,7 @@ export default async function AdminDashboardPage() {
<StatCard
title="Active Projects"
value={activeCount}
description={`${projects.length - activeCount} killed`}
description={`${comingSoonCount} coming soon, ${killedCount} killed`}
icon={TrendingUp}
/>
<StatCard
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/projects-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function ProjectsTable({ projects }: { projects: ProjectRow[] }) {
header: "Status",
sortable: true,
render: (item: ProjectRow) => (
<StatusBadge status={item.status as "active" | "killed"} />
<StatusBadge status={item.status as "active" | "coming_soon" | "killed"} />
),
},
{
Expand Down
12 changes: 11 additions & 1 deletion src/lib/admin/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
const GITHUB_API = "https://api.github.com";
const CREWCIRCLE_ORG = process.env.CC_GITHUB_USERNAME ?? "crewcircle";

/**
* Registry project IDs that don't match their actual GitHub repo name.
* The registry ID stays stable (used as a key across routes, costs, etc.);
* this only redirects the GitHub API lookup.
*/
const REPO_NAME_OVERRIDES: Record<string, string> = {
taxflowai: "taxflow-ai",
};

export interface GitHubRepo {
name: string;
full_name: string;
Expand Down Expand Up @@ -46,7 +55,8 @@ export async function getRepo(repoName: string): Promise<GitHubEnriched | null>
return null;
}

const url = `${GITHUB_API}/repos/${CREWCIRCLE_ORG}/${repoName}`;
const resolvedName = REPO_NAME_OVERRIDES[repoName] ?? repoName;
const url = `${GITHUB_API}/repos/${CREWCIRCLE_ORG}/${resolvedName}`;

const res = await fetch(url, {
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/admin/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface RegistryProject {
name: string;
description: string;
price_cents: number;
status: "active" | "killed";
status: "active" | "coming_soon" | "killed";
created_at: string;
killed_at?: string;
}
Expand Down
Loading