MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / ReviewScreen

Function ReviewScreen

cli/src/components/review-screen.tsx:32–115  ·  view source on GitHub ↗
({
  onSelectOption,
  onCustom,
  onCancel,
})

Source from the content-addressed store, hash-verified

30}
31
32export const ReviewScreen: React.FC<ReviewScreenProps> = ({
33 onSelectOption,
34 onCustom,
35 onCancel,
36}) => {
37 const theme = useTheme()
38 const [selectedIndex, setSelectedIndex] = useState(0)
39
40 const handleSelect = useCallback(
41 (option: ReviewOption) => {
42 if (option.id === 'custom') {
43 onCustom()
44 return
45 }
46
47 const scope = option.id as 'conversation' | 'uncommitted' | 'branch'
48 const reviewText = buildReviewPrompt(scope)
49 onSelectOption(reviewText)
50 },
51 [onSelectOption, onCustom],
52 )
53
54 useKeyboard(
55 useCallback(
56 (key: KeyEvent) => {
57 if (key.name === 'up') {
58 setSelectedIndex((prev) => Math.max(0, prev - 1))
59 return
60 }
61 if (key.name === 'down') {
62 setSelectedIndex((prev) => Math.min(REVIEW_OPTIONS.length - 1, prev + 1))
63 return
64 }
65 if (isPlainEnterKey(key)) {
66 const option = REVIEW_OPTIONS[selectedIndex]
67 if (option) {
68 handleSelect(option)
69 }
70 return
71 }
72 if (key.name === 'escape') {
73 onCancel()
74 return
75 }
76 },
77 [selectedIndex, handleSelect, onCancel],
78 ),
79 )
80
81 return (
82 <box
83 title=" Review "
84 titleAlignment="center"
85 style={{
86 width: '100%',
87 borderStyle: 'single',
88 borderColor: theme.border,
89 customBorderChars: BORDER_CHARS,

Callers

nothing calls this directly

Calls 3

useThemeFunction · 0.90
buildReviewPromptFunction · 0.90
isPlainEnterKeyFunction · 0.90

Tested by

no test coverage detected