@@ -17,6 +17,7 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
1717 const [ searchQuery , setSearchQuery ] = useState ( "" )
1818 const [ sortOption , setSortOption ] = useState < SortOption > ( "newest" )
1919 const [ lastNonRelevantSort , setLastNonRelevantSort ] = useState < SortOption | null > ( "newest" )
20+ const [ showCopyModal , setShowCopyModal ] = useState ( false )
2021
2122 useEffect ( ( ) => {
2223 if ( searchQuery && sortOption !== "mostRelevant" && ! lastNonRelevantSort ) {
@@ -36,6 +37,13 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
3637 vscode . postMessage ( { type : "deleteTaskWithId" , text : id } )
3738 }
3839
40+ const handleCopyTask = async ( e : React . MouseEvent , task : string ) => {
41+ e . stopPropagation ( )
42+ await navigator . clipboard . writeText ( task )
43+ setShowCopyModal ( true )
44+ setTimeout ( ( ) => setShowCopyModal ( false ) , 2000 )
45+ }
46+
3947 const formatDate = ( timestamp : number ) => {
4048 const date = new Date ( timestamp )
4149 return date
@@ -103,21 +111,40 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
103111 .history-item:hover {
104112 background-color: var(--vscode-list-hoverBackground);
105113 }
106- .delete-button, .export-button {
114+ .delete-button, .export-button, .copy-button {
107115 opacity: 0;
108116 pointer-events: none;
109117 }
110118 .history-item:hover .delete-button,
111- .history-item:hover .export-button {
119+ .history-item:hover .export-button,
120+ .history-item:hover .copy-button {
112121 opacity: 1;
113122 pointer-events: auto;
114123 }
115124 .history-item-highlight {
116125 background-color: var(--vscode-editor-findMatchHighlightBackground);
117126 color: inherit;
118127 }
128+ .copy-modal {
129+ position: fixed;
130+ top: 50%;
131+ left: 50%;
132+ transform: translate(-50%, -50%);
133+ background-color: var(--vscode-notifications-background);
134+ color: var(--vscode-notifications-foreground);
135+ padding: 12px 20px;
136+ border-radius: 4px;
137+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
138+ z-index: 1000;
139+ transition: opacity 0.2s ease-in-out;
140+ }
119141 ` }
120142 </ style >
143+ { showCopyModal && (
144+ < div className = "copy-modal" >
145+ Prompt Copied to Clipboard
146+ </ div >
147+ ) }
121148 < div
122149 style = { {
123150 position : "fixed" ,
@@ -190,22 +217,6 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
190217 </ div >
191218 </ div >
192219 < div style = { { flexGrow : 1 , overflowY : "auto" , margin : 0 } } >
193- { /* {presentableTasks.length === 0 && (
194- <div
195- style={{
196-
197- alignItems: "center",
198- fontStyle: "italic",
199- color: "var(--vscode-descriptionForeground)",
200- textAlign: "center",
201- padding: "0px 10px",
202- }}>
203- <span
204- className="codicon codicon-robot"
205- style={{ fontSize: "60px", marginBottom: "10px" }}></span>
206- <div>Start a task to see it here</div>
207- </div>
208- )} */ }
209220 < Virtuoso
210221 style = { {
211222 flexGrow : 1 ,
@@ -247,15 +258,23 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
247258 } } >
248259 { formatDate ( item . ts ) }
249260 </ span >
250- < VSCodeButton
251- appearance = "icon"
252- onClick = { ( e ) => {
253- e . stopPropagation ( )
254- handleDeleteHistoryItem ( item . id )
255- } }
256- className = "delete-button" >
257- < span className = "codicon codicon-trash" > </ span >
258- </ VSCodeButton >
261+ < div style = { { display : "flex" , gap : "4px" } } >
262+ < VSCodeButton
263+ appearance = "icon"
264+ className = "copy-button"
265+ onClick = { ( e ) => handleCopyTask ( e , item . task ) } >
266+ < span className = "codicon codicon-copy" > </ span >
267+ </ VSCodeButton >
268+ < VSCodeButton
269+ appearance = "icon"
270+ onClick = { ( e ) => {
271+ e . stopPropagation ( )
272+ handleDeleteHistoryItem ( item . id )
273+ } }
274+ className = "delete-button" >
275+ < span className = "codicon codicon-trash" > </ span >
276+ </ VSCodeButton >
277+ </ div >
259278 </ div >
260279 < div
261280 style = { {
0 commit comments