|
1 | | -import { useRef, useEffect, useMemo, useState } from 'react' |
| 1 | +import { useRef, useEffect, useMemo } from 'react' |
2 | 2 | import styles from './ChatInput.module.scss' |
3 | 3 | import TextareaAutosize from 'react-textarea-autosize' |
4 | 4 | import cn from 'classnames' |
5 | 5 | import { Icon } from '../../common/Icon' |
6 | 6 | import { get_highlighted_text } from './utils/get-highlighted-text' |
7 | 7 | import { use_handlers } from './hooks/use-handlers' |
8 | 8 | import { use_dropdown } from './hooks/use-dropdown' |
| 9 | +import { DropdownMenu } from '../../common/DropdownMenu' |
9 | 10 |
|
10 | 11 | export type EditFormat = 'whole' | 'truncated' | 'diff' |
11 | 12 |
|
@@ -109,8 +110,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => { |
109 | 110 | }, [ |
110 | 111 | props.is_in_code_completions_mode, |
111 | 112 | props.chat_history, |
112 | | - is_history_enabled, |
113 | | - props.is_web_mode |
| 113 | + is_history_enabled |
114 | 114 | ]) |
115 | 115 |
|
116 | 116 | const custom_handle_key_down = ( |
@@ -306,42 +306,20 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => { |
306 | 306 | /> |
307 | 307 | </button> |
308 | 308 | {is_dropdown_open && ( |
309 | | - <div className={styles['footer__right__submit__dropdown']}> |
310 | | - <div |
311 | | - className={ |
312 | | - styles['footer__right__submit__dropdown__item'] |
313 | | - } |
314 | | - onClick={handle_select_click} |
315 | | - > |
316 | | - Select... |
317 | | - <span |
318 | | - className={ |
319 | | - styles[ |
320 | | - 'footer__right__submit__dropdown__item__shortcut' |
321 | | - ] |
322 | | - } |
323 | | - > |
324 | | - {mod_key}+{is_mac ? 'return' : 'enter'} |
325 | | - </span> |
326 | | - </div> |
327 | | - <div |
328 | | - className={ |
329 | | - styles['footer__right__submit__dropdown__item'] |
| 309 | + <DropdownMenu |
| 310 | + items={[ |
| 311 | + { |
| 312 | + label: 'Select...', |
| 313 | + shortcut: `${mod_key}+${is_mac ? 'return' : 'enter'}`, |
| 314 | + on_click: handle_select_click |
| 315 | + }, |
| 316 | + { |
| 317 | + label: 'Copy prompt', |
| 318 | + shortcut: `${mod_key}+${is_mac ? 'option' : 'alt'}+c`, |
| 319 | + on_click: handle_copy_click |
330 | 320 | } |
331 | | - onClick={handle_copy_click} |
332 | | - > |
333 | | - Copy prompt |
334 | | - <span |
335 | | - className={ |
336 | | - styles[ |
337 | | - 'footer__right__submit__dropdown__item__shortcut' |
338 | | - ] |
339 | | - } |
340 | | - > |
341 | | - {mod_key}+{is_mac ? 'option' : 'alt'}+c |
342 | | - </span> |
343 | | - </div> |
344 | | - </div> |
| 321 | + ]} |
| 322 | + /> |
345 | 323 | )} |
346 | 324 | </> |
347 | 325 | )} |
|
0 commit comments