feat(client): add code reference modal to step and snippet editors
CI / changes (pull_request) Successful in 7s
CI / version (pull_request) Skipped
CI / server (pull_request) Skipped
CI / client (pull_request) Successful in 1m13s
CI / image (pull_request) Skipped

- a (?) button next to the Code label on the step and snippet
  create/edit pages opens a reference of the script runtime: globals,
  every context member with examples, and pitfalls such as awaiting
  getStepOutput and assert
- the reference lives in components/modals/code-help.md and is
  rendered as markdown
- Modal takes size="lg" for document-like content; the dialog is
  capped to the viewport and its body scrolls, focusable when lg so
  the keyboard can scroll it
- docs/scenario.md notes that getStepOutput is async and points to
  the in-app reference to keep in sync
This commit is contained in:
ars9 committed 2026-10-01 14:45:03 +03:00
1 parent 71259bc11d
commit daecf3d539
14 files changed
+354 -15

No files matched your search

+8
View File
@@ -16,6 +16,13 @@
border-radius: var(--radius-lg);
box-shadow: 0 20px 48px color-mix(in srgb, #000 28%, transparent);
overflow: hidden;
display: flex;
flex-direction: column;
max-height: 100%;
}
.lg {
width: min(880px, 100%);
}
.header {
@@ -31,6 +38,7 @@
.body {
padding: var(--space-2) var(--space-5) var(--space-4);
color: var(--color-text-muted);
overflow-y: auto;
}
.footer {
+8 -3
View File
@@ -7,9 +7,11 @@ export interface ModalProps {
children?: React.ReactNode;
onClose: () => void;
footer?: React.ReactNode;
/** `lg` widens the dialog for long, document-like content. */
size?: 'md' | 'lg';
}
export function Modal({ open, title, children, onClose, footer }: ModalProps) {
export function Modal({ open, title, children, onClose, footer, size = 'md' }: ModalProps) {
useEffect(() => {
if (!open) return;
const onKeyDown = (event: KeyboardEvent) => {
@@ -24,7 +26,7 @@ export function Modal({ open, title, children, onClose, footer }: ModalProps) {
return (
<div className={styles.overlay} role="presentation" onClick={onClose}>
<div
className={styles.dialog}
className={size === 'lg' ? `${styles.dialog} ${styles.lg}` : styles.dialog}
role="dialog"
aria-modal="true"
aria-label={title}
@@ -33,7 +35,10 @@ export function Modal({ open, title, children, onClose, footer }: ModalProps) {
<div className={styles.header}>
<h3 className={styles.title}>{title}</h3>
</div>
<div className={styles.body}>{children}</div>
{/* Long (lg) content scrolls; make it focusable so the keyboard can scroll it. */}
<div className={styles.body} tabIndex={size === 'lg' ? 0 : undefined}>
{children}
</div>
{footer && <div className={styles.footer}>{footer}</div>}
</div>
</div>