diff --git a/src/features/marketer/ContentDrawer.tsx b/src/features/marketer/ContentDrawer.tsx new file mode 100644 index 00000000..042e5d3a --- /dev/null +++ b/src/features/marketer/ContentDrawer.tsx @@ -0,0 +1,131 @@ +import { useState } from "react"; +import { Pane } from "@/shared/ui/overlay/Pane"; +import { Chip } from "@/shared/ui/data/Chip"; +import { InlineError } from "@/shared/ui/feedback/InlineError"; +import { Button } from "@/shared/ui/controls/Button"; +import { TextField, TextArea, Field } from "@/shared/ui/controls/Field"; +import { SegmentedControl } from "@/shared/ui/controls/SegmentedControl"; +import { Stack } from "@/shared/ui/layout/Stack"; +import { Row } from "@/shared/ui/layout/Row"; +import { Box } from "@/shared/ui/layout/Box"; +import { Text } from "@/shared/ui/typography/Text"; +import { complianceViolations } from "./lib/compliance"; +import type { ContentItem, ContentStatus, ChannelKind } from "./lib/campaign"; + +const STATUS_TONE: Record = { + draft: "neutral", + approved: "info", + scheduled: "accent", + published: "success", +}; + +export interface ContentDrawerProps { + item: ContentItem | null; + onClose: () => void; + onPatch: (patch: Partial) => void; + onApprove: () => { ok: boolean }; + onSchedule: (whenIso: string) => void; + onPublish: () => void; + publishing?: boolean; +} + +/** The compose/approve/schedule/publish editor for one content item (#3148's loop). Shows the + * compliance guardrail violations (#3150) blocking approval, and the action available for the + * item's current status — never lets the user reach for an action the state machine forbids. */ +export function ContentDrawer({ item, onClose, onPatch, onApprove, onSchedule, onPublish, publishing }: ContentDrawerProps) { + const [scheduleAt, setScheduleAt] = useState(""); + const violations = item ? complianceViolations(item) : []; + const editable = item?.status === "draft"; + + return ( + + {item.status} + {item.channel} + + )} + body={item && ( + + {editable && ( + + ({ + label: k, on: item.channelKind === k, onClick: () => onPatch({ channelKind: k }), + }))} + /> + + )} + {item.channelKind === "email" && ( + onPatch({ subject: v })} disabled={!editable} /> + )} +