From 506fb823dcabcacb96bc34a55071d03c98c3bb7f Mon Sep 17 00:00:00 2001 From: Jason Karlavige Date: Mon, 19 Aug 2024 16:55:05 -0400 Subject: [PATCH 1/8] get customDisplay showing on selected version --- website/dbt-versions.js | 3 +- website/src/stores/VersionContext.js | 5 +- .../theme/NavbarItem/DropdownNavbarItem.js | 113 ++++++++++-------- 3 files changed, 71 insertions(+), 50 deletions(-) diff --git a/website/dbt-versions.js b/website/dbt-versions.js index 7430450da50..4e1c2c2162e 100644 --- a/website/dbt-versions.js +++ b/website/dbt-versions.js @@ -2,6 +2,7 @@ exports.versions = [ { version: "1.9", isPrerelease: true, + customDisplay: "dbt Cloud" }, { version: "1.8", @@ -169,4 +170,4 @@ exports.versionedCategories = [ "category": "Build your metrics", "firstVersion": "1.6", } -] \ No newline at end of file +] diff --git a/website/src/stores/VersionContext.js b/website/src/stores/VersionContext.js index a87ceb3e429..bedf65cd1bd 100644 --- a/website/src/stores/VersionContext.js +++ b/website/src/stores/VersionContext.js @@ -66,9 +66,12 @@ export const VersionContextProvider = ({ value = "", children }) => { // Determine isPrerelease status + End of Life date for current version const currentVersion = versions.find(ver => ver.version === version) - if(currentVersion) + if(currentVersion) { + console.log("currentVersion", currentVersion); context.EOLDate = currentVersion.EOLDate context.isPrerelease = currentVersion?.isPrerelease + context.customDisplay = currentVersion?.customDisplay; + } // Get latest stable release const latestStableRelease = versions.find(ver => !ver?.isPrerelease) diff --git a/website/src/theme/NavbarItem/DropdownNavbarItem.js b/website/src/theme/NavbarItem/DropdownNavbarItem.js index 8c29daeac21..54ca495a6a6 100644 --- a/website/src/theme/NavbarItem/DropdownNavbarItem.js +++ b/website/src/theme/NavbarItem/DropdownNavbarItem.js @@ -79,73 +79,90 @@ function DropdownNavbarItemDesktop({ setShowVersionDropdown(true) }, [showVersionDropdown]) + console.log("versionContext", versionContext); + return (
+ className={clsx("navbar__item", "dropdown", "dropdown--hoverable", { + "dropdown--right": position === "right", + "dropdown--show": showDropdown, + "dropdown--version--hide": !showVersionDropdown, + })} + > e.preventDefault()} onKeyDown={(e) => { - if (e.key === 'Enter') { + if (e.key === "Enter") { e.preventDefault(); setShowDropdown(!showDropdown); } }} - label={className === "nav-versioning" ? `v${versionContext.version} ${versionContext?.isPrerelease ? "(Beta)" : ""}` : props.children ?? props.label} + label={ + className === "nav-versioning" + ? `${versionContext?.customDisplay ? `${versionContext.customDisplay}` : `v${versionContext.version} ${versionContext?.isPrerelease ? "(Beta)" : ""}`}` + : props.children ?? props.label + } > {props.children ?? props.label}
); From bdd3fc5fb37a7697b230e724772fac126d40faed Mon Sep 17 00:00:00 2001 From: Jason Karlavige Date: Tue, 20 Aug 2024 15:21:55 -0400 Subject: [PATCH 2/8] show custom display name if set for desktop nav --- website/src/theme/NavbarItem/DropdownNavbarItem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/src/theme/NavbarItem/DropdownNavbarItem.js b/website/src/theme/NavbarItem/DropdownNavbarItem.js index 54ca495a6a6..4e8eeccfa5a 100644 --- a/website/src/theme/NavbarItem/DropdownNavbarItem.js +++ b/website/src/theme/NavbarItem/DropdownNavbarItem.js @@ -114,11 +114,10 @@ function DropdownNavbarItemDesktop({