11import { useState } from 'react'
22import { Main } from './Main'
3+ import { Button as UiButton } from '@ui/components/editor/common/Button'
34import { Page as UiPage } from '@ui/components/editor/panel/Page'
45import { EditPresetForm } from '@/views/panel/frontend/components/edit-preset-form/EditPresetForm'
56import { TextButton as UiTextButton } from '@ui/components/editor/panel/TextButton'
@@ -9,6 +10,7 @@ import styles from './Panel.module.scss'
910import cn from 'classnames'
1011import { post_message } from './utils/post_message'
1112import { ResponsePreview as UiResponsePreview } from '@ui/components/editor/panel/ResponsePreview'
13+ import { Modal as UiModal } from '@ui/components/editor/panel/modals/Modal'
1214import { ProgressModal as UiProgressModal } from '@ui/components/editor/panel/modals/ProgressModal'
1315import { ApiManagerModal as UiApiManagerModal } from '@ui/components/editor/panel/modals/ApiManagerModal'
1416import { QRCodeModal as UiQRCodeModal } from '@ui/components/editor/panel/modals/QRCodeModal'
@@ -81,6 +83,8 @@ export const Panel = () => {
8183 can_undo,
8284 context_file_paths,
8385 presets_collapsed,
86+ is_preview_ongoing_modal_visible,
87+ set_is_preview_ongoing_modal_visible,
8488 configurations_collapsed,
8589 handle_instructions_change,
8690 edit_preset_back_click_handler,
@@ -526,6 +530,51 @@ export const Panel = () => {
526530 </ div >
527531 ) }
528532
533+ { is_preview_ongoing_modal_visible && (
534+ < div className = { styles . slot } >
535+ < UiModal
536+ title = "New response received"
537+ content_slot = {
538+ < div >
539+ Would you like to switch to the new response? You can do it
540+ later by going back or rejecting.
541+ </ div >
542+ }
543+ on_background_click = { ( ) => {
544+ set_is_preview_ongoing_modal_visible ( false )
545+ post_message ( vscode , {
546+ command : 'PREVIEW_SWITCH_CHOICE' ,
547+ choice : undefined
548+ } )
549+ } }
550+ footer_slot = {
551+ < >
552+ < UiButton
553+ is_secondary
554+ on_click = { ( ) => {
555+ set_is_preview_ongoing_modal_visible ( false )
556+ post_message ( vscode , { command : 'PREVIEW_SWITCH_CHOICE' } )
557+ } }
558+ >
559+ Close
560+ </ UiButton >
561+ < UiButton
562+ on_click = { ( ) => {
563+ set_is_preview_ongoing_modal_visible ( false )
564+ post_message ( vscode , {
565+ command : 'PREVIEW_SWITCH_CHOICE' ,
566+ choice : 'Switch'
567+ } )
568+ } }
569+ >
570+ Switch
571+ </ UiButton >
572+ </ >
573+ }
574+ />
575+ </ div >
576+ ) }
577+
529578 { progress_state && (
530579 < div className = { styles . slot } >
531580 < UiProgressModal
0 commit comments