From 6a78976677770a4e9bb08a88be40d60d7cc495d8 Mon Sep 17 00:00:00 2001 From: Christopher Lo <46541035+topher-lo@users.noreply.github.com> Date: Thu, 7 Mar 2024 00:35:59 +0000 Subject: [PATCH] fix(ui): Dynamic link to workflow/cases --- frontend/src/components/navbar.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/navbar.tsx b/frontend/src/components/navbar.tsx index e09f4985f..bbb486add 100644 --- a/frontend/src/components/navbar.tsx +++ b/frontend/src/components/navbar.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from "react" import Link from "next/link" -import { usePathname, useSearchParams } from "next/navigation" +import { useParams, usePathname } from "next/navigation" import axios from "axios" import { BellRingIcon, WorkflowIcon } from "lucide-react" @@ -14,8 +14,8 @@ import WorkflowSwitcher from "@/components/workflow-switcher" export function Navbar() { const [enableWorkflow, setEnableWorkflow] = useState(false) - const searchParams = useSearchParams() - const workflowId = searchParams.get("id") + const params = useParams() + const workflowId = params["id"] const pathname = usePathname() useEffect(() => { @@ -44,6 +44,10 @@ export function Navbar() { updateWorkflowStatus() }, [enableWorkflow, workflowId]) + if (!workflowId) { + return

FUCK

+ } + return (
@@ -52,7 +56,7 @@ export function Navbar() { workflows when page is switched between workflow view and cases view */} - + @@ -60,7 +64,11 @@ export function Navbar() { Workflow - + Cases