Skip to content

Commit 15974ec

Browse files
committed
Added js debugging
1 parent 8982b59 commit 15974ec

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

script.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,20 @@ window.addEventListener('hashchange', () => {
316316
if (!hash) {
317317
navigateToHome();
318318
} else if (hash.startsWith('view/')) {
319-
const [, platform, problemName] = hash.split('/');
319+
const parts = hash.split('/');
320+
const platform = parts[1];
321+
const problemName = decodeURIComponent(parts.slice(2).join('/'));
320322
const problem = state.data[platform]?.find(p => p.name === problemName);
321323
if (problem) {
322324
state.currentView = 'problem';
323325
state.currentPlatform = platform;
324326
state.currentProblem = problem;
325327
render();
328+
} else {
329+
// Problem not found, go to platform list
330+
state.currentView = 'list';
331+
state.currentPlatform = platform;
332+
render();
326333
}
327334
} else if (['leetcode', 'kattis', 'vicutils'].includes(hash)) {
328335
navigateToPlatform(hash);
@@ -349,12 +356,15 @@ window.addEventListener('hashchange', () => {
349356
const parts = hash.split('/');
350357
const platform = parts[1];
351358
const problemName = decodeURIComponent(parts.slice(2).join('/'));
359+
console.log('Looking for problem:', problemName, 'in platform:', platform);
360+
console.log('Available problems:', state.data[platform]?.map(p => p.name));
352361
const problem = state.data[platform]?.find(p => p.name === problemName);
353362
if (problem) {
354363
state.currentView = 'problem';
355364
state.currentPlatform = platform;
356365
state.currentProblem = problem;
357366
} else {
367+
console.warn('Problem not found:', problemName);
358368
state.currentView = 'platforms';
359369
}
360370
} else if (['leetcode', 'kattis', 'vicutils'].includes(hash)) {

0 commit comments

Comments
 (0)