@@ -95,6 +95,17 @@ export class PreviousResponsesDropdown {
9595 this . menu = menu ;
9696 this . position ( ) ;
9797
98+ menu
99+ . querySelectorAll < HTMLButtonElement > ( '.response-history-row__open' )
100+ . forEach ( ( btn ) => {
101+ btn . addEventListener ( 'click' , ( e ) => {
102+ e . stopPropagation ( ) ;
103+ const idx = Number ( btn . dataset . idx ) ;
104+ const item = previous [ idx ] ;
105+ if ( item ) this . openPrevious ( item ) ;
106+ } ) ;
107+ } ) ;
108+
98109 menu
99110 . querySelectorAll < HTMLButtonElement > ( '.response-history-row__compare' )
100111 . forEach ( ( btn ) => {
@@ -124,7 +135,7 @@ export class PreviousResponsesDropdown {
124135 private position ( ) : void {
125136 if ( ! this . menu || ! this . button ) return ;
126137 const rect = this . button . getBoundingClientRect ( ) ;
127- const menuWidth = 320 ;
138+ const menuWidth = 420 ;
128139 const left = Math . min (
129140 window . innerWidth - menuWidth - 8 ,
130141 Math . max ( 8 , rect . right - menuWidth )
@@ -154,13 +165,38 @@ export class PreviousResponsesDropdown {
154165 <div class="response-history-row__meta">
155166 <span class="response-history-row__status ${ statusClass } ">${ status } </span>
156167 <span class="response-history-row__time">${ time } </span>
157- <span class="response-history-row__ts">${ ts . toLocaleString ( ) } </span>
168+ <span class="response-history-row__ts">${ ts . toLocaleString ( undefined , { hour12 : true } ) } </span>
158169 </div>
170+ <button type="button" class="response-history-row__open" data-idx="${ idx } ">Open</button>
159171 <button type="button" class="response-history-row__compare" data-idx="${ idx } ">Compare</button>
160172 </div>
161173 ` ;
162174 }
163175
176+ private openPrevious ( previous : HistoryItem ) : void {
177+ const body = previous . response ?. body || '' ;
178+ if ( ! body . trim ( ) ) {
179+ document . dispatchEvent (
180+ new CustomEvent ( 'show-toast' , {
181+ detail : {
182+ type : 'info' ,
183+ message :
184+ 'This previous response has no body. Re-send the request to capture a fresh snapshot.' ,
185+ } ,
186+ } )
187+ ) ;
188+ this . close ( ) ;
189+ return ;
190+ }
191+
192+ document . dispatchEvent (
193+ new CustomEvent ( 'display-previous-response' , {
194+ detail : { response : previous . response } ,
195+ } )
196+ ) ;
197+ this . close ( ) ;
198+ }
199+
164200 private openCompare ( previous : HistoryItem ) : void {
165201 const left = this . currentResponse ?. body || '' ;
166202 const right = previous . response ?. body || '' ;
0 commit comments