18d5f5bfc0
Piggy arrived as a chat panel bolted onto a CRM and then grew a workspace around it. The layout was already right — the audit found the approval card to be the best-designed object in the repo, and the account page's empty panels less finished than anything in the workspace. What was wrong was vocabulary: nobody had written the small things down, so both halves kept inventing them. Piggy was drawn with five different marks — a pig in the dock, a sparkle in the sidebar and again on the model picker, a speech bubble on the Ask buttons, and a stock robot glyph on every assistant message, which is the one people look at most. There is now one mark. The composer, which is the first control in the product since sign-in lands on /piggy, was the only un-adapted shadcn field left: 6px radius against a 12px Send button it sat 8px from. A stat tile had been reinvented six times at three numeral scales, and the same uppercase micro-label existed in five variants, two of them one tab apart in the same rail. There were 63 hand-written font sizes: not a scale, sixty-three opinions. Underneath that, the focus ring was invisible. The global rule used ring-accent, which Tailwind deliberately aliases onto the hover tint, so the ring measured 1.01:1 against the light canvas — no visible focus indicator anywhere in the product, for any accent, in either theme. It is ring-brand now and measures 17:1. The warning, positive and info tones were darkened until each clears 4.5:1 on a card, on inset and on its own chip, and the light canvas moved to 98% so a card lifts without leaning on its shadow. The mobile work is the part worth reading. A landscape phone gave the transcript 28% of the viewport and a keyboard-up phone 16%, against a 45% floor — and the fixed tab bar painted over the composer, covering the safety sentence and half the Send button, because two source comments asserted the bar stood down on short viewports and it never had. Both fixed and measured by hit-testing rather than by screenshot. The composer itself was 64px tall for a blank second line nobody typed, because the auto-resize effect sizes to scrollHeight and scrollHeight counts rows — a CSS height could not win against an inline style, so the attribute was the honest lever. Verified across both themes driven through the app's own control: no horizontal overflow on 15 routes at four viewports, 672 stat values that fit, 297 labels at exactly 11px/500, Escape returning focus to its opener rather than the body on every overlay, and a rejected write no longer reporting "Succeeded" with a green check. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
91 lines
3.9 KiB
TypeScript
91 lines
3.9 KiB
TypeScript
/**
|
|
* The platform track, as an ordered course.
|
|
*
|
|
* Product how-to has a running order — `sortOrder` is the curriculum, and
|
|
* "your first hour in PIG" is not interchangeable with the margin report. A
|
|
* grid of equal tiles says "pick one"; a numbered list says "start here", so
|
|
* the two tracks are rendered as different objects rather than one
|
|
* undifferentiated grid.
|
|
*/
|
|
import { ChevronRight } from 'lucide-react';
|
|
import { formatLearnDuration } from '@pig/core';
|
|
import { Badge, Card, Label } from '@/components/ui';
|
|
import { ArchiveControl } from './ArchiveControl';
|
|
import { learnPlayback } from './model';
|
|
import { LearnPoster } from './LearnPoster';
|
|
import { bySortOrder, type LearnResourceView } from './model';
|
|
|
|
export function LearnWalkthroughList({
|
|
resources,
|
|
managing,
|
|
onPlay,
|
|
}: {
|
|
resources: readonly LearnResourceView[];
|
|
managing: boolean;
|
|
onPlay: (resource: LearnResourceView) => void;
|
|
}) {
|
|
const ordered = bySortOrder(resources);
|
|
|
|
return (
|
|
/* Width is the caller's business — this list sits in a 1024px page column
|
|
for a code-holder and in a capped column inside the shell for a member,
|
|
and a cap here would fight one of them. */
|
|
<ol className="flex min-w-0 list-none flex-col gap-3">
|
|
{ordered.map((resource, index) => {
|
|
const playback = learnPlayback(resource);
|
|
return (
|
|
<li key={resource.id} className="min-w-0">
|
|
<Card className="group relative flex min-w-0 flex-col overflow-hidden transition-shadow duration-1 ease-enter hover:shadow-md sm:flex-row">
|
|
<button
|
|
type="button"
|
|
onClick={() => onPlay(resource)}
|
|
className="flex min-w-0 flex-1 items-center gap-3 p-3 text-left focus-visible:ring-inset focus-visible:ring-offset-0 sm:gap-4 sm:p-4"
|
|
>
|
|
<div className="w-28 shrink-0 overflow-hidden rounded-lg border border-border sm:w-44">
|
|
<LearnPoster
|
|
seed={resource.id}
|
|
track={resource.track}
|
|
duration={formatLearnDuration(resource.durationSeconds)}
|
|
// Only a PIG-hosted clip has a real frame; a Cap embed resolves to
|
|
// an iframe and falls back to the generated poster.
|
|
poster={playback?.kind === 'video' ? playback.poster : null}
|
|
alt={`Still from ${resource.title}`}
|
|
size="row"
|
|
/>
|
|
</div>
|
|
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
<Label className="nums">Step {index + 1}</Label>
|
|
<h3 className="min-w-0 break-words font-semibold leading-snug">
|
|
{resource.title}
|
|
</h3>
|
|
{resource.summary ? (
|
|
<p className="line-clamp-2 min-w-0 break-words text-sm leading-6 text-muted">
|
|
{resource.summary}
|
|
</p>
|
|
) : null}
|
|
</div>
|
|
<ChevronRight
|
|
className="hidden size-5 shrink-0 text-muted transition-transform group-hover:translate-x-0.5 sm:block"
|
|
aria-hidden
|
|
/>
|
|
</button>
|
|
|
|
{managing ? (
|
|
/* A right-hand rail on a desktop row, a strip underneath on a
|
|
phone — squeezed into 393px beside the text it left the title
|
|
wrapping one word to a line. */
|
|
<div className="flex min-w-0 shrink-0 flex-row items-center justify-between gap-2 border-t border-border p-2 sm:flex-col sm:items-end sm:justify-center sm:border-l sm:border-t-0">
|
|
<Badge tone={resource.visibility === 'code' ? 'accent' : 'neutral'}>
|
|
{resource.visibility === 'code' ? 'By code' : 'Members'}
|
|
</Badge>
|
|
<ArchiveControl id={resource.id} title={resource.title} />
|
|
</div>
|
|
) : null}
|
|
</Card>
|
|
</li>
|
|
);
|
|
})}
|
|
</ol>
|
|
);
|
|
}
|