@@ -241,13 +241,53 @@ class SandboxUI {
241241 title . className = 'feature-title' ;
242242 title . textContent = feature . title ;
243243
244+ // Button container for header buttons
245+ const headerButtonContainer = document . createElement ( 'div' ) ;
246+ headerButtonContainer . style . display = 'flex' ;
247+ headerButtonContainer . style . gap = '0.75rem' ;
248+ headerButtonContainer . style . alignItems = 'center' ;
249+ headerButtonContainer . style . flexWrap = 'wrap' ;
250+
251+ // Map feature keys to documentation filenames
252+ const featureDocMap = {
253+ 'basicUsage' : 'basic-usage' ,
254+ 'baseUrlAndQuery' : 'base-url-query' ,
255+ 'timeout' : 'timeout' ,
256+ 'retry' : 'retry' ,
257+ 'backoffStrategies' : 'backoff-strategies' ,
258+ 'requestHedging' : 'request-hedging' ,
259+ 'debouncer' : 'debouncing' ,
260+ 'deduplicator' : 'deduplication' ,
261+ 'interceptors' : 'interceptors' ,
262+ 'responseTypes' : 'response-types' ,
263+ 'errorHandling' : 'error-handling' ,
264+ 'customDriver' : 'custom-drivers' ,
265+ 'verboseLogging' : 'verbose-logging' ,
266+ 'stats' : 'stats' ,
267+ 'rateLimiting' : 'rate-limiting'
268+ } ;
269+
270+ const docFilename = featureDocMap [ featureKey ] || featureKey ;
271+
272+ // Full Documentation button
273+ const docsBtn = document . createElement ( 'button' ) ;
274+ docsBtn . className = 'btn btn-docs' ;
275+ docsBtn . innerHTML = '📖 Full Documentation' ;
276+ docsBtn . title = 'View full documentation on GitHub' ;
277+ docsBtn . onclick = ( ) => {
278+ const docUrl = `https://github.com/miller-28/luminara/tree/master/docs/features/${ docFilename } .md` ;
279+ window . open ( docUrl , '_blank' , 'noopener,noreferrer' ) ;
280+ } ;
281+ headerButtonContainer . appendChild ( docsBtn ) ;
282+
244283 const runFeatureBtn = document . createElement ( 'button' ) ;
245284 runFeatureBtn . className = 'btn btn-small' ;
246285 runFeatureBtn . textContent = `▶ Run All ${ feature . examples . length } ` ;
247286 runFeatureBtn . onclick = ( ) => this . handleRunFeature ( featureKey ) ;
287+ headerButtonContainer . appendChild ( runFeatureBtn ) ;
248288
249289 header . appendChild ( title ) ;
250- header . appendChild ( runFeatureBtn ) ;
290+ header . appendChild ( headerButtonContainer ) ;
251291
252292 const grid = document . createElement ( 'div' ) ;
253293 grid . className = 'examples-grid' ;
@@ -267,27 +307,6 @@ class SandboxUI {
267307 const card = document . createElement ( 'div' ) ;
268308 card . className = 'example-card' ;
269309 card . id = `example-${ example . id } ` ;
270-
271- // Map feature keys to documentation filenames
272- const featureDocMap = {
273- 'basicUsage' : 'basic-usage' ,
274- 'baseUrlAndQuery' : 'base-url-query' ,
275- 'timeout' : 'timeout' ,
276- 'retry' : 'retry' ,
277- 'backoffStrategies' : 'backoff-strategies' ,
278- 'requestHedging' : 'request-hedging' ,
279- 'debouncer' : 'debouncing' ,
280- 'deduplicator' : 'deduplication' ,
281- 'interceptors' : 'interceptors' ,
282- 'responseTypes' : 'response-types' ,
283- 'errorHandling' : 'error-handling' ,
284- 'customDriver' : 'custom-drivers' ,
285- 'verboseLogging' : 'verbose-logging' ,
286- 'stats' : 'stats' ,
287- 'rateLimiting' : 'rate-limiting'
288- } ;
289-
290- const docFilename = featureDocMap [ featureKey ] || featureKey ;
291310
292311 const cardHeader = document . createElement ( 'div' ) ;
293312 cardHeader . className = 'example-header' ;
@@ -301,26 +320,6 @@ class SandboxUI {
301320 buttonContainer . style . gap = '6px' ;
302321 buttonContainer . style . flexWrap = 'wrap' ;
303322
304- // Full Documentation button
305- const docsBtn = document . createElement ( 'button' ) ;
306- docsBtn . className = 'example-docs-btn' ;
307- docsBtn . innerHTML = '📖 Docs' ;
308- docsBtn . title = 'View full documentation on GitHub' ;
309- docsBtn . onclick = ( ) => {
310- const docUrl = `https://github.com/miller-28/luminara/tree/master/docs/features/${ docFilename } .md` ;
311- window . open ( docUrl , '_blank' , 'noopener,noreferrer' ) ;
312- } ;
313- buttonContainer . appendChild ( docsBtn ) ;
314-
315- // Code button (if example has code)
316- if ( example . code ) {
317- const codeBtn = document . createElement ( 'button' ) ;
318- codeBtn . className = 'example-code-btn' ;
319- codeBtn . innerHTML = '📄 Code' ;
320- codeBtn . onclick = ( ) => this . handleShowCode ( example . title , example . code ) ;
321- buttonContainer . appendChild ( codeBtn ) ;
322- }
323-
324323 const runBtn = document . createElement ( 'button' ) ;
325324 runBtn . className = 'btn btn-small' ;
326325 runBtn . textContent = '▶ Run' ;
@@ -337,6 +336,18 @@ class SandboxUI {
337336 buttonContainer . appendChild ( runBtn ) ;
338337 buttonContainer . appendChild ( stopBtn ) ;
339338
339+ // Code button (if example has code)
340+ if ( example . code ) {
341+ const codeBtn = document . createElement ( 'button' ) ;
342+ codeBtn . className = 'example-code-btn' ;
343+ codeBtn . innerHTML = '📄 Code' ;
344+ codeBtn . onclick = ( ) => this . handleShowCode ( example . title , example . code ) ;
345+ buttonContainer . appendChild ( codeBtn ) ;
346+ }
347+ stopBtn . style . display = 'none' ;
348+ stopBtn . onclick = ( ) => this . handleStopTest ( example . id ) ;
349+ this . stopButtonElements . set ( example . id , stopBtn ) ;
350+
340351 cardHeader . appendChild ( titleDiv ) ;
341352 cardHeader . appendChild ( buttonContainer ) ;
342353
0 commit comments