From 28a902ec15fcb39fe5b4b79fbe4bba0cc2d04ece Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 16 Jun 2023 18:39:06 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20chore(MainPage):=20use=20constan?= =?UTF-8?q?t=20for=20header=20text=20in=20user=20projects=20section=20The?= =?UTF-8?q?=20changes=20in=20headerComponent=20remove=20unused=20imports?= =?UTF-8?q?=20and=20update=20the=20header=20text=20to=20use=20a=20constant?= =?UTF-8?q?=20instead=20of=20a=20hardcoded=20string.=20The=20constant=20is?= =?UTF-8?q?=20added=20in=20constants.tsx.=20The=20MainPage=20component=20i?= =?UTF-8?q?s=20updated=20to=20use=20the=20constant=20for=20the=20header=20?= =?UTF-8?q?text=20in=20the=20user=20projects=20section.=20This=20improves?= =?UTF-8?q?=20code=20readability=20and=20maintainability.=20=F0=9F=8E=A8?= =?UTF-8?q?=20style(headerComponent):=20remove=20unused=20imports=20and=20?= =?UTF-8?q?update=20header=20text=20to=20use=20constant=20=E2=9C=A8=20feat?= =?UTF-8?q?(constants.tsx):=20add=20constant=20for=20header=20text=20in=20?= =?UTF-8?q?user=20projects=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/components/headerComponent/index.tsx | 7 ++++--- src/frontend/src/constants.tsx | 7 +++++++ src/frontend/src/pages/MainPage/index.tsx | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/components/headerComponent/index.tsx b/src/frontend/src/components/headerComponent/index.tsx index d59078836..67ef327f2 100644 --- a/src/frontend/src/components/headerComponent/index.tsx +++ b/src/frontend/src/components/headerComponent/index.tsx @@ -1,5 +1,5 @@ -import { SunIcon, MoonIcon, BellIcon, Home, Users2 } from "lucide-react"; -import { useContext, useState, useEffect } from "react"; +import { BellIcon, Home, Users2 } from "lucide-react"; +import { useContext } from "react"; import { FaGithub } from "react-icons/fa"; import { Button } from "../ui/button"; import { TabsContext } from "../../contexts/tabsContext"; @@ -10,6 +10,7 @@ import { PopUpContext } from "../../contexts/popUpContext"; import { typesContext } from "../../contexts/typesContext"; import MenuBar from "./components/menuBar"; import { Link, useLocation, useParams } from "react-router-dom"; +import { USER_PROJECTS_HEADER } from "../../constants"; export default function Header() { const { flows, addFlow, tabId } = useContext(TabsContext); @@ -39,7 +40,7 @@ export default function Header() { size="sm" > -
My Projects
+
{USER_PROJECTS_HEADER}
diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index 32bcfe5be..34d20211a 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -399,3 +399,10 @@ export const NOUNS: string[] = [ "yalow", "yonath", ]; + +/** + * Header text for user projects + * @constant + * + */ +export const USER_PROJECTS_HEADER = "My Collection"; diff --git a/src/frontend/src/pages/MainPage/index.tsx b/src/frontend/src/pages/MainPage/index.tsx index bdf5156ba..ac5c46907 100644 --- a/src/frontend/src/pages/MainPage/index.tsx +++ b/src/frontend/src/pages/MainPage/index.tsx @@ -4,6 +4,7 @@ import { TabsContext } from "../../contexts/tabsContext"; import { Button } from "../../components/ui/button"; import { Link, useNavigate } from "react-router-dom"; import { CardComponent } from "../../components/cardComponent"; +import { USER_PROJECTS_HEADER } from "../../constants"; export default function HomePage() { const { flows, setTabId, downloadFlows, uploadFlows, addFlow, removeFlow } = useContext(TabsContext); @@ -16,7 +17,7 @@ export default function HomePage() {
- My Collection + {USER_PROJECTS_HEADER}