Skip to content

Commit e9ae15d

Browse files
jeremymanningclaude
andcommitted
Add context-dependent logo click behavior and tooltips
Logo/text now acts as navigation: starts mapping from welcome screen, returns to welcome (preserving progress) from map screen, and redirects to user's own session from shared view by stripping the ?t= param. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f7cf3a5 commit e9ae15d

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@
933933
<div id="app" data-screen="welcome">
934934
<header id="app-header">
935935
<div class="header-left">
936-
<div class="logo"><i class="fa-solid fa-map"></i> <span>Knowledge Mapper</span></div>
936+
<div class="logo" data-tooltip="Map my knowledge!"><i class="fa-solid fa-map"></i> <span>Knowledge Mapper</span></div>
937937
<!-- Domain selector placeholder -->
938938
<div class="domain-selector" hidden aria-label="Select knowledge domain"></div>
939939
</div>

src/app.js

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)