// API tokens on the account page: the person's tokens, and making one.
import { ActionForm, SubmitButton } from "@/components/forms";
import { Tag } from "@/components/status";
import { DateTime } from "@/components/time";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import type { TokenEntry, TokenList } from "@/lib/api";
import { revokeToken } from "./actions";
import { TokenForm } from "./token-form";
export function TokensCard({ data }: { data: TokenList }) {
const active = data.tokens.filter((t) => t.status === "active");
const past = data.tokens.filter((t) => t.status !== "active").slice(0, 10);
return (
Tokens act on what you manage: your products or a catalog's team. You don't manage anything yet.
{active.map((t) => (
)}
{data.scopes.length > 0 ? (
Revoked and expired
{past.map((t) => (
{t.grants.map((g, i) => ( {i > 0 && ", "} {g.permission} on {g.scope.type === "hub" ? "everything" : g.name} ))}
Made