import { Suspense } from "hono/jsx/streaming";
import { getCodeActivity, type ActivitySeries, type CodeActivityData } from "../code-activity.ts";
import { getProfile } from "../data.ts";
import { PageNav } from "./page-nav.tsx";
function ActivityUnavailable({ source }: { source: string }) {
return (
{source} activity is temporarily unavailable.
);
}
function CalendarGraph({
activity,
source,
noun,
}: {
activity: ActivitySeries;
source: string;
noun: string;
}) {
const firstDay = activity.days[0]?.date;
const leadingDays = firstDay
? new Date(`${firstDay}T00:00:00Z`).getUTCDay()
: 0;
return (
);
}
// Layout-stable placeholder for a cold upstream pass. It reserves the same
// rows the populated sections occupy so the page does not reflow when the
// streamed content replaces it. It renders as inert text without JS.
function ActivitySkeleton({ label }: { label: string }) {
return (
{Array.from({ length: 28 }, (_, index) => (
))}
Loading…
);
}
function TangledSection({ activity }: { activity: CodeActivityData }) {
return (
<>
{activity.tangled ? (
) : (
)}
{activity.tangledPinned.length > 0 && (
Pinned repositories
Selected on Tangled
)}
{activity.tangledRecent.length > 0 && (
Recent commits in pinned repositories
Public Tangled activity
{activity.tangledRecent.map((commit) => (
{commit.subject}
{commit.repository.split("/").at(-1)}
{new Intl.DateTimeFormat("en", { month: "short", day: "numeric" }).format(new Date(commit.time))}
))}
)}
>
);
}
async function TangledActivity() {
const activity = await getCodeActivity();
return (
<>
{activity.tangled && (
{activity.tangled.total.toLocaleString("en-US")}
{" "}commits {activity.tangled.period}
)}
>
);
}
async function GithubActivity() {
const activity = await getCodeActivity();
return (
<>
{activity.github && (
{activity.github.total.toLocaleString("en-US")}
{" "}contributions {activity.github.period}
)}
{activity.github
?
: }
>
);
}
async function CodeNavigation() {
const profile = await getProfile();
return ;
}
export function CodeActivity() {
return (
}>
Live activity requires JavaScript. Use the Tangled and GitHub links to browse the source profiles.
);
}