(action: ChatAction)
| 118 | const hasActions = visibleActions.length > 0; |
| 119 | |
| 120 | const handleSelect = async (action: ChatAction) => { |
| 121 | setMenuOpen(false); |
| 122 | const newChat = !showAIPanel; |
| 123 | setShowAIPanel(true); |
| 124 | |
| 125 | if (!statement) return; |
| 126 | await nextAnimationFrame(); |
| 127 | if (action === "explain-code") { |
| 128 | void aiContextEvents.emit("send-chat", { |
| 129 | content: promptUtils.explainCode(statement, instance.engine), |
| 130 | newChat, |
| 131 | }); |
| 132 | } else if (action === "find-problems") { |
| 133 | void aiContextEvents.emit("send-chat", { |
| 134 | content: promptUtils.findProblems(statement, instance.engine), |
| 135 | newChat, |
| 136 | }); |
| 137 | } |
| 138 | }; |
| 139 | |
| 140 | const renderButton = (onClick?: () => void) => ( |
| 141 | <Button |
no test coverage detected