@@ -123,17 +123,26 @@ class ExtensionPanel {
123123
124124 this . unsubscribe = this . store . subscribe ( ( ) => {
125125 const currentState = this . store . state ;
126+ const activeView = this . viewModel . getState ( ) . activeView ;
126127
127128 if ( currentState !== this . lastConnectionState ) {
128129 this . lastConnectionState = currentState ;
129130
130131 if ( currentState === "not_detected" ) {
131- this . showNotDetected ( ) ;
132+ if ( activeView === "import" ) {
133+ this . renderScheduler . immediate ( ( ) => this . render ( ) ) ;
134+ } else {
135+ this . showNotDetected ( ) ;
136+ }
132137 return ;
133138 }
134139
135140 if ( currentState === "connecting" ) {
136- this . showConnecting ( ) ;
141+ if ( activeView === "import" ) {
142+ this . renderScheduler . immediate ( ( ) => this . render ( ) ) ;
143+ } else {
144+ this . showConnecting ( ) ;
145+ }
137146 return ;
138147 }
139148
@@ -273,7 +282,7 @@ class ExtensionPanel {
273282 flex-direction: column;
274283 align-items: center;
275284 justify-content: center;
276- height: 100% ;
285+ flex: 1 ;
277286 padding: 40px;
278287 text-align: center;
279288 color: var(--spoosh-text-muted);
@@ -323,6 +332,23 @@ class ExtensionPanel {
323332 to { transform: rotate(360deg); }
324333 }
325334
335+ .spoosh-go-import-btn {
336+ margin-top: 16px;
337+ padding: 8px 16px;
338+ background: var(--spoosh-primary);
339+ color: white;
340+ border: none;
341+ border-radius: 6px;
342+ font-size: 13px;
343+ font-weight: 500;
344+ cursor: pointer;
345+ transition: opacity 0.15s;
346+ }
347+
348+ .spoosh-go-import-btn:hover {
349+ opacity: 0.9;
350+ }
351+
326352 /* Remove drag cursors in extension context */
327353 .spoosh-header,
328354 .spoosh-settings-header,
@@ -334,37 +360,47 @@ class ExtensionPanel {
334360 }
335361
336362 private showNotDetected ( ) : void {
337- const notDetectedHtml = `
363+ const state = this . viewModel . getState ( ) ;
364+ const html = `
338365 <div class="not-detected">
339366 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
340367 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
341368 </svg>
342369 <h2>Spoosh not detected</h2>
343- <p>This page doesn't appear to be using Spoosh, or the devtool plugin is not enabled. Make sure you have the <code>devtool()</code> plugin registered in your Spoosh instance.</p>
370+ <p>This page doesn't appear to be using Spoosh, or the devtool plugin is not enabled.</p>
371+ <button class="spoosh-go-import-btn" data-action="go-import">Go to Import View</button>
344372 </div>
373+ ${ renderBottomBar ( { activeView : state . activeView , theme : state . theme } ) }
345374 ` ;
346375 this . container . textContent = "" ;
347- this . container . insertAdjacentHTML ( "beforeend" , notDetectedHtml ) ;
376+ this . container . insertAdjacentHTML ( "beforeend" , html ) ;
377+ this . attachEvents ( ) ;
348378 }
349379
350380 private showConnecting ( ) : void {
351- const connectingHtml = `
381+ const state = this . viewModel . getState ( ) ;
382+ const html = `
352383 <div class="not-detected connecting">
353384 <div class="connecting-spinner"></div>
354385 <h2>Connecting...</h2>
355386 <p>Waiting for Spoosh to initialize on this page.</p>
356387 </div>
388+ ${ renderBottomBar ( { activeView : state . activeView , theme : state . theme } ) }
357389 ` ;
358390 this . container . textContent = "" ;
359- this . container . insertAdjacentHTML ( "beforeend" , connectingHtml ) ;
391+ this . container . insertAdjacentHTML ( "beforeend" , html ) ;
392+ this . attachEvents ( ) ;
360393 }
361394
362395 private renderImmediate ( ) : void {
363396 this . renderScheduler . immediate ( ( ) => this . render ( ) ) ;
364397 }
365398
366399 private render ( ) : void {
367- if ( this . store . state !== "connected" ) {
400+ const state = this . viewModel . getState ( ) ;
401+ const isConnected = this . store . state === "connected" ;
402+
403+ if ( ! isConnected && state . activeView !== "import" ) {
368404 if ( this . store . state === "connecting" ) {
369405 this . showConnecting ( ) ;
370406 } else {
@@ -373,9 +409,10 @@ class ExtensionPanel {
373409 return ;
374410 }
375411
376- this . autoSelectFirst ( ) ;
412+ if ( isConnected ) {
413+ this . autoSelectFirst ( ) ;
414+ }
377415
378- const state = this . viewModel . getState ( ) ;
379416 this . lastRenderedTraceId = state . selectedTraceId ;
380417 this . lastRenderedStateKey = state . selectedStateKey ;
381418 this . lastRenderedInternalTab = state . internalTab ;
0 commit comments