@atelic-action/artifact 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -2
- package/package.json +71 -5
- package/src/documents/Gate.tsx +342 -0
- package/src/documents/Note.tsx +158 -0
- package/src/documents/Paragraph.tsx +65 -0
- package/src/documents/Read.tsx +411 -0
- package/src/documents/Report.tsx +135 -0
- package/src/documents/Shot.tsx +38 -0
- package/src/documents/Writeup.tsx +771 -0
- package/src/documents/documents.css +2480 -0
- package/src/documents/index.ts +11 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { SignOff, type WriteupPerson } from "@atelic-action/ui/artifact";
|
|
2
|
+
import { Callout } from "@atelic-action/ui/components";
|
|
3
|
+
import {
|
|
4
|
+
type ArtifactLink,
|
|
5
|
+
type ArtifactParagraph,
|
|
6
|
+
isEmpty,
|
|
7
|
+
ArtifactAnchor as NoteAnchor,
|
|
8
|
+
Paragraph,
|
|
9
|
+
} from "./Paragraph";
|
|
10
|
+
import { Shot, type WriteupShot } from "./Shot";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The note: the first touch, for a business whose site publishes no email
|
|
14
|
+
* address, written as a short page and left at `<short>.atelic.me/notes`. It
|
|
15
|
+
* is the first touch email set as a document, so it carries no grades, no
|
|
16
|
+
* sections, and no tables: a title, the opener, what the customer sees and
|
|
17
|
+
* what sits under the hood, where the work would start, and the close. It
|
|
18
|
+
* reads on a phone first and prints to one letter sheet.
|
|
19
|
+
*
|
|
20
|
+
* It is the writeup's sibling, not a variant of it: a site wraps it in
|
|
21
|
+
* ArtifactShell exactly as it wraps the writeup, and it reuses the writeup's
|
|
22
|
+
* pieces where they fit (the Callout a finding is set in, the owner's screen,
|
|
23
|
+
* the sign off). Every prop is plain data, so a routine can write a note as
|
|
24
|
+
* JSON; the one exception is the sign off person's `role`, which takes a node
|
|
25
|
+
* and is equally happy with a string.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** A link inside running text: the words the reader clicks and where they go. */
|
|
29
|
+
export type NoteLink = ArtifactLink;
|
|
30
|
+
|
|
31
|
+
/** A paragraph: a plain string, or runs of text and links in order. */
|
|
32
|
+
export type NoteParagraph = ArtifactParagraph;
|
|
33
|
+
|
|
34
|
+
/** One defect and what it costs, with the owner's screen under it when there is one. */
|
|
35
|
+
export interface NoteFinding {
|
|
36
|
+
/** The defect, in a full sentence. */
|
|
37
|
+
lead: string;
|
|
38
|
+
/** The consequence: what it costs the business. */
|
|
39
|
+
body: string;
|
|
40
|
+
/**
|
|
41
|
+
* Where the defect can be seen for oneself. The lead links there: in a new
|
|
42
|
+
* tab for an http(s) link, in place otherwise.
|
|
43
|
+
*/
|
|
44
|
+
href?: string;
|
|
45
|
+
/** The owner's own screen, rendered under the finding. */
|
|
46
|
+
shot?: WriteupShot;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** One side of the read, e.g. "What your customer sees", with one or two findings. */
|
|
50
|
+
export interface NoteLane {
|
|
51
|
+
heading: string;
|
|
52
|
+
findings: NoteFinding[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** One place the work would start. */
|
|
56
|
+
export interface NoteStep {
|
|
57
|
+
/** The step, set in bold. */
|
|
58
|
+
lead: string;
|
|
59
|
+
/** What it does, after the lead. */
|
|
60
|
+
body?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Where the work would start: the line that introduces it, then the steps. */
|
|
64
|
+
export interface NoteStart {
|
|
65
|
+
/** The line over the steps, e.g. "I would start by:". */
|
|
66
|
+
lead: string;
|
|
67
|
+
items: NoteStep[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The close: who is writing and the offer, then the sign off. */
|
|
71
|
+
export interface NoteClose {
|
|
72
|
+
/** The sender paragraph, then the offer line with its scheduling link and the exit sentence. */
|
|
73
|
+
paragraphs: NoteParagraph[];
|
|
74
|
+
signOff: string;
|
|
75
|
+
person: WriteupPerson;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface NoteProps {
|
|
79
|
+
title: string;
|
|
80
|
+
/** The business, set in the dateline: "Prepared for <business>, <date>". */
|
|
81
|
+
preparedFor: string;
|
|
82
|
+
/** The ISO date, e.g. "2026-10-09". */
|
|
83
|
+
date: string;
|
|
84
|
+
/** The street sighting and a kudos, then the gap sentence. */
|
|
85
|
+
opener: NoteParagraph;
|
|
86
|
+
/** "What your customer sees" and "What I see under the hood", in that order. */
|
|
87
|
+
lanes: NoteLane[];
|
|
88
|
+
start: NoteStart;
|
|
89
|
+
close: NoteClose;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function Finding({ finding }: { finding: NoteFinding }) {
|
|
93
|
+
return (
|
|
94
|
+
<li className={finding.shot ? "nt-finding has-shot" : "nt-finding"}>
|
|
95
|
+
<Callout
|
|
96
|
+
tone="warn"
|
|
97
|
+
title={
|
|
98
|
+
finding.href ? <NoteAnchor href={finding.href}>{finding.lead}</NoteAnchor> : finding.lead
|
|
99
|
+
}
|
|
100
|
+
>
|
|
101
|
+
{finding.body}
|
|
102
|
+
</Callout>
|
|
103
|
+
{finding.shot && <Shot shot={finding.shot} />}
|
|
104
|
+
</li>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function Note({ title, preparedFor, date, opener, lanes, start, close }: NoteProps) {
|
|
109
|
+
const shownLanes = lanes.filter((lane) => lane.findings.length > 0);
|
|
110
|
+
const paragraphs = close.paragraphs.filter((paragraph) => !isEmpty(paragraph));
|
|
111
|
+
return (
|
|
112
|
+
<div className="nt">
|
|
113
|
+
<article className="nt-doc">
|
|
114
|
+
<header className="nt-head">
|
|
115
|
+
<p className="nt-meta">
|
|
116
|
+
Prepared for <b>{preparedFor}</b>, <span className="nt-meta-date">{date}</span>
|
|
117
|
+
</p>
|
|
118
|
+
<h1>{title}</h1>
|
|
119
|
+
</header>
|
|
120
|
+
{!isEmpty(opener) && <Paragraph paragraph={opener} className="nt-opener" />}
|
|
121
|
+
{shownLanes.length > 0 && (
|
|
122
|
+
<div className="nt-lanes">
|
|
123
|
+
{shownLanes.map((lane) => (
|
|
124
|
+
<section className="nt-lane" key={lane.heading}>
|
|
125
|
+
<h2>{lane.heading}</h2>
|
|
126
|
+
<ul className="nt-findings">
|
|
127
|
+
{lane.findings.map((finding) => (
|
|
128
|
+
<Finding finding={finding} key={finding.lead} />
|
|
129
|
+
))}
|
|
130
|
+
</ul>
|
|
131
|
+
</section>
|
|
132
|
+
))}
|
|
133
|
+
</div>
|
|
134
|
+
)}
|
|
135
|
+
{start.items.length > 0 && (
|
|
136
|
+
<section className="nt-start">
|
|
137
|
+
<p className="nt-start-lead">{start.lead}</p>
|
|
138
|
+
<ul>
|
|
139
|
+
{start.items.map((step) => (
|
|
140
|
+
<li key={step.lead}>
|
|
141
|
+
<b>{step.lead}</b>
|
|
142
|
+
{step.body && <> {step.body}</>}
|
|
143
|
+
</li>
|
|
144
|
+
))}
|
|
145
|
+
</ul>
|
|
146
|
+
</section>
|
|
147
|
+
)}
|
|
148
|
+
<footer className="nt-close">
|
|
149
|
+
{paragraphs.map((paragraph, i) => (
|
|
150
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: paragraphs are static content in a fixed order
|
|
151
|
+
<Paragraph paragraph={paragraph} key={i} />
|
|
152
|
+
))}
|
|
153
|
+
<SignOff signOff={close.signOff} person={close.person} />
|
|
154
|
+
</footer>
|
|
155
|
+
</article>
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { newTabProps } from "@atelic-action/ui/artifact";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plain data text for the documents a routine can write as JSON (the note
|
|
5
|
+
* and the read): a paragraph is a string, or runs of text and links in
|
|
6
|
+
* order. A link opens in a new tab when it leaves the page, and in place
|
|
7
|
+
* when it is an anchor or a mail link.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** A link inside running text: the words the reader clicks and where they go. */
|
|
11
|
+
export interface ArtifactLink {
|
|
12
|
+
text: string;
|
|
13
|
+
href: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** A paragraph: a plain string, or runs of text and links in order. */
|
|
17
|
+
export type ArtifactParagraph = string | Array<string | ArtifactLink>;
|
|
18
|
+
|
|
19
|
+
/** A link opens in a new tab when it leaves the page, and in place when it is an anchor or a mail link. */
|
|
20
|
+
export function ArtifactAnchor({ href, children }: { href: string; children: string }) {
|
|
21
|
+
return (
|
|
22
|
+
<a href={href} {...newTabProps(href, /^https?:/i.test(href))}>
|
|
23
|
+
{children}
|
|
24
|
+
</a>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A paragraph with nothing to read: a blank string, or runs that are all blank strings. A link always counts. */
|
|
29
|
+
export function isEmpty(paragraph: ArtifactParagraph): boolean {
|
|
30
|
+
const runs = typeof paragraph === "string" ? [paragraph] : paragraph;
|
|
31
|
+
return runs.every((run) => typeof run === "string" && run.trim() === "");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The runs alone, for a container that is not a paragraph (a list item, a table cell). */
|
|
35
|
+
export function Runs({ paragraph }: { paragraph: ArtifactParagraph }) {
|
|
36
|
+
const runs = typeof paragraph === "string" ? [paragraph] : paragraph;
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
{runs.map((run, i) =>
|
|
40
|
+
typeof run === "string" ? (
|
|
41
|
+
run
|
|
42
|
+
) : (
|
|
43
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: runs are static content in a fixed order
|
|
44
|
+
<ArtifactAnchor href={run.href} key={i}>
|
|
45
|
+
{run.text}
|
|
46
|
+
</ArtifactAnchor>
|
|
47
|
+
),
|
|
48
|
+
)}
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function Paragraph({
|
|
54
|
+
paragraph,
|
|
55
|
+
className,
|
|
56
|
+
}: {
|
|
57
|
+
paragraph: ArtifactParagraph;
|
|
58
|
+
className?: string;
|
|
59
|
+
}) {
|
|
60
|
+
return (
|
|
61
|
+
<p className={className}>
|
|
62
|
+
<Runs paragraph={paragraph} />
|
|
63
|
+
</p>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GradeChip,
|
|
3
|
+
gradeLabel,
|
|
4
|
+
newTabProps,
|
|
5
|
+
SignOff,
|
|
6
|
+
type WriteupGrade,
|
|
7
|
+
type WriteupPerson,
|
|
8
|
+
} from "@atelic-action/ui/artifact";
|
|
9
|
+
import { ArrowUpRight } from "lucide-react";
|
|
10
|
+
import { type ArtifactLink, type ArtifactParagraph, isEmpty, Paragraph, Runs } from "./Paragraph";
|
|
11
|
+
import { Shot, type WriteupShot } from "./Shot";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The read: what a customer gets at the end of an engagement's first week,
|
|
15
|
+
* before anything changes. Where the writeup says what letter each section
|
|
16
|
+
* earned, the read says why, and what changes. Its shape is the practice's
|
|
17
|
+
* FOOTPRINT.md, under What the Owner Gets: a title and a dated lede; the gist
|
|
18
|
+
* table (every section, its grade, and one line); then the tiers, each
|
|
19
|
+
* section a question in three beats (what we found, why, what changes) with
|
|
20
|
+
* any proof pictures and the tools it was read from; then the plan, in order;
|
|
21
|
+
* then one closing line and the sign off.
|
|
22
|
+
*
|
|
23
|
+
* It is the writeup's sibling, not a variant: it wears the writeup's column,
|
|
24
|
+
* head, grade chip and key, tier heading, section card, screen, sources, and
|
|
25
|
+
* close (the `.op` classes), and adds only what is its own (the `.rd`
|
|
26
|
+
* classes). The gist table is drawn from the tiers, so a tier added later
|
|
27
|
+
* (Conversion, once the analytics access lands) is one more entry in `tiers`
|
|
28
|
+
* and appears in the table and the body alike, with no change to the props.
|
|
29
|
+
* Every prop is plain data, so a routine can write a read as JSON; the one
|
|
30
|
+
* exception is the sign off person's `role`, which takes a node and is
|
|
31
|
+
* equally happy with a string.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/** A link inside running text: the words the reader clicks and where they go. */
|
|
35
|
+
export type ReadLink = ArtifactLink;
|
|
36
|
+
|
|
37
|
+
/** A paragraph: a plain string, or runs of text and links in order. */
|
|
38
|
+
export type ReadParagraph = ArtifactParagraph;
|
|
39
|
+
|
|
40
|
+
/** A place a reading came from: the tool, opened in a new tab when it has an address. */
|
|
41
|
+
export interface ReadSource {
|
|
42
|
+
label: string;
|
|
43
|
+
href?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** One section of a tier: a question in three beats. */
|
|
47
|
+
export interface ReadSection {
|
|
48
|
+
/** The anchor the gist table links to, e.g. "technical-seo". */
|
|
49
|
+
id: string;
|
|
50
|
+
/** The section's trade name, e.g. "Technical SEO": the gist table's Section column, and the line over the question. */
|
|
51
|
+
name: string;
|
|
52
|
+
/** The question the section answers, in the owner's words, e.g. "Can Google read the site?". The section's heading. */
|
|
53
|
+
question: string;
|
|
54
|
+
/** The baseline's grade. Omit for a section not yet graded; the table shows a quiet dash. */
|
|
55
|
+
grade?: WriteupGrade;
|
|
56
|
+
/** The one line in the gist table. */
|
|
57
|
+
gist: ReadParagraph;
|
|
58
|
+
/** What we found: one paragraph or more. */
|
|
59
|
+
found: ReadParagraph[];
|
|
60
|
+
/** A few concrete examples of what was found, as a short list under it. */
|
|
61
|
+
examples?: ReadParagraph[];
|
|
62
|
+
/** Proof pictures, each over its caption, e.g. a search result capture per market. */
|
|
63
|
+
shots?: WriteupShot[];
|
|
64
|
+
/** Why, in one sentence, set apart. */
|
|
65
|
+
why: ReadParagraph;
|
|
66
|
+
/** What changes: one paragraph or more. */
|
|
67
|
+
changes: ReadParagraph[];
|
|
68
|
+
/** The tools the readings came from, linked, so the owner can open them. */
|
|
69
|
+
sources?: ReadSource[];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A tier, e.g. Health: its heading, the question it answers, and its sections in order. */
|
|
73
|
+
export interface ReadTier {
|
|
74
|
+
/** The anchor a header stop points at, e.g. "health". */
|
|
75
|
+
id?: string;
|
|
76
|
+
/** The tier's name, e.g. "Health". */
|
|
77
|
+
title: string;
|
|
78
|
+
/** The question the tier answers, in the owner's words. */
|
|
79
|
+
lead?: string;
|
|
80
|
+
sections: ReadSection[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** One step of the plan: a bold title and a sentence or two. */
|
|
84
|
+
export interface ReadStep {
|
|
85
|
+
title: string;
|
|
86
|
+
body?: ReadParagraph;
|
|
87
|
+
/** Whose step it is when it is not the practice's, e.g. "Yours" or a name; set beside the title. */
|
|
88
|
+
who?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The plan: the steps in order, numbered. */
|
|
92
|
+
export interface ReadPlan {
|
|
93
|
+
/** The anchor a header stop points at, e.g. "plan". */
|
|
94
|
+
id?: string;
|
|
95
|
+
/** The heading; defaults to the `plan` label. */
|
|
96
|
+
title?: string;
|
|
97
|
+
/** A line over the steps. */
|
|
98
|
+
lead?: ReadParagraph;
|
|
99
|
+
steps: ReadStep[];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The close: one line, then the sign off. */
|
|
103
|
+
export interface ReadClose {
|
|
104
|
+
/** One sentence, e.g. what follows and when. */
|
|
105
|
+
line: ReadParagraph;
|
|
106
|
+
signOff?: string;
|
|
107
|
+
person?: WriteupPerson;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The fixed words the page sets, each overridable. */
|
|
111
|
+
export interface ReadLabels {
|
|
112
|
+
/** The gist table's first column. */
|
|
113
|
+
section: string;
|
|
114
|
+
/** The gist table's second column. */
|
|
115
|
+
grade: string;
|
|
116
|
+
/** The gist table's third column. */
|
|
117
|
+
gist: string;
|
|
118
|
+
/** What a screen reader hears for a section with no grade. */
|
|
119
|
+
notGraded: string;
|
|
120
|
+
found: string;
|
|
121
|
+
why: string;
|
|
122
|
+
changes: string;
|
|
123
|
+
/** The label over a section's tools. */
|
|
124
|
+
sources: string;
|
|
125
|
+
/** The plan's heading when it names none. */
|
|
126
|
+
plan: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const readLabels: ReadLabels = {
|
|
130
|
+
section: "Section",
|
|
131
|
+
grade: "Grade",
|
|
132
|
+
gist: "The Gist",
|
|
133
|
+
notGraded: "Not graded yet",
|
|
134
|
+
found: "What We Found",
|
|
135
|
+
why: "Why",
|
|
136
|
+
changes: "What Changes",
|
|
137
|
+
sources: "Sources",
|
|
138
|
+
plan: "The Plan",
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export interface ReadProps {
|
|
142
|
+
title: string;
|
|
143
|
+
/** The business, set in the dateline. */
|
|
144
|
+
preparedFor: string;
|
|
145
|
+
/** The ISO date, e.g. "2026-10-16". */
|
|
146
|
+
date: string;
|
|
147
|
+
/** Two or three sentences under the title. */
|
|
148
|
+
lede: ReadParagraph;
|
|
149
|
+
/** The heading over the gist table, e.g. "At a Glance". */
|
|
150
|
+
gistTitle?: string;
|
|
151
|
+
/** The key: what each letter means, in a few words each. */
|
|
152
|
+
gradeKey?: Array<{ grade: WriteupGrade; label: string }>;
|
|
153
|
+
/** The tiers in order. Each section appears in the gist table and in the body. */
|
|
154
|
+
tiers: ReadTier[];
|
|
155
|
+
plan: ReadPlan;
|
|
156
|
+
close: ReadClose;
|
|
157
|
+
labels?: Partial<ReadLabels>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function Sources({ sources, label }: { sources: ReadSource[]; label: string }) {
|
|
161
|
+
return (
|
|
162
|
+
<footer className="op-sources">
|
|
163
|
+
<span className="op-sources-label">{label}</span>
|
|
164
|
+
<ul>
|
|
165
|
+
{sources.map((source) => (
|
|
166
|
+
<li key={source.label}>
|
|
167
|
+
{source.href ? (
|
|
168
|
+
<a href={source.href} {...newTabProps(source.href, true)}>
|
|
169
|
+
{source.label}
|
|
170
|
+
<ArrowUpRight size={12} aria-hidden="true" />
|
|
171
|
+
</a>
|
|
172
|
+
) : (
|
|
173
|
+
source.label
|
|
174
|
+
)}
|
|
175
|
+
</li>
|
|
176
|
+
))}
|
|
177
|
+
</ul>
|
|
178
|
+
</footer>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function Gist({
|
|
183
|
+
tiers,
|
|
184
|
+
title,
|
|
185
|
+
gradeKey,
|
|
186
|
+
labels,
|
|
187
|
+
}: {
|
|
188
|
+
tiers: ReadTier[];
|
|
189
|
+
title?: string;
|
|
190
|
+
gradeKey?: ReadProps["gradeKey"];
|
|
191
|
+
labels: ReadLabels;
|
|
192
|
+
}) {
|
|
193
|
+
return (
|
|
194
|
+
<section className="rd-gist" aria-label={title ? undefined : labels.gist}>
|
|
195
|
+
{(title || gradeKey) && (
|
|
196
|
+
<div className="op-ov-head">
|
|
197
|
+
{title && <h2 className="op-ov-title">{title}</h2>}
|
|
198
|
+
{gradeKey && (
|
|
199
|
+
<ul className="op-legend">
|
|
200
|
+
{gradeKey.map((entry) => (
|
|
201
|
+
<li key={entry.grade}>
|
|
202
|
+
<GradeChip grade={entry.grade} />
|
|
203
|
+
<span>{entry.label}</span>
|
|
204
|
+
</li>
|
|
205
|
+
))}
|
|
206
|
+
</ul>
|
|
207
|
+
)}
|
|
208
|
+
</div>
|
|
209
|
+
)}
|
|
210
|
+
<div className="rd-gist-card">
|
|
211
|
+
<table className="rd-gist-table">
|
|
212
|
+
<thead>
|
|
213
|
+
<tr>
|
|
214
|
+
<th scope="col" className="rd-gist-section">
|
|
215
|
+
{labels.section}
|
|
216
|
+
</th>
|
|
217
|
+
<th scope="col" className="rd-gist-grade">
|
|
218
|
+
{labels.grade}
|
|
219
|
+
</th>
|
|
220
|
+
<th scope="col" className="rd-gist-read">
|
|
221
|
+
{labels.gist}
|
|
222
|
+
</th>
|
|
223
|
+
</tr>
|
|
224
|
+
</thead>
|
|
225
|
+
{tiers.map((tier) => (
|
|
226
|
+
<tbody key={tier.title}>
|
|
227
|
+
<tr className="rd-gist-tier">
|
|
228
|
+
<th scope="rowgroup" colSpan={3}>
|
|
229
|
+
{tier.title}
|
|
230
|
+
</th>
|
|
231
|
+
</tr>
|
|
232
|
+
{tier.sections.map((section) => (
|
|
233
|
+
<tr key={section.id}>
|
|
234
|
+
<th scope="row" className="rd-gist-section">
|
|
235
|
+
<a href={`#${section.id}`}>{section.name}</a>
|
|
236
|
+
</th>
|
|
237
|
+
<td className="rd-gist-grade">
|
|
238
|
+
{section.grade ? (
|
|
239
|
+
<>
|
|
240
|
+
<span className="op-sr-only">{gradeLabel[section.grade]}</span>
|
|
241
|
+
<span aria-hidden="true">
|
|
242
|
+
<GradeChip grade={section.grade} />
|
|
243
|
+
</span>
|
|
244
|
+
</>
|
|
245
|
+
) : (
|
|
246
|
+
<>
|
|
247
|
+
<span className="op-sr-only">{labels.notGraded}</span>
|
|
248
|
+
<span className="op-dash" aria-hidden="true" />
|
|
249
|
+
</>
|
|
250
|
+
)}
|
|
251
|
+
</td>
|
|
252
|
+
<td className="rd-gist-read">
|
|
253
|
+
<Runs paragraph={section.gist} />
|
|
254
|
+
</td>
|
|
255
|
+
</tr>
|
|
256
|
+
))}
|
|
257
|
+
</tbody>
|
|
258
|
+
))}
|
|
259
|
+
</table>
|
|
260
|
+
</div>
|
|
261
|
+
</section>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function Section({ section, labels }: { section: ReadSection; labels: ReadLabels }) {
|
|
266
|
+
const found = section.found.filter((paragraph) => !isEmpty(paragraph));
|
|
267
|
+
const changes = section.changes.filter((paragraph) => !isEmpty(paragraph));
|
|
268
|
+
const shots = section.shots ?? [];
|
|
269
|
+
return (
|
|
270
|
+
<section className="op-topic rd-section" id={section.id}>
|
|
271
|
+
<header className="op-topic-head">
|
|
272
|
+
<div>
|
|
273
|
+
<p className="rd-name">{section.name}</p>
|
|
274
|
+
<h3>{section.question}</h3>
|
|
275
|
+
</div>
|
|
276
|
+
{section.grade && (
|
|
277
|
+
<>
|
|
278
|
+
<span className="op-sr-only">{`${labels.grade} ${gradeLabel[section.grade]}`}</span>
|
|
279
|
+
<span className="rd-grade" aria-hidden="true">
|
|
280
|
+
<GradeChip grade={section.grade} />
|
|
281
|
+
</span>
|
|
282
|
+
</>
|
|
283
|
+
)}
|
|
284
|
+
</header>
|
|
285
|
+
<div className="rd-beat rd-found">
|
|
286
|
+
<h4>{labels.found}</h4>
|
|
287
|
+
{found.map((paragraph, i) => (
|
|
288
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: paragraphs are static content in a fixed order
|
|
289
|
+
<Paragraph paragraph={paragraph} key={i} />
|
|
290
|
+
))}
|
|
291
|
+
{section.examples && section.examples.length > 0 && (
|
|
292
|
+
<ul className="rd-examples">
|
|
293
|
+
{section.examples.map((example, i) => (
|
|
294
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: examples are static content in a fixed order
|
|
295
|
+
<li key={i}>
|
|
296
|
+
<Runs paragraph={example} />
|
|
297
|
+
</li>
|
|
298
|
+
))}
|
|
299
|
+
</ul>
|
|
300
|
+
)}
|
|
301
|
+
{shots.length > 0 && (
|
|
302
|
+
<div className="rd-shots" data-count={Math.min(shots.length, 3)}>
|
|
303
|
+
{shots.map((shot) => (
|
|
304
|
+
<Shot shot={shot} key={shot.src} />
|
|
305
|
+
))}
|
|
306
|
+
</div>
|
|
307
|
+
)}
|
|
308
|
+
</div>
|
|
309
|
+
<div className="rd-beat rd-why">
|
|
310
|
+
<h4>{labels.why}</h4>
|
|
311
|
+
<Paragraph paragraph={section.why} />
|
|
312
|
+
</div>
|
|
313
|
+
<div className="rd-beat rd-changes">
|
|
314
|
+
<h4>{labels.changes}</h4>
|
|
315
|
+
{changes.map((paragraph, i) => (
|
|
316
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: paragraphs are static content in a fixed order
|
|
317
|
+
<Paragraph paragraph={paragraph} key={i} />
|
|
318
|
+
))}
|
|
319
|
+
</div>
|
|
320
|
+
{section.sources && section.sources.length > 0 && (
|
|
321
|
+
<Sources sources={section.sources} label={labels.sources} />
|
|
322
|
+
)}
|
|
323
|
+
</section>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function Plan({ plan, labels }: { plan: ReadPlan; labels: ReadLabels }) {
|
|
328
|
+
return (
|
|
329
|
+
<section className="rd-plan" id={plan.id}>
|
|
330
|
+
<h2>{plan.title ?? labels.plan}</h2>
|
|
331
|
+
{plan.lead && !isEmpty(plan.lead) && (
|
|
332
|
+
<Paragraph paragraph={plan.lead} className="rd-plan-lead" />
|
|
333
|
+
)}
|
|
334
|
+
<ol className="rd-steps">
|
|
335
|
+
{plan.steps.map((step) => (
|
|
336
|
+
<li className="rd-step" key={step.title}>
|
|
337
|
+
<p>
|
|
338
|
+
<b className="rd-step-title">{step.title}</b>
|
|
339
|
+
{step.who && (
|
|
340
|
+
<>
|
|
341
|
+
{" "}
|
|
342
|
+
<span className="rd-step-who">{step.who}</span>
|
|
343
|
+
</>
|
|
344
|
+
)}
|
|
345
|
+
{step.body && !isEmpty(step.body) && (
|
|
346
|
+
<>
|
|
347
|
+
{" "}
|
|
348
|
+
<Runs paragraph={step.body} />
|
|
349
|
+
</>
|
|
350
|
+
)}
|
|
351
|
+
</p>
|
|
352
|
+
</li>
|
|
353
|
+
))}
|
|
354
|
+
</ol>
|
|
355
|
+
</section>
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export function Read({
|
|
360
|
+
title,
|
|
361
|
+
preparedFor,
|
|
362
|
+
date,
|
|
363
|
+
lede,
|
|
364
|
+
gistTitle,
|
|
365
|
+
gradeKey,
|
|
366
|
+
tiers,
|
|
367
|
+
plan,
|
|
368
|
+
close,
|
|
369
|
+
labels: overrides,
|
|
370
|
+
}: ReadProps) {
|
|
371
|
+
const labels = { ...readLabels, ...overrides };
|
|
372
|
+
const shownTiers = tiers.filter((tier) => tier.sections.length > 0);
|
|
373
|
+
return (
|
|
374
|
+
<div className="op rd">
|
|
375
|
+
<article className="op-doc rd-doc">
|
|
376
|
+
<header className="op-head">
|
|
377
|
+
<p className="op-meta">
|
|
378
|
+
Prepared for <b>{preparedFor}</b>
|
|
379
|
+
<span className="op-meta-sep" aria-hidden="true">
|
|
380
|
+
{" · "}
|
|
381
|
+
</span>
|
|
382
|
+
<span className="op-meta-date">{date}</span>
|
|
383
|
+
</p>
|
|
384
|
+
<h1>{title}</h1>
|
|
385
|
+
{!isEmpty(lede) && <Paragraph paragraph={lede} className="op-intro rd-lede" />}
|
|
386
|
+
</header>
|
|
387
|
+
{shownTiers.length > 0 && (
|
|
388
|
+
<Gist tiers={shownTiers} title={gistTitle} gradeKey={gradeKey} labels={labels} />
|
|
389
|
+
)}
|
|
390
|
+
{shownTiers.map((tier) => (
|
|
391
|
+
<div className="rd-tier" key={tier.title}>
|
|
392
|
+
<div className="op-part" id={tier.id}>
|
|
393
|
+
<h2>{tier.title}</h2>
|
|
394
|
+
{tier.lead && <p>{tier.lead}</p>}
|
|
395
|
+
</div>
|
|
396
|
+
{tier.sections.map((section) => (
|
|
397
|
+
<Section section={section} labels={labels} key={section.id} />
|
|
398
|
+
))}
|
|
399
|
+
</div>
|
|
400
|
+
))}
|
|
401
|
+
{plan.steps.length > 0 && <Plan plan={plan} labels={labels} />}
|
|
402
|
+
{!isEmpty(close.line) && <Paragraph paragraph={close.line} className="rd-closing" />}
|
|
403
|
+
{close.signOff && close.person && (
|
|
404
|
+
<footer className="op-close rd-close">
|
|
405
|
+
<SignOff signOff={close.signOff} person={close.person} />
|
|
406
|
+
</footer>
|
|
407
|
+
)}
|
|
408
|
+
</article>
|
|
409
|
+
</div>
|
|
410
|
+
);
|
|
411
|
+
}
|