Code review
Slant / Components
One review round of a four-file change: a list of changed files with their totals, the open file's diff, comments under its lines, and Send round, which asks first.
The theme follows the link: share a page with ?theme=moon.
Usage
- The changed files list each path, its
+added −removedtotals, any draft comments and a viewed mark; the open one isaria-current, and aProgresscounts the files viewed ("1 of 4 reviewed"). Beside the diff once the piece is 640px wide, above it in a narrow column. <DiffView before after language title layoutToggle>shows the open file; the layout is held here, so Split stays on from file to file, and Split passeswrapso both sides fit the piece. Itsheaderis a "Viewed"Checkbox, which marks the file and leaves you on it, so the box you ticked is still the one under focus.renderLineActionputs a ghost iconButtonin each line's gutter, "Comment on line 21";renderLineAfterputs the line's comments under it, and the comment box (aTextarea, Cancel and Add comment) while it is open there. Comments key on the file, the line's number and its side, so they stay put across layouts and folds, and a line with one is never folded away.- Added comments wait under their line as drafts, with Delete, and their count rides on Send round. Send round opens an alert
Dialog("Send round 2 with 3 comments?") with the counts; Send turns the drafts into comments marked "Sent in round 2" and opens round 3.
Keyboard
| Tab | moves through the files, the Viewed box, the change buttons and the layout toggle, the diff and each line's comment button, then Send round |
| Enter / Space | opens the focused file, opens a line's comment box, or ticks Viewed |
| Alt + ↓ / Alt + ↑ | in the diff, moves to the next or previous change |
| ⌘ / Ctrl + Enter | in a comment box, adds the comment |
| Escape | in a comment box, cancels it; in the dialog, closes it without sending |
| ← / → | switches between Unified and Split on the layout toggle |
Accessibility
- Each file is a button whose name carries its path, its totals ("9 added, 3 removed"), its drafts and whether it is reviewed; the progress bar reads "1 of 4 files".
- Every line's comment button is in the tab order and named after its line ("Comment on line 12", "Comment on removed line 7"). The comment box takes focus when it opens, and focus goes back to the line's button after Add comment, Cancel, Escape or Delete.
- Until there is a draft or every file is viewed, Send round is
aria-disabledand described by the line that says why. In the alert dialog, Cancel takes focus first, and focus returns to Send round when it closes. - Each comment added or deleted, file viewed and round sent is read out through a polite status line.
Code review in React and SwiftUI.
The React tab is the component’s real source; the SwiftUI tab is its twin in TUTTNKit.