Skip to content

Commit 606d3c3

Browse files
author
Vic-Nas
committed
Fixed file link
1 parent 4cc9c46 commit 606d3c3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

script.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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>

0 commit comments

Comments
 (0)