Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/challenge-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ function initChallengeSelect(root, selectedChallenge) {
});
}

function initAdjacentLinks(root, selectedChallenge) {
const currentIndex = window.SQL_CHALLENGES.findIndex((challenge) => challenge.folder === selectedChallenge.folder);
const previous = window.SQL_CHALLENGES[(currentIndex - 1 + window.SQL_CHALLENGES.length) % window.SQL_CHALLENGES.length];
const next = window.SQL_CHALLENGES[(currentIndex + 1) % window.SQL_CHALLENGES.length];
const previousLink = root.querySelector("[data-previous-challenge]");
const nextLink = root.querySelector("[data-next-challenge]");

previousLink.href = `challenge.html?id=${encodeURIComponent(previous.folder)}`;
previousLink.textContent = `Previous: ${previous.id}`;
previousLink.setAttribute("aria-label", `Open previous challenge, ${previous.title}`);
nextLink.href = `challenge.html?id=${encodeURIComponent(next.folder)}`;
nextLink.textContent = `Next: ${next.id}`;
nextLink.setAttribute("aria-label", `Open next challenge, ${next.title}`);
}

function getFileUrl(challenge, file) {
return `${RAW_BASE}/${challenge.folder}/${file.file}`;
}
Expand Down Expand Up @@ -224,9 +239,11 @@ function initChallengeViewer() {
root.querySelector("[data-viewer-id]").textContent = challenge.id;
root.querySelector("[data-viewer-skill]").textContent = window.SQL_SKILL_LABELS[challenge.skill];
root.querySelector("[data-viewer-difficulty]").textContent = window.SQL_DIFFICULTY_LABELS[challenge.difficulty];
root.querySelector("[data-breadcrumb-current]").textContent = `Challenge ${challenge.id}`;
root.querySelector("[data-github-link]").href = `${GITHUB_BASE}/${challenge.folder}`;
root.querySelector("[data-run-command]").textContent = getRunCommand(challenge);
initChallengeSelect(root, challenge);
initAdjacentLinks(root, challenge);

const state = {
challenge,
Expand Down
26 changes: 23 additions & 3 deletions docs/challenge.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,25 @@
<nav class="nav" aria-label="Primary navigation">
<a class="brand" href="index.html">SQL Mini Challenges</a>
<div class="nav-links">
<a href="index.html">Home</a>
<a href="index.html#challenge-finder">Finder</a>
<a href="https://github.com/Bmowville/sql-mini-challenges#challenge-index">Challenges</a>
<a href="challenge.html">Viewer</a>
<a href="https://github.com/Bmowville/sql-mini-challenges#challenge-index">Challenge Index</a>
<a href="https://github.com/Bmowville/sql-mini-challenges/blob/main/docs/learning-paths.md">Learning Paths</a>
<a href="https://github.com/Bmowville/sql-mini-challenges/releases/latest">Latest Release</a>
<a class="nav-cta" href="https://github.com/Bmowville/sql-mini-challenges">GitHub</a>
</div>
</nav>
</header>

<main class="viewer-main" data-challenge-viewer>
<nav class="breadcrumb" aria-label="Breadcrumb">
<a href="index.html">Home</a>
<span>/</span>
<a href="index.html#challenge-finder">Finder</a>
<span>/</span>
<span data-breadcrumb-current>Challenge viewer</span>
</nav>

<section class="viewer-hero" aria-labelledby="viewer-title">
<div>
<p class="eyebrow" data-viewer-kicker>Challenge viewer</p>
Expand All @@ -39,6 +49,11 @@ <h1 id="viewer-title" data-viewer-title>Loading challenge...</h1>
<div class="actions" aria-label="Challenge links">
<a class="button primary" data-github-link href="https://github.com/Bmowville/sql-mini-challenges">Open on GitHub</a>
<a class="button" href="index.html#challenge-finder">Back to Finder</a>
<a class="button" href="index.html">Home</a>
</div>
<div class="viewer-sequence" aria-label="Adjacent challenges">
<a class="button" data-previous-challenge href="challenge.html">Previous challenge</a>
<a class="button" data-next-challenge href="challenge.html">Next challenge</a>
</div>
</div>
<aside class="viewer-run-card" aria-labelledby="run-heading">
Expand Down Expand Up @@ -89,7 +104,12 @@ <h2 id="files-heading">Read the prompt, inspect the SQL, then compare expected o

<footer class="site-footer">
<span>Built for local SQL practice and review.</span>
<a href="index.html#challenge-finder">Find another challenge</a>
<div class="footer-links" aria-label="Footer navigation">
<a href="index.html">Home</a>
<a href="index.html#challenge-finder">Finder</a>
<a href="challenge.html">Viewer</a>
<a href="https://github.com/Bmowville/sql-mini-challenges">Repository</a>
</div>
</footer>
</body>
</html>
49 changes: 41 additions & 8 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<body>
<header class="site-header">
<nav class="nav" aria-label="Primary navigation">
<a class="brand" href="https://github.com/Bmowville/sql-mini-challenges">SQL Mini Challenges</a>
<a class="brand" href="index.html">SQL Mini Challenges</a>
<div class="nav-links">
<a href="https://github.com/Bmowville/sql-mini-challenges#challenge-index">Challenges</a>
<a href="#challenge-finder">Finder</a>
<a href="challenge.html?id=001_passenger_survival">Viewer</a>
<a href="challenge.html">Viewer</a>
<a href="https://github.com/Bmowville/sql-mini-challenges#challenge-index">Challenge Index</a>
<a href="https://github.com/Bmowville/sql-mini-challenges/blob/main/docs/learning-paths.md">Learning Paths</a>
<a href="https://github.com/Bmowville/sql-mini-challenges/blob/main/docs/challenge-roadmap.md">Roadmap</a>
<a href="https://github.com/Bmowville/sql-mini-challenges/releases/latest">Latest Release</a>
<a class="nav-cta" href="https://github.com/Bmowville/sql-mini-challenges">GitHub</a>
</div>
</nav>
</header>
Expand All @@ -35,10 +35,10 @@ <h1 id="page-title">40 SQL analytics challenges with validated answers.</h1>
Practice cohorts, retention, window functions, revenue analysis, and data engineering SQL patterns with small datasets you can run locally.
</p>
<div class="actions" aria-label="Primary links">
<a class="button primary" href="https://github.com/Bmowville/sql-mini-challenges">Open Repository</a>
<a class="button primary" href="challenge.html">Open Challenge Viewer</a>
<a class="button" href="#challenge-finder">Find a Challenge</a>
<a class="button" href="https://github.com/Bmowville/sql-mini-challenges#challenge-index">Browse Challenges</a>
<a class="button" href="https://github.com/Bmowville/sql-mini-challenges/blob/main/docs/challenge-roadmap.md">Suggest a Challenge</a>
<a class="button" href="https://github.com/Bmowville/sql-mini-challenges">Open Repository</a>
<a class="button" href="https://github.com/Bmowville/sql-mini-challenges#challenge-index">Browse Index</a>
</div>
</div>
<div class="query-preview" aria-label="Example SQL challenge output">
Expand Down Expand Up @@ -72,6 +72,33 @@ <h1 id="page-title">40 SQL analytics challenges with validated answers.</h1>
</div>
</section>

<section class="content-section start-section" aria-labelledby="start-heading">
<div class="section-heading">
<p class="eyebrow">Start here</p>
<h2 id="start-heading">Move from selection to review without losing context.</h2>
</div>
<div class="start-grid">
<article>
<span>1</span>
<h3>Pick a challenge</h3>
<p>Use the finder to filter by skill area and difficulty, or jump straight into the first challenge.</p>
<a href="#challenge-finder">Open Finder</a>
</article>
<article>
<span>2</span>
<h3>Read it in the viewer</h3>
<p>Open the prompt, schema, solution, and expected output without leaving the project site.</p>
<a href="challenge.html">Open Viewer</a>
</article>
<article>
<span>3</span>
<h3>Run it locally</h3>
<p>Copy the SQL commands, compare against the validated snapshot, and inspect the source on GitHub.</p>
<a href="https://github.com/Bmowville/sql-mini-challenges">Open Repository</a>
</article>
</div>
</section>

<section class="content-section finder-section" id="challenge-finder" aria-labelledby="finder-heading">
<div class="section-heading">
<p class="eyebrow">Challenge finder</p>
Expand Down Expand Up @@ -169,7 +196,13 @@ <h2 id="contribute-heading">Bring a realistic analytics question.</h2>

<footer class="site-footer">
<span>Built for local SQL practice and review.</span>
<a href="https://github.com/Bmowville/sql-mini-challenges/blob/main/CONTRIBUTING.md">Contribute a challenge</a>
<div class="footer-links" aria-label="Footer navigation">
<a href="index.html">Home</a>
<a href="#challenge-finder">Finder</a>
<a href="challenge.html">Viewer</a>
<a href="https://github.com/Bmowville/sql-mini-challenges">Repository</a>
<a href="https://github.com/Bmowville/sql-mini-challenges/blob/main/CONTRIBUTING.md">Contribute</a>
</div>
</footer>
</body>
</html>
88 changes: 87 additions & 1 deletion docs/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,17 @@ main,
text-decoration: none;
}

.nav-cta {
padding: 4px 10px;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--bg);
}

.nav-links a:hover,
.brand:hover,
.site-footer a:hover {
.site-footer a:hover,
.start-grid a:hover {
color: var(--accent);
}

Expand Down Expand Up @@ -156,6 +164,7 @@ h3 {
}

.query-preview {
min-width: 0;
overflow: hidden;
border: 1px solid #263646;
border-radius: 8px;
Expand Down Expand Up @@ -210,6 +219,7 @@ code {
}

.metrics span,
.start-grid p,
.path-grid p,
.split p {
color: var(--muted);
Expand Down Expand Up @@ -341,10 +351,64 @@ code {
min-height: auto;
}

.start-section {
padding-top: 56px;
}

.start-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 16px;
}

.start-grid article {
display: grid;
gap: 12px;
min-height: 220px;
padding: 22px;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--surface);
}

.start-grid span {
display: inline-flex;
align-items: center;
justify-content: center;
width: 34px;
height: 34px;
border-radius: 8px;
background: var(--accent);
color: #ffffff;
font-weight: 700;
}

.start-grid a {
align-self: end;
color: var(--accent);
font-weight: 650;
text-decoration: none;
}

.viewer-main {
padding-bottom: 72px;
}

.breadcrumb {
display: flex;
flex-wrap: wrap;
gap: 8px;
padding-top: 28px;
color: var(--muted);
font-size: 0.92rem;
}

.breadcrumb a {
color: var(--accent);
font-weight: 650;
text-decoration: none;
}

.viewer-hero {
display: grid;
grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
Expand All @@ -367,6 +431,13 @@ code {
font-weight: 650;
}

.viewer-sequence {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 14px;
}

.viewer-meta span {
padding: 6px 10px;
border: 1px solid var(--line);
Expand All @@ -376,6 +447,7 @@ code {

.viewer-run-card,
.viewer-panel {
min-width: 0;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--surface);
Expand Down Expand Up @@ -525,10 +597,17 @@ code {
margin-top: 18px;
border-radius: 8px;
background: var(--surface-strong);
white-space: pre-wrap;
}

.command code {
overflow-wrap: anywhere;
white-space: pre-wrap;
}

.site-footer {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 16px;
padding: 22px 0;
Expand All @@ -542,6 +621,12 @@ code {
text-decoration: none;
}

.footer-links {
display: flex;
flex-wrap: wrap;
gap: 14px;
}

@media (max-width: 860px) {
.nav,
.site-footer {
Expand All @@ -565,6 +650,7 @@ code {
}

.metrics,
.start-grid,
.path-grid,
.result-grid,
.finder-controls {
Expand Down
Loading