From 11628443cf612819697b25298e363dff46fb1658 Mon Sep 17 00:00:00 2001 From: smolgrrr Date: Tue, 13 Aug 2024 16:43:33 +1000 Subject: [PATCH] header param --- client/src/components/Header/Header.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/components/Header/Header.tsx b/client/src/components/Header/Header.tsx index 7888aba..11f469c 100644 --- a/client/src/components/Header/Header.tsx +++ b/client/src/components/Header/Header.tsx @@ -3,17 +3,23 @@ import { BellIcon, HashtagIcon } from "@heroicons/react/24/outline"; +import { useLocation } from "react-router-dom"; export default function Header() { + const location = useLocation(); + const pathParts = location.pathname.split('/'); + const secondLastPart = pathParts[pathParts.length - 2]; + const lastPathPart = secondLastPart === "thread" ? "/thread" : "/" + pathParts[pathParts.length - 1]; + return (
logo - - {"~\\WIRED>"} - + + {`~/WIRED${lastPathPart}>`} +