Commit 831d6b8
authored
🤖 feat: add stateful pending reviews (#970)
## Summary
Adds a reviews system that allows users to create review notes from diff
viewers, manage them via a collapsible banner, and send them to Claude
with messages. Reviews are orthogonal to message type (works with both
normal messages and auto-compaction).
## Architecture
**Data Flow:**
1. User selects code in diff viewer → clicks "+" → enters comment →
`ReviewNoteData` created
2. New reviews start with `status: "attached"` (auto-shows in ChatInput)
3. User can detach (→ pending), check as done, or delete reviews
4. On send: reviews formatted into message text + stored in
`muxMetadata` for rich UI display
**Key Types** (`src/common/types/`):
- `ReviewNoteData`: Structured data with `filePath`, `lineRange`,
`selectedCode`, `userNote`
- `Review`: Contains `id`, `data`, `status` ("pending" | "attached" |
"checked"), timestamps
- `UserMessageContent`: Shared type for normal send and
continue-after-compaction (ensures reviews work with auto-compaction)
- `prepareUserMessageForSend()`: Shared utility to format reviews →
message text + metadata
**Components:**
- `useReviews` hook: localStorage persistence per workspace with
cross-component sync
- `ReviewsBanner`: Collapsible banner above chat input showing
pending/checked reviews
- `ReviewBlockFromData`: Renders review with diff preview and editable
comments
- `ChatInput`: Shows attached reviews, handles send with reviews
## Review State Machine
```
Created → Attached (auto)
Attached → Send message → Checked
Attached → Click X → Pending
Pending → "Send to chat" → Attached
Pending/Checked → Delete → Removed
Checked → Uncheck → Pending
```
## Key Implementation Details
- **Orthogonal to auto-compaction**: Reviews included in
`continueMessage` so they survive compaction flow
- **No duplicate display**: Reviews hidden from ChatInput during send
operation
- **Wide viewport alignment**: Banner content uses `max-w-4xl mx-auto`
to align with chat
- **Error boundary**: Corrupted localStorage data shows recovery UI
instead of crashing
## Stories
- `App/Reviews/ReviewsBanner` - Multiple reviews in different states
- `App/Reviews/AllReviewsChecked` - All completed state
- `App/Reviews/ManyReviews` - Scroll behavior with many items
---
_Generated with `mux`_1 parent c59135c commit 831d6b8
File tree
23 files changed
+1569
-84
lines changed- src
- browser
- components
- ChatInput
- Messages
- RightSidebar/CodeReview
- tools
- hooks
- stories
- utils
- messages
- ui
- common
- constants
- types
- node/services
23 files changed
+1569
-84
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
| |||
213 | 219 | | |
214 | 220 | | |
215 | 221 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
220 | 230 | | |
221 | 231 | | |
222 | 232 | | |
| |||
532 | 542 | | |
533 | 543 | | |
534 | 544 | | |
| 545 | + | |
535 | 546 | | |
536 | 547 | | |
537 | 548 | | |
| |||
606 | 617 | | |
607 | 618 | | |
608 | 619 | | |
| 620 | + | |
609 | 621 | | |
610 | 622 | | |
611 | 623 | | |
| |||
621 | 633 | | |
622 | 634 | | |
623 | 635 | | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
624 | 640 | | |
625 | 641 | | |
626 | 642 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| 145 | + | |
143 | 146 | | |
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| 151 | + | |
| 152 | + | |
148 | 153 | | |
149 | 154 | | |
150 | 155 | | |
151 | 156 | | |
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
155 | | - | |
| 160 | + | |
156 | 161 | | |
157 | 162 | | |
158 | 163 | | |
| |||
236 | 241 | | |
237 | 242 | | |
238 | 243 | | |
239 | | - | |
| 244 | + | |
| 245 | + | |
240 | 246 | | |
241 | 247 | | |
242 | 248 | | |
| |||
946 | 952 | | |
947 | 953 | | |
948 | 954 | | |
949 | | - | |
950 | | - | |
| 955 | + | |
| 956 | + | |
951 | 957 | | |
952 | 958 | | |
953 | 959 | | |
| |||
962 | 968 | | |
963 | 969 | | |
964 | 970 | | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
965 | 979 | | |
966 | 980 | | |
967 | 981 | | |
| 982 | + | |
968 | 983 | | |
969 | 984 | | |
970 | 985 | | |
| |||
974 | 989 | | |
975 | 990 | | |
976 | 991 | | |
| 992 | + | |
977 | 993 | | |
978 | 994 | | |
979 | 995 | | |
980 | 996 | | |
981 | 997 | | |
982 | 998 | | |
983 | | - | |
984 | | - | |
| 999 | + | |
985 | 1000 | | |
986 | 1001 | | |
987 | 1002 | | |
988 | 1003 | | |
989 | 1004 | | |
990 | 1005 | | |
991 | 1006 | | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
992 | 1011 | | |
993 | 1012 | | |
994 | 1013 | | |
| |||
998 | 1017 | | |
999 | 1018 | | |
1000 | 1019 | | |
1001 | | - | |
1002 | | - | |
| 1020 | + | |
1003 | 1021 | | |
1004 | 1022 | | |
1005 | 1023 | | |
| |||
1009 | 1027 | | |
1010 | 1028 | | |
1011 | 1029 | | |
| 1030 | + | |
1012 | 1031 | | |
1013 | 1032 | | |
1014 | 1033 | | |
| |||
1072 | 1091 | | |
1073 | 1092 | | |
1074 | 1093 | | |
1075 | | - | |
1076 | | - | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1077 | 1110 | | |
1078 | 1111 | | |
| 1112 | + | |
1079 | 1113 | | |
1080 | 1114 | | |
1081 | 1115 | | |
1082 | 1116 | | |
1083 | 1117 | | |
1084 | 1118 | | |
1085 | 1119 | | |
1086 | | - | |
| 1120 | + | |
1087 | 1121 | | |
1088 | 1122 | | |
1089 | 1123 | | |
| |||
1098 | 1132 | | |
1099 | 1133 | | |
1100 | 1134 | | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
| 1135 | + | |
| 1136 | + | |
1104 | 1137 | | |
1105 | 1138 | | |
1106 | 1139 | | |
1107 | 1140 | | |
1108 | 1141 | | |
1109 | 1142 | | |
1110 | | - | |
| 1143 | + | |
1111 | 1144 | | |
1112 | 1145 | | |
1113 | 1146 | | |
1114 | 1147 | | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
1115 | 1153 | | |
1116 | 1154 | | |
1117 | 1155 | | |
| |||
1127 | 1165 | | |
1128 | 1166 | | |
1129 | 1167 | | |
1130 | | - | |
1131 | | - | |
| 1168 | + | |
| 1169 | + | |
1132 | 1170 | | |
1133 | 1171 | | |
| 1172 | + | |
1134 | 1173 | | |
1135 | 1174 | | |
1136 | 1175 | | |
| |||
1308 | 1347 | | |
1309 | 1348 | | |
1310 | 1349 | | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
1311 | 1371 | | |
1312 | 1372 | | |
1313 | 1373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
32 | 41 | | |
33 | 42 | | |
34 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | | - | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
| |||
0 commit comments