From dd066e350d783d1bf8af99191fcacb5daab85597 Mon Sep 17 00:00:00 2001 From: Maximus Smith Date: Thu, 4 Sep 2025 19:09:00 -0700 Subject: [PATCH 1/6] Layout: WIP. Jumping to location works, but only first matching title --- assets/js/sidebar-v2.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/assets/js/sidebar-v2.js b/assets/js/sidebar-v2.js index 042d8c6d..f74e351b 100644 --- a/assets/js/sidebar-v2.js +++ b/assets/js/sidebar-v2.js @@ -37,6 +37,21 @@ document.addEventListener('click', (e) => { } }); +document.addEventListener('DOMContentLoaded', () => { + // need to correlate path to page rather than h1, as headers can be repeated (ie. nested1c/nested2-1 is seen the same as nested1b/nested2-1) + const currentPage = document.querySelector("h1").textContent; + console.log("This is a test log "+currentPage); + + const match = Array.from(document.querySelectorAll(".sidebar__link")) + .find(el => el.textContent.includes(currentPage)); + + if (match){ + console.log("Matching pair? "+match) + match.scrollIntoView({ behavior: "instant", block: "nearest" }); + } + +}); + const debounce = (callback, wait) => { let timeoutId = null; return (...args) => { @@ -51,7 +66,7 @@ window.addEventListener( 'resize', debounce(() => { const sidebar = document.getElementById('sidebar-v2'); - + console.log("This is a test log") if ( window.innerWidth > 88 * 16 && sidebar.classList.contains('sidebar__mobile-open') @@ -60,3 +75,5 @@ window.addEventListener( } }, 200) ); + + From e14330b80a92d02ef0695c90a87d82d050289564 Mon Sep 17 00:00:00 2001 From: Maximus Smith Date: Fri, 5 Sep 2025 12:33:12 -0700 Subject: [PATCH 2/6] Layout: Scroll references href now and works completely --- assets/js/sidebar-v2.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/assets/js/sidebar-v2.js b/assets/js/sidebar-v2.js index f74e351b..cbb4c4fa 100644 --- a/assets/js/sidebar-v2.js +++ b/assets/js/sidebar-v2.js @@ -38,18 +38,12 @@ document.addEventListener('click', (e) => { }); document.addEventListener('DOMContentLoaded', () => { - // need to correlate path to page rather than h1, as headers can be repeated (ie. nested1c/nested2-1 is seen the same as nested1b/nested2-1) - const currentPage = document.querySelector("h1").textContent; - console.log("This is a test log "+currentPage); - + const currentPage = window.location.href; const match = Array.from(document.querySelectorAll(".sidebar__link")) - .find(el => el.textContent.includes(currentPage)); + .find(el => el.href.includes(currentPage)); - if (match){ - console.log("Matching pair? "+match) + if (match) match.scrollIntoView({ behavior: "instant", block: "nearest" }); - } - }); const debounce = (callback, wait) => { From 4652b1ec5ebada87fb56ff829d2ef8a22e9287e6 Mon Sep 17 00:00:00 2001 From: Maximus Smith Date: Mon, 8 Sep 2025 15:21:38 -0700 Subject: [PATCH 3/6] Layout: Cleared logging and lint errors --- assets/css/v2/style.css | 9 +++++++-- assets/js/sidebar-v2.js | 13 +++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index efee6679..fabc0c02 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -134,9 +134,14 @@ textarea:not([rows]) { /* More info: https://docs.coveo.com/en/atomic/latest/usage/themes-and-visual-customization/ */ /* biome-ignore lint: Coveo override */ - --atomic-primary: oklch(var(--color-brand)) !important; /* Adjust the primary color */ + --atomic-primary: oklch( + var(--color-brand) + ) !important; /* Adjust the primary color */ /* biome-ignore lint: necessary override */ - --atomic-ring-primary: oklch(var(--color-brand) / 0.4) !important; /* Adjust the focus color */ + --atomic-ring-primary: oklch( + var(--color-brand) / + 0.4 + ) !important; /* Adjust the focus color */ /* biome-ignore lint: necessary override */ --atomic-primary-light: oklch(var(--color-brand)) !important; --atomic-background: oklch(0.9911 0 0) !important; diff --git a/assets/js/sidebar-v2.js b/assets/js/sidebar-v2.js index cbb4c4fa..e62d39e9 100644 --- a/assets/js/sidebar-v2.js +++ b/assets/js/sidebar-v2.js @@ -38,12 +38,12 @@ document.addEventListener('click', (e) => { }); document.addEventListener('DOMContentLoaded', () => { - const currentPage = window.location.href; - const match = Array.from(document.querySelectorAll(".sidebar__link")) - .find(el => el.href.includes(currentPage)); + const currentPage = window.location.href; + const match = Array.from(document.querySelectorAll('.sidebar__link')).find( + (el) => el.href.includes(currentPage) + ); - if (match) - match.scrollIntoView({ behavior: "instant", block: "nearest" }); + if (match) match.scrollIntoView({ behavior: 'instant', block: 'nearest' }); }); const debounce = (callback, wait) => { @@ -60,7 +60,6 @@ window.addEventListener( 'resize', debounce(() => { const sidebar = document.getElementById('sidebar-v2'); - console.log("This is a test log") if ( window.innerWidth > 88 * 16 && sidebar.classList.contains('sidebar__mobile-open') @@ -69,5 +68,3 @@ window.addEventListener( } }, 200) ); - - From 3a38e082d4b3bc2ea9021e8c8641c9356ee173a2 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Tue, 9 Sep 2025 10:21:51 -0700 Subject: [PATCH 4/6] Layout: Fixed biome issues --- assets/css/v2/style.css | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index fabc0c02..efee6679 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -134,14 +134,9 @@ textarea:not([rows]) { /* More info: https://docs.coveo.com/en/atomic/latest/usage/themes-and-visual-customization/ */ /* biome-ignore lint: Coveo override */ - --atomic-primary: oklch( - var(--color-brand) - ) !important; /* Adjust the primary color */ + --atomic-primary: oklch(var(--color-brand)) !important; /* Adjust the primary color */ /* biome-ignore lint: necessary override */ - --atomic-ring-primary: oklch( - var(--color-brand) / - 0.4 - ) !important; /* Adjust the focus color */ + --atomic-ring-primary: oklch(var(--color-brand) / 0.4) !important; /* Adjust the focus color */ /* biome-ignore lint: necessary override */ --atomic-primary-light: oklch(var(--color-brand)) !important; --atomic-background: oklch(0.9911 0 0) !important; From dd3e3dd6ef5a9554fce8d1df886133fae3c77a7e Mon Sep 17 00:00:00 2001 From: Maximus Smith <38636635+maximusmith529@users.noreply.github.com> Date: Tue, 9 Sep 2025 12:35:22 -0700 Subject: [PATCH 5/6] Layout: Changed scroll to be at the top --- assets/js/sidebar-v2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/sidebar-v2.js b/assets/js/sidebar-v2.js index e62d39e9..2860efd6 100644 --- a/assets/js/sidebar-v2.js +++ b/assets/js/sidebar-v2.js @@ -43,7 +43,7 @@ document.addEventListener('DOMContentLoaded', () => { (el) => el.href.includes(currentPage) ); - if (match) match.scrollIntoView({ behavior: 'instant', block: 'nearest' }); + if (match) match.scrollIntoView({ behavior: 'instant', block: 'start' }); }); const debounce = (callback, wait) => { From dd8410b39b941f1541a646440182a9cd36011317 Mon Sep 17 00:00:00 2001 From: Maximus Smith Date: Wed, 10 Sep 2025 09:54:18 -0700 Subject: [PATCH 6/6] Layout: Change currentpage to use path over HREF --- assets/js/sidebar-v2.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/js/sidebar-v2.js b/assets/js/sidebar-v2.js index 2860efd6..dc413f57 100644 --- a/assets/js/sidebar-v2.js +++ b/assets/js/sidebar-v2.js @@ -38,10 +38,10 @@ document.addEventListener('click', (e) => { }); document.addEventListener('DOMContentLoaded', () => { - const currentPage = window.location.href; - const match = Array.from(document.querySelectorAll('.sidebar__link')).find( - (el) => el.href.includes(currentPage) - ); + const currentPage = window.location.pathname; + const match = Array.from( + document.querySelectorAll('.sidebar__link--current') + ).find((el) => el?.id?.includes(currentPage)); if (match) match.scrollIntoView({ behavior: 'instant', block: 'start' }); });