Skip to content

Commit 94018a4

Browse files
committed
fix
Signed-off-by: dbczumar <[email protected]>
1 parent 30c90d4 commit 94018a4

File tree

3 files changed

+33
-19
lines changed

3 files changed

+33
-19
lines changed

website/src/components/GetStartedWithMLflow/GetStartedWithMLflow.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import useBaseUrl from "@docusaurus/useBaseUrl";
55
import useBrokenLinks from "@docusaurus/useBrokenLinks";
66

77
import { GetStartedButton } from "../GetStartedButton/GetStartedButton";
8-
import { cn } from "../../utils";
8+
import { cn, isClassicalMLPage } from "../../utils";
99
import { Heading } from "../Typography/Heading";
1010
import { Body } from "../Typography/Body";
1111
import { useLayoutVariant } from "../Layout/Layout";
@@ -19,11 +19,11 @@ export const GetStartedWithMLflow = () => {
1919
const variant = useLayoutVariant();
2020
const location = useLocation();
2121
const classicalMLPath = useBaseUrl("/classical-ml");
22-
const isClassicalMLPage = location.pathname.startsWith(classicalMLPath);
23-
const databricksUrl = isClassicalMLPage
22+
const isClassicalML = isClassicalMLPage(location.pathname, classicalMLPath);
23+
const databricksUrl = isClassicalML
2424
? MLFLOW_DBX_INSTALL_URL
2525
: MLFLOW_DBX_TRIAL_URL;
26-
const databricksButtonText = isClassicalMLPage
26+
const databricksButtonText = isClassicalML
2727
? "Get started"
2828
: "Get started for free";
2929

website/src/components/Header/Header.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import useBaseUrl from "@docusaurus/useBaseUrl";
55
import Logo from "@site/static/img/mlflow-logo-white.svg";
66
import DownIcon from "@site/static/img/chevron-down-small.svg";
77

8-
import { cn } from "../../utils";
8+
import { cn, getStartedLinkForPage } from "../../utils";
99

1010
import { Button } from "../Button/Button";
1111
import { HeaderMenuItem } from "../HeaderMenuItem/HeaderMenuItem";
@@ -17,19 +17,6 @@ import { cva } from "class-variance-authority";
1717

1818
const MD_BREAKPOINT = 640;
1919

20-
// Helper function to determine the appropriate "Get started" link based on current page
21-
function getStartedLinkForPage(pathname: string): string {
22-
const classicalMLPath = useBaseUrl("/classical-ml");
23-
const genAIPath = useBaseUrl("/genai");
24-
25-
if (pathname.startsWith(classicalMLPath)) {
26-
return "/classical-ml#get-started";
27-
} else if (pathname.startsWith(genAIPath)) {
28-
return "/genai#get-started";
29-
} else {
30-
return "/#get-started";
31-
}
32-
}
3320

3421
const navStyles = cva(
3522
"fixed w-full z-20 top-0 start-0 bg-black/20 border-b border-[#F7F8F8]/8 backdrop-blur-[20px] overflow-y-auto",
@@ -48,8 +35,10 @@ export const Header = () => {
4835
const [isProductItemHovered, setIsProductItemHovered] = useState(false);
4936
const [isProductSubmenuOpen, setIsProductSubmenuOpen] = useState(false);
5037
const location = useLocation();
38+
const classicalMLPath = useBaseUrl("/classical-ml");
39+
const genAIPath = useBaseUrl("/genai");
5140

52-
const getStartedHref = getStartedLinkForPage(location.pathname);
41+
const getStartedHref = getStartedLinkForPage(location.pathname, classicalMLPath, genAIPath);
5342

5443
const handleProductItemHover = () => {
5544
setIsProductItemHovered(true);

website/src/utils.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,28 @@ import { twMerge } from "tailwind-merge";
44
export function cn(...inputs: ClassValue[]) {
55
return twMerge(clsx(inputs));
66
}
7+
8+
// Helper function to determine the appropriate "Get started" link based on current page
9+
export function getStartedLinkForPage(
10+
pathname: string,
11+
classicalMLPath: string,
12+
genAIPath: string
13+
): string {
14+
if (pathname.startsWith(classicalMLPath)) {
15+
return "/classical-ml#get-started";
16+
}
17+
if (pathname.startsWith(genAIPath)) {
18+
return "/genai#get-started";
19+
}
20+
return "/#get-started";
21+
}
22+
23+
// Helper function to determine if current page is classical ML
24+
export function isClassicalMLPage(pathname: string, classicalMLPath: string): boolean {
25+
return pathname.startsWith(classicalMLPath);
26+
}
27+
28+
// Helper function to determine if current page is GenAI
29+
export function isGenAIPage(pathname: string, genAIPath: string): boolean {
30+
return pathname.startsWith(genAIPath);
31+
}

0 commit comments

Comments
 (0)