import type { Meta, StoryObj } from "@storybook/react-vite";
import type { ReactNode } from "react";
import { AlertTriangle } from "lucide-react";
import { IssueBlockedNotice } from "@/components/IssueBlockedNotice";
import { KanbanBoard } from "@/components/KanbanBoard";
import { SuccessfulRunHandoffCommentCallout } from "@/components/IssueChatThread";
import { Identity } from "@/components/Identity";
import { cn, relativeTime } from "@/lib/utils";
import { formatIssueActivityAction } from "@/lib/activity-format";
import {
SUCCESSFUL_RUN_HANDOFF_ESCALATED_ACTION,
SUCCESSFUL_RUN_HANDOFF_REQUIRED_ACTION,
SUCCESSFUL_RUN_HANDOFF_RESOLVED_ACTION,
successfulRunHandoffActivityTone,
} from "@/lib/successful-run-handoff";
import { createIssue, storybookAgents } from "../fixtures/paperclipData";
function ActivityExample({ action }: { action: string }) {
const tone = successfulRunHandoffActivityTone(action);
const isWarning = action !== SUCCESSFUL_RUN_HANDOFF_RESOLVED_ACTION;
return (
{isWarning ?
: null}
{formatIssueActivityAction(action)}
{relativeTime(new Date(Date.now() - 3 * 60_000))}
);
}
function SuccessfulRunHandoffStates() {
return (
);
}
function handoffIssue() {
return createIssue({
id: "issue-handoff",
identifier: "PAP-3053",
issueNumber: 3053,
title: "Add board-visible handoff affordances and activity copy",
status: "in_progress",
priority: "medium",
assigneeAgentId: "agent-codex",
successfulRunHandoff: {
state: "required",
required: true,
sourceRunId: "9cdba892-c7ca-4d93-8604-4843873b127c",
correctiveRunId: "61fdb79b-8012-4676-ac71-2971830e126a",
assigneeAgentId: "agent-codex",
detectedProgressSummary: "Updated the plan and created the first implementation notes.",
createdAt: new Date(),
},
});
}
function StoryFrame({ children, title = "Board-visible handoff states" }: { children: ReactNode; title?: string }) {
return (
Successful-run next-step review
{title}
{children}
);
}
function PinnedNoticePanel() {
const issue = handoffIssue();
return (
A. Pinned needs-next-step notice
);
}
function ActivityEventsPanel() {
return (
B. Activity stream events
);
}
function IssueCardPanel() {
const issue = handoffIssue();
return (
C. Issue card indicator
{}}
/>
);
}
function EscalationCommentPanel() {
return (
D. Escalation comment callout
);
}
function SuccessfulRunHandoffPinnedNotice() {
return ;
}
function SuccessfulRunHandoffActivityEvents() {
return ;
}
function SuccessfulRunHandoffIssueCard() {
return ;
}
function SuccessfulRunHandoffEscalationComment() {
return ;
}
const meta = {
title: "Paperclip/Successful Run Handoff",
component: SuccessfulRunHandoffStates,
parameters: {
layout: "fullscreen",
},
} satisfies Meta;
export default meta;
type Story = StoryObj;
export const AllStates: Story = {};
export const PinnedNotice: Story = { render: () => };
export const ActivityEvents: Story = { render: () => };
export const IssueCardIndicator: Story = { render: () => };
export const EscalationComment: Story = { render: () => };