videogen/apps/web/components/developer/IntegrationOverview.tsx
caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

162 lines
5.1 KiB
TypeScript

"use client";
import * as React from "react";
import {
BookOpen,
ExternalLink,
FileJson,
Gauge,
KeyRound,
Layers,
Webhook,
} from "lucide-react";
import type { DeveloperPortal } from "@/lib/types";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
import { CopyBox } from "@/components/apikeys/CopyBox";
import { formatCount } from "@/components/developer/format";
import type { DeveloperPortalStatus } from "@/lib/use-developer-portal";
interface IntegrationOverviewProps {
status: DeveloperPortalStatus;
portal: DeveloperPortal | null;
errorMessage: string;
}
/**
* The developer-portal overview: caller-scoped footprint tiles (keys, requests
* this month, webhook subscriptions, workspaces), the API base URL, and links to
* the interactive API reference + machine-readable OpenAPI schema. READ-only and
* secret-free.
*/
export function IntegrationOverview({
status,
portal,
errorMessage,
}: IntegrationOverviewProps) {
return (
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Layers className="size-5 text-primary" aria-hidden />
Integration overview
</CardTitle>
<CardDescription>
Your API footprint and the links you need to build against the
Menivor REST API.
</CardDescription>
</CardHeader>
<CardContent className="space-y-5">
{status === "error" ? (
<p className="text-sm text-destructive" role="alert">
{errorMessage || "Couldn't load your developer portal."}
</p>
) : status === "loading" || !portal ? (
<div className="grid gap-3 sm:grid-cols-4">
{Array.from({ length: 4 }).map((_, i) => (
<Skeleton key={i} className="h-20 w-full rounded-lg" />
))}
</div>
) : (
<>
<dl className="grid gap-3 sm:grid-cols-4">
<StatTile
icon={<KeyRound className="size-4" aria-hidden />}
label="Active API keys"
value={`${formatCount(portal.api_keys.active)} / ${formatCount(
portal.api_keys.total,
)}`}
/>
<StatTile
icon={<Gauge className="size-4" aria-hidden />}
label="Requests this month"
value={formatCount(portal.api_keys.requests_this_month)}
/>
<StatTile
icon={<Webhook className="size-4" aria-hidden />}
label="Webhook subscriptions"
value={`${formatCount(portal.webhooks.active)} / ${formatCount(
portal.webhooks.total,
)}`}
/>
<StatTile
icon={<Layers className="size-4" aria-hidden />}
label="Workspaces"
value={formatCount(portal.workspaces)}
/>
</dl>
<div className="space-y-1.5">
<p className="text-xs font-medium text-muted-foreground">
API base URL
{portal.api_version ? (
<Badge variant="outline" className="ml-2">
v{portal.api_version}
</Badge>
) : null}
</p>
<CopyBox
value={portal.api_base_url}
label="Copy API base URL"
/>
</div>
<div className="flex flex-wrap gap-2">
{portal.docs_url ? (
<Button asChild variant="outline" size="sm">
<a
href={portal.docs_url}
target="_blank"
rel="noreferrer noopener"
>
<BookOpen className="size-4" aria-hidden /> API reference
<ExternalLink className="size-3.5" aria-hidden />
</a>
</Button>
) : null}
{portal.openapi_url ? (
<Button asChild variant="outline" size="sm">
<a
href={portal.openapi_url}
target="_blank"
rel="noreferrer noopener"
>
<FileJson className="size-4" aria-hidden /> OpenAPI schema
<ExternalLink className="size-3.5" aria-hidden />
</a>
</Button>
) : null}
</div>
</>
)}
</CardContent>
</Card>
);
}
interface StatTileProps {
icon: React.ReactNode;
label: string;
value: string;
}
function StatTile({ icon, label, value }: StatTileProps) {
return (
<div className="rounded-lg border border-border bg-secondary/20 p-3">
<dt className="flex items-center gap-1.5 text-xs text-muted-foreground">
<span className="text-muted-foreground">{icon}</span>
{label}
</dt>
<dd className="mt-1 text-xl font-semibold tabular-nums">{value}</dd>
</div>
);
}