File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -305,15 +305,18 @@ async function renderProblem() {
305305 const title = problemName . replace ( / - / g, ' ' ) . replace ( / \b \w / g, c => c . toUpperCase ( ) ) ;
306306 const subtitle = state . currentPath . slice ( 0 , - 1 ) . map ( capitalize ) . join ( ' / ' ) ;
307307
308- const repoUrl = `https://github.com/${ getRepoPath ( ) } /tree/main/${ pathStr } ` ;
308+ // Build GitHub file URL if we have a Python file
309+ const githubFileUrl = pyFiles . length > 0
310+ ? `https://github.com/${ getRepoPath ( ) } /blob/main/${ pathStr } /${ pyFiles [ 0 ] . name } `
311+ : `https://github.com/${ getRepoPath ( ) } /tree/main/${ pathStr } ` ;
309312
310313 let html = `
311314 <div class="problem-header">
312315 <div class="problem-nav">
313316 <button onclick="window.goBack()" class="nav-link nav-button">← Back</button>
314317 <a href="#" class="nav-link">🏠 Home</a>
315318 ${ problemUrl ? `<a href="${ problemUrl } " target="_blank" class="nav-link">🔗 Problem</a>` : '' }
316- <a href="${ repoUrl } " target="_blank" class="nav-link">📂 GitHub</a>
319+ <a href="${ githubFileUrl } " target="_blank" class="nav-link">📂 GitHub File </a>
317320 </div>
318321 <h1 class="problem-title">${ title } </h1>
319322 <p class="problem-subtitle">${ subtitle } </p>
You can’t perform that action at this time.
0 commit comments