Skip to content

Commit a2ed936

Browse files
chore: generate
1 parent b17fbf4 commit a2ed936

4 files changed

Lines changed: 47 additions & 18 deletions

File tree

‎packages/lab/catalog/src/App.tsx‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,7 @@ export function App({ catalog }: AppProps) {
361361
}),
362362
)
363363
if (window.location.hash.startsWith("#annotations=")) url.hash = window.location.hash
364-
window.history.replaceState(
365-
null,
366-
"",
367-
url,
368-
)
364+
window.history.replaceState(null, "", url)
369365
}, [activeVariant.id, activeFlow?.id, selectedScreen, ui.mode, ui.viewerOpen])
370366

371367
useEffect(() => {

‎packages/lab/catalog/src/components/AnnotationEditor.tsx‎

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ export function AnnotationEditor(props: AnnotationEditorProps) {
5151
onPointerDown={(event) => {
5252
if (event.target !== event.currentTarget) return
5353
const bounds = event.currentTarget.getBoundingClientRect()
54-
const column = Math.min(props.cols - 1, Math.max(0, Math.floor(((event.clientX - bounds.left) / bounds.width) * props.cols)))
55-
const row = Math.min(props.rows - 1, Math.max(0, Math.floor(((event.clientY - bounds.top) / bounds.height) * props.rows)))
54+
const column = Math.min(
55+
props.cols - 1,
56+
Math.max(0, Math.floor(((event.clientX - bounds.left) / bounds.width) * props.cols)),
57+
)
58+
const row = Math.min(
59+
props.rows - 1,
60+
Math.max(0, Math.floor(((event.clientY - bounds.top) / bounds.height) * props.rows)),
61+
)
5662
setDraft({ row, column, note: "" })
5763
}}
5864
>
@@ -83,7 +89,9 @@ export function AnnotationEditor(props: AnnotationEditorProps) {
8389
>
8490
<header>
8591
<span>{draft.id ? "Edit annotation" : "New annotation"}</span>
86-
<small>R{draft.row + 1} · C{draft.column + 1}</small>
92+
<small>
93+
R{draft.row + 1} · C{draft.column + 1}
94+
</small>
8795
</header>
8896
<textarea
8997
ref={textareaRef}
@@ -117,8 +125,12 @@ export function AnnotationEditor(props: AnnotationEditorProps) {
117125
>
118126
Delete
119127
</button>
120-
) : <span />}
121-
<button type="button" onClick={() => setDraft(undefined)}>Cancel</button>
128+
) : (
129+
<span />
130+
)}
131+
<button type="button" onClick={() => setDraft(undefined)}>
132+
Cancel
133+
</button>
122134
<button type="button" className="annotation-composer-save" disabled={!draft.note.trim()} onClick={save}>
123135
{draft.id ? "Save" : "Add"}
124136
</button>
@@ -130,16 +142,22 @@ export function AnnotationEditor(props: AnnotationEditorProps) {
130142
<header>
131143
<div>
132144
<strong>Annotations</strong>
133-
<span>{props.annotations.length === 0 ? "Click anywhere on the terminal" : `${props.annotations.length} placed`}</span>
145+
<span>
146+
{props.annotations.length === 0 ? "Click anywhere on the terminal" : `${props.annotations.length} placed`}
147+
</span>
134148
</div>
135-
<button type="button" onClick={props.onDone}>Done</button>
149+
<button type="button" onClick={props.onDone}>
150+
Done
151+
</button>
136152
</header>
137153
<div className="annotation-list">
138154
{props.annotations.map((annotation, index) => (
139155
<button key={annotation.id} type="button" className="annotation-list-row" onClick={() => edit(annotation)}>
140156
<span className="annotation-list-pin">{index + 1}</span>
141157
<span>
142-
<small>Row {annotation.row + 1} · Column {annotation.column + 1}</small>
158+
<small>
159+
Row {annotation.row + 1} · Column {annotation.column + 1}
160+
</small>
143161
<strong>{annotation.note}</strong>
144162
</span>
145163
</button>
@@ -155,7 +173,11 @@ export function AnnotationEditor(props: AnnotationEditorProps) {
155173
>
156174
Open GitHub issue
157175
</a>
158-
<span>{complete.length === 0 ? "Add a note to continue" : `${complete.length} note${complete.length === 1 ? "" : "s"} will be included`}</span>
176+
<span>
177+
{complete.length === 0
178+
? "Add a note to continue"
179+
: `${complete.length} note${complete.length === 1 ? "" : "s"} will be included`}
180+
</span>
159181
</footer>
160182
</aside>
161183
</>

‎packages/lab/catalog/src/components/Viewer.tsx‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ import { CaptureSetSwitcher } from "./CaptureSetSwitcher"
66
import { CaptureContextMenu } from "./CaptureContextMenu"
77
import { feedbackIssueUrl } from "../feedback"
88
import { CaptureActionsMenu } from "./CaptureActionsMenu"
9-
import { annotationUrl, readAnnotationDraft, readAnnotations, type Annotation, type AnnotationDocument } from "../annotations"
9+
import {
10+
annotationUrl,
11+
readAnnotationDraft,
12+
readAnnotations,
13+
type Annotation,
14+
type AnnotationDocument,
15+
} from "../annotations"
1016
import { AnnotationEditor } from "./AnnotationEditor"
1117

1218
interface ViewerProps {
@@ -56,7 +62,8 @@ export function Viewer({
5662
const [annotating, setAnnotating] = useState(() => window.location.hash.startsWith("#annotations="))
5763
const [annotations, setAnnotations] = useState<ReadonlyArray<Annotation>>(() => {
5864
const linked = readAnnotations(new URL(window.location.href), identifier, variant.id)
59-
if (linked.length > 0) return linked.filter((annotation) => annotation.row < frame.rows && annotation.column < frame.cols)
65+
if (linked.length > 0)
66+
return linked.filter((annotation) => annotation.row < frame.rows && annotation.column < frame.cols)
6067
try {
6168
const stored = localStorage.getItem(storageKey)
6269
if (!stored) return []
@@ -186,7 +193,9 @@ export function Viewer({
186193
setAnnotations([...annotations, annotation])
187194
}}
188195
onChange={(id, note) =>
189-
setAnnotations(annotations.map((annotation) => annotation.id === id ? { ...annotation, note } : annotation))
196+
setAnnotations(
197+
annotations.map((annotation) => (annotation.id === id ? { ...annotation, note } : annotation)),
198+
)
190199
}
191200
onDelete={(id) => setAnnotations(annotations.filter((annotation) => annotation.id !== id))}
192201
onDone={() => {

‎packages/lab/catalog/src/styles.css‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,9 @@ kbd {
13341334
transform: translate(-50%, 1.2rem);
13351335
border-radius: 0.85rem;
13361336
background: #1a1a1a;
1337-
box-shadow: 0 12px 40px rgb(0 0 0 / 55%), 0 0 0 1px rgb(255 255 255 / 9%);
1337+
box-shadow:
1338+
0 12px 40px rgb(0 0 0 / 55%),
1339+
0 0 0 1px rgb(255 255 255 / 9%);
13381340
cursor: default;
13391341
animation: annotation-composer-in 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
13401342
}

0 commit comments

Comments
 (0)