@@ -214,20 +214,53 @@ async function boot() {
214214 }
215215 }
216216
217- // Logo click → return to welcome screen (works in both regular and shared views)
217+ // Logo click — context-dependent behavior:
218+ // Welcome screen: start mapping (same as "Map my knowledge!" button)
219+ // Map screen: return to welcome without clearing progress
220+ // Shared view (?t=): reload without token to start user's own session
218221 const logo = headerEl . querySelector ( '.logo' ) ;
222+ const isSharedView = new URLSearchParams ( window . location . search ) . has ( 't' ) ;
219223 if ( logo ) {
220224 logo . style . cursor = 'pointer' ;
225+ if ( isSharedView ) {
226+ logo . setAttribute ( 'data-tooltip' , 'Click here to map out your knowledge!' ) ;
227+ }
221228 logo . addEventListener ( 'click' , ( ) => {
222- // If on map screen with responses, confirm before resetting
223229 const appEl = document . getElementById ( 'app' ) ;
224- if ( appEl && appEl . dataset . screen === 'map' && $responses . get ( ) . length > 0 ) {
225- handleReset ( ) ;
226- } else {
227- // Already on welcome or no responses — just go to welcome
230+ const screen = appEl ?. dataset . screen ;
231+
232+ if ( isSharedView ) {
233+ // Shared view → reload without ?t= param to start user's own session
234+ window . location . href = window . location . origin + window . location . pathname ;
235+ return ;
236+ }
237+
238+ if ( screen === 'welcome' ) {
239+ // Welcome screen → start mapping (same as start button)
240+ if ( allDomainBundle ) {
241+ $activeDomain . set ( 'all' ) ;
242+ }
243+ } else if ( screen === 'map' ) {
244+ // Map screen → return to welcome without clearing progress
245+ unlockOrientation ( ) ;
246+ renderer . abortTransition ( ) ;
247+ toggleQuizPanel ( false ) ;
248+ toggleVideoPanel ( false ) ;
249+ const toggleBtn = document . getElementById ( 'quiz-toggle' ) ;
250+ if ( toggleBtn ) toggleBtn . setAttribute ( 'hidden' , '' ) ;
251+ const videoToggleBtn = document . getElementById ( 'video-toggle' ) ;
252+ if ( videoToggleBtn ) videoToggleBtn . setAttribute ( 'hidden' , '' ) ;
228253 const landing = document . getElementById ( 'landing' ) ;
229254 if ( landing ) landing . classList . remove ( 'hidden' ) ;
230255 if ( appEl ) appEl . dataset . screen = 'welcome' ;
256+ logo . setAttribute ( 'data-tooltip' , 'Map my knowledge!' ) ;
257+ // Re-create particle system for the welcome screen
258+ const pCanvas = document . getElementById ( 'particle-canvas' ) ;
259+ if ( pCanvas && allDomainBundle ) {
260+ particleSystem = new ParticleSystem ( ) ;
261+ const points = subsampleParticlePoints ( allDomainBundle . articles ) ;
262+ particleSystem . initWithPoints ( pCanvas , points ) ;
263+ }
231264 }
232265 } ) ;
233266 }
@@ -529,6 +562,10 @@ async function switchDomain(domainId) {
529562 const appEl = document . getElementById ( 'app' ) ;
530563 if ( appEl ) appEl . dataset . screen = 'map' ;
531564
565+ // Update logo tooltip for map screen
566+ const logo = document . querySelector ( '.logo' ) ;
567+ if ( logo ) logo . setAttribute ( 'data-tooltip' , 'Return to welcome screen' ) ;
568+
532569 // Force landscape on phone-sized devices
533570 lockLandscape ( ) ;
534571
0 commit comments