Owner round 2 (2026-10-05), Slice F: - USER TEXT: the right-aligned bubble is gone. User messages are full-width document rows — muted 'You' label, muted quote rail, full-opacity text. Learner words are content, not a chat-app tell. - USER THINKING (everywhere): arrives COLLAPSED as a trigger row in the exact register of the agent's reasoning rows (muted label + chevron + hover affordance); expanding opens the quote block — rail, 50% opacity, italics. The inner-voice signature. The ThinkingBlock loses its shell/border: pure document material. - QUIZ CARDS: the answer's thinking is the SAME collapsible row, same placement, just inside the container; the explanation drops to 50% opacity (upright — italics stays the thinking signature). - AGENT'S THINKING: the duration bookkeeping is gone (it was live-turn state that died to 'a few seconds' on remount anyway) — the settled row reads static 'Agent's thinking', pairing with 'Your thinking'. Spinner + shimmer stay the working signal while streaming. - Glance law: user thinking = rail + 50% italic; agent thinking = no rail; user text = upright, full opacity, 'You' label.
113 lines
4.4 KiB
TypeScript
113 lines
4.4 KiB
TypeScript
"use client";
|
|
|
|
import { MessageResponse } from "@/components/ai-elements/message";
|
|
import type { ArtifactPartProps } from "@/src/core";
|
|
|
|
/**
|
|
* The practice transcript cards (practice sessions, owner design
|
|
* 2026-10-04): three quiet records in the stream —
|
|
*
|
|
* - ProblemCard — a posed problem: the statement, compact-expandable
|
|
* (like every card here; the dock is the working surface, this is the
|
|
* record). The commitment NEVER renders — only the call's statement.
|
|
* - ConcludeCard — the conclusion: outcome badge + verdict + the reveal
|
|
* (the committed solution, shown when the problem ended). A dismissal
|
|
* synthesis (outcome:"dismissed") renders as one muted line.
|
|
* - ThinkingCard — the learner's own submission, user-side: the register
|
|
* is the two buttons' (Nudge = working trace, Commit = answer). The
|
|
* UNIFIED ThinkingBlock (owner round 2026-10-05): the quiz quote-block
|
|
* language in a faint user-side shell, never collapsible.
|
|
*/
|
|
|
|
import { ThinkingBlock } from "@/components/thinking-block";
|
|
|
|
/** The practice-thinking marker's details (native-messages.ts). */
|
|
export interface PracticeThinkingData {
|
|
problemCallId: string;
|
|
commit: boolean;
|
|
text: string;
|
|
}
|
|
|
|
export function ProblemCard({ part }: ArtifactPartProps) {
|
|
// Always open, no chevron (owner round, 2026-10-05): the record IS the
|
|
// statement — same container + eyebrow discipline as the answered card
|
|
// and the dock (which mirrors this in Slice D). The commitment never
|
|
// renders — only the call's statement.
|
|
const input = (part.input ?? {}) as { statement?: string };
|
|
const statement = typeof input.statement === "string" ? input.statement : "";
|
|
return (
|
|
<div data-testid="problem-card" className="lh-card-enter my-1 rounded-xl border bg-card p-4">
|
|
<div className="mb-1 text-xs font-medium uppercase tracking-wide text-muted-foreground">Problem</div>
|
|
<div className="lh-prose text-[15px]">
|
|
<MessageResponse>{statement}</MessageResponse>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const OUTCOME_LABEL: Record<string, string> = {
|
|
solved: "Solved",
|
|
solvedWithHints: "Solved with hints",
|
|
movedOn: "Moved on",
|
|
surrendered: "Surrendered",
|
|
dismissed: "Dismissed",
|
|
};
|
|
|
|
export function ConcludeCard({ part }: ArtifactPartProps) {
|
|
// The conclusion redesigned (owner round, 2026-10-05): the SOLUTION is
|
|
// the hero — the modelSolution committed at pose time (part.reveal, the
|
|
// view-seam join), shown verbatim, never re-authored. The verdict sits
|
|
// below in the quiz-explanation register (small, muted, low-key).
|
|
// Nothing collapsible. Legacy inputs (pre-slim records) that carry
|
|
// their own solutionReveal fall back to it.
|
|
const input = (part.input ?? {}) as { outcome?: string; verdict?: string; solutionReveal?: string };
|
|
const outcome = typeof input.outcome === "string" ? input.outcome : "";
|
|
const verdict = typeof input.verdict === "string" ? input.verdict : "";
|
|
const reveal =
|
|
typeof part.reveal === "string" ? part.reveal : typeof input.solutionReveal === "string" ? input.solutionReveal : "";
|
|
|
|
// The dismissal synthesis: no verdict, no reveal — one muted line (the
|
|
// learner clicked; the record needs only the fact).
|
|
if (outcome === "dismissed") {
|
|
return (
|
|
<div data-testid="conclude-card" className="my-1 px-1 text-sm text-muted-foreground/70">
|
|
Problem dismissed.
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div data-testid="conclude-card" className="lh-card-enter my-1 rounded-xl border bg-card p-4">
|
|
<div className="mb-1 text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
|
{OUTCOME_LABEL[outcome] ?? "Concluded"}
|
|
</div>
|
|
{reveal.length > 0 && (
|
|
<div className="lh-prose text-[15px]">
|
|
<MessageResponse>{reveal}</MessageResponse>
|
|
</div>
|
|
)}
|
|
{verdict.length > 0 && (
|
|
<div className="mt-3 rounded-lg bg-muted py-2 text-sm text-muted-foreground">
|
|
<span className="font-medium text-foreground">Verdict: </span>
|
|
<MessageResponse className="inline [&_p]:inline [&_p]:m-0">{verdict}</MessageResponse>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function ThinkingCard({ data }: { data: PracticeThinkingData }) {
|
|
// The unified row (owner round, 2026-10-05): one style — collapsed
|
|
// arrival, 50%-italic quote block on expand. The register survives only
|
|
// in the label ("Your solution" when committed) and the data-commit
|
|
// flag for the tests.
|
|
return (
|
|
<ThinkingBlock
|
|
testId="thinking-card"
|
|
dataCommit={data.commit}
|
|
label={data.commit ? "Your solution" : "Your thinking"}
|
|
text={data.text}
|
|
/>
|
|
);
|
|
}
|