1+ import { useState } from 'react'
12import { Main } from './Main'
23import { Page as UiPage } from '@ui/components/editor/panel/Page'
34import { EditPresetForm } from '@/views/panel/frontend/components/edit-preset-form/EditPresetForm'
@@ -12,6 +13,7 @@ import { ProgressModal as UiProgressModal } from '@ui/components/editor/panel/mo
1213import { AutoClosingModal as UiAutoClosingModal } from '@ui/components/editor/panel/modals/AutoClosingModal'
1314import { CommitMessageModal as UiCommitMessageModal } from '@ui/components/editor/panel/modals/CommitMessageModal'
1415import { StageFilesModal as UiStageFilesModal } from '@ui/components/editor/panel/modals/StageFilesModal'
16+ import { EditCheckpointDescriptionModal as UiEditCheckpointDescriptionModal } from '@ui/components/editor/panel/modals/EditCheckpointDescriptionModal'
1517import { use_panel } from './hooks/use-panel'
1618import { FileInPreview } from '@shared/types/file-in-preview'
1719import { LayoutContext } from './contexts/LayoutContext'
@@ -88,6 +90,10 @@ export const Panel = () => {
8890 handle_remove_response_history_item
8991 } = use_panel ( vscode )
9092
93+ const [ checkpoint_to_edit , set_checkpoint_to_edit ] = useState <
94+ { timestamp : number ; description : string } | undefined
95+ > ( undefined )
96+
9197 const { viewing_donations, set_viewing_donations, ...donations_state } =
9298 use_latest_donations ( )
9399
@@ -300,6 +306,17 @@ export const Panel = () => {
300306 timestamp
301307 } )
302308 } }
309+ on_edit_checkpoint_description = { ( timestamp ) => {
310+ const checkpoint = checkpoints . find (
311+ ( c ) => c . timestamp == timestamp
312+ )
313+ if ( checkpoint ) {
314+ set_checkpoint_to_edit ( {
315+ timestamp : checkpoint . timestamp ,
316+ description : checkpoint . description || ''
317+ } )
318+ }
319+ } }
303320 />
304321 </ div >
305322 </ Layout >
@@ -501,6 +518,23 @@ export const Panel = () => {
501518 </ div >
502519 ) }
503520
521+ { checkpoint_to_edit && (
522+ < div className = { styles . slot } >
523+ < UiEditCheckpointDescriptionModal
524+ description = { checkpoint_to_edit . description }
525+ on_save = { ( description ) => {
526+ post_message ( vscode , {
527+ command : 'UPDATE_CHECKPOINT_DESCRIPTION' ,
528+ timestamp : checkpoint_to_edit . timestamp ,
529+ description
530+ } )
531+ set_checkpoint_to_edit ( undefined )
532+ } }
533+ on_cancel = { ( ) => set_checkpoint_to_edit ( undefined ) }
534+ />
535+ </ div >
536+ ) }
537+
504538 { files_to_stage && (
505539 < div className = { styles . slot } >
506540 < UiStageFilesModal
0 commit comments