From 5a6ee829cae36b8e5339578aeef463f7953119fc Mon Sep 17 00:00:00 2001 From: Helene Lotsberg Date: Mon, 12 Oct 2026 13:00:29 +0200 Subject: [PATCH 1/8] fix file structure for tests --- frontend/src/tests/{test_profile => }/Profile.test.tsx | 0 .../tests/{test_profile => }/__snapshots__/Profile.test.tsx.snap | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename frontend/src/tests/{test_profile => }/Profile.test.tsx (100%) rename frontend/src/tests/{test_profile => }/__snapshots__/Profile.test.tsx.snap (100%) diff --git a/frontend/src/tests/test_profile/Profile.test.tsx b/frontend/src/tests/Profile.test.tsx similarity index 100% rename from frontend/src/tests/test_profile/Profile.test.tsx rename to frontend/src/tests/Profile.test.tsx diff --git a/frontend/src/tests/test_profile/__snapshots__/Profile.test.tsx.snap b/frontend/src/tests/__snapshots__/Profile.test.tsx.snap similarity index 100% rename from frontend/src/tests/test_profile/__snapshots__/Profile.test.tsx.snap rename to frontend/src/tests/__snapshots__/Profile.test.tsx.snap From 1a85f48c79cdd5e1deb13e741f3ebed3f7695b05 Mon Sep 17 00:00:00 2001 From: Helene Lotsberg Date: Mon, 12 Oct 2026 13:09:33 +0200 Subject: [PATCH 2/8] refactured and re-organized the code --- frontend/src/AppRoutes.tsx | 10 +-- frontend/src/components/sidebar/Sidebar.tsx | 4 +- .../LanguageSwitcher.tsx | 0 .../{ => sidebarButtons}/SideBarButton.css | 0 .../{ => sidebarButtons}/ThemeToggle.tsx | 0 frontend/src/i18n/locales/en/translation.json | 2 +- frontend/src/i18n/locales/no/translation.json | 2 +- .../ExplorePlants.css} | 0 .../ExplorePlants.tsx} | 80 +++++++++---------- .../plantMatch/PlantMatchPage.css | 0 .../plantMatch/PlantMatchPage.tsx | 0 .../{components => pages}/profile/Profile.css | 0 .../{components => pages}/profile/Profile.tsx | 2 +- frontend/src/tests/ExplorePage.test.tsx | 18 ++--- frontend/src/tests/LanguageSwitcher.test.tsx | 2 +- frontend/src/tests/Sidebar.test.tsx | 2 +- frontend/src/tests/Translation.test.tsx | 2 +- 17 files changed, 62 insertions(+), 62 deletions(-) rename frontend/src/components/{languageSwitcher => sidebarButtons}/LanguageSwitcher.tsx (100%) rename frontend/src/components/{ => sidebarButtons}/SideBarButton.css (100%) rename frontend/src/components/{ => sidebarButtons}/ThemeToggle.tsx (100%) rename frontend/src/pages/{explorePage/ExplorePage.css => explorePlants/ExplorePlants.css} (100%) rename frontend/src/pages/{explorePage/ExplorePage.tsx => explorePlants/ExplorePlants.tsx} (68%) rename frontend/src/{components => pages}/plantMatch/PlantMatchPage.css (100%) rename frontend/src/{components => pages}/plantMatch/PlantMatchPage.tsx (100%) rename frontend/src/{components => pages}/profile/Profile.css (100%) rename frontend/src/{components => pages}/profile/Profile.tsx (97%) diff --git a/frontend/src/AppRoutes.tsx b/frontend/src/AppRoutes.tsx index e8045f46..fcc33204 100644 --- a/frontend/src/AppRoutes.tsx +++ b/frontend/src/AppRoutes.tsx @@ -1,8 +1,8 @@ import { Route, Routes } from "react-router-dom"; -import PlantMatchPage from "./components/plantMatch/PlantMatchPage.tsx"; -import ExplorePage from "./pages/explorePage/ExplorePage.tsx"; -import MyMatchesPage from "./pages/MyMatches/MyMatchesPage.tsx"; -import Profile from "./components/profile/Profile.tsx"; +import PlantMatchPage from "./pages/plantMatch/PlantMatchPage.tsx"; +import ExplorePlants from "./pages/explorePlants/ExplorePlants.tsx"; +import MyMatchesPage from "./pages/myMatches/MyMatchesPage.tsx"; +import Profile from "./pages/profile/Profile.tsx"; // eslint-disable-next-line react-refresh/only-export-components export const ROUTES = { @@ -16,7 +16,7 @@ function AppRoutes() { return ( } /> - } /> + } /> } /> } /> diff --git a/frontend/src/components/sidebar/Sidebar.tsx b/frontend/src/components/sidebar/Sidebar.tsx index e7fd748f..61b90cd0 100644 --- a/frontend/src/components/sidebar/Sidebar.tsx +++ b/frontend/src/components/sidebar/Sidebar.tsx @@ -1,7 +1,7 @@ import { useTranslation } from "react-i18next"; import { NavLink } from "react-router-dom"; -import LanguageSwitcher from "../languageSwitcher/LanguageSwitcher"; -import ThemeToggle from "../ThemeToggle"; +import LanguageSwitcher from "../sidebarButtons/LanguageSwitcher"; +import ThemeToggle from "../sidebarButtons/ThemeToggle"; import { ROUTES } from "../../AppRoutes"; import "./Sidebar.css"; diff --git a/frontend/src/components/languageSwitcher/LanguageSwitcher.tsx b/frontend/src/components/sidebarButtons/LanguageSwitcher.tsx similarity index 100% rename from frontend/src/components/languageSwitcher/LanguageSwitcher.tsx rename to frontend/src/components/sidebarButtons/LanguageSwitcher.tsx diff --git a/frontend/src/components/SideBarButton.css b/frontend/src/components/sidebarButtons/SideBarButton.css similarity index 100% rename from frontend/src/components/SideBarButton.css rename to frontend/src/components/sidebarButtons/SideBarButton.css diff --git a/frontend/src/components/ThemeToggle.tsx b/frontend/src/components/sidebarButtons/ThemeToggle.tsx similarity index 100% rename from frontend/src/components/ThemeToggle.tsx rename to frontend/src/components/sidebarButtons/ThemeToggle.tsx diff --git a/frontend/src/i18n/locales/en/translation.json b/frontend/src/i18n/locales/en/translation.json index 8cf2050f..a7dff796 100644 --- a/frontend/src/i18n/locales/en/translation.json +++ b/frontend/src/i18n/locales/en/translation.json @@ -36,7 +36,7 @@ "small": "small", "succulents": "succulent" }, - "explorePage": { + "ExplorePlants": { "search": "Search for plants", "watering": "Watering needs", "all": "All", diff --git a/frontend/src/i18n/locales/no/translation.json b/frontend/src/i18n/locales/no/translation.json index 64308b2f..96ef3877 100644 --- a/frontend/src/i18n/locales/no/translation.json +++ b/frontend/src/i18n/locales/no/translation.json @@ -36,7 +36,7 @@ "small": "liten", "succulents": "sukkulent" }, - "explorePage": { + "ExplorePlants": { "search": "Søk etter planter", "watering": "Vanningsbehov", "all": "Alle", diff --git a/frontend/src/pages/explorePage/ExplorePage.css b/frontend/src/pages/explorePlants/ExplorePlants.css similarity index 100% rename from frontend/src/pages/explorePage/ExplorePage.css rename to frontend/src/pages/explorePlants/ExplorePlants.css diff --git a/frontend/src/pages/explorePage/ExplorePage.tsx b/frontend/src/pages/explorePlants/ExplorePlants.tsx similarity index 68% rename from frontend/src/pages/explorePage/ExplorePage.tsx rename to frontend/src/pages/explorePlants/ExplorePlants.tsx index bef0c339..cc9ca409 100644 --- a/frontend/src/pages/explorePage/ExplorePage.tsx +++ b/frontend/src/pages/explorePlants/ExplorePlants.tsx @@ -2,7 +2,7 @@ import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useDebounce } from "../../hooks/useDebounce"; import { useSessionState } from "../../hooks/useSessionState"; -import "./ExplorePage.css"; +import "./ExplorePlants.css"; // prettier-ignore const plants = [ @@ -23,16 +23,16 @@ const plants = [ { id: 15, name: "Carnation", watering: "average", sunlight: "full_sun", indoor: false, edible: true }, ]; -export default function ExplorePage() { +export default function ExplorePlants() { const { t } = useTranslation(); - const [search, setSearch] = useSessionState("explorePage.search"); + const [search, setSearch] = useSessionState("ExplorePlants.search"); const debouncedSearch = useDebounce(search, 800); const [openId, setOpenId] = useState(null); - const [watering, setWatering] = useSessionState("explorePage.watering"); - const [sunlight, setSunlight] = useSessionState("explorePage.sunlight"); - const [location, setLocation] = useSessionState("explorePage.location"); - const [edibility, setEdibility] = useSessionState("explorePage.edibility"); + const [watering, setWatering] = useSessionState("ExplorePlants.watering"); + const [sunlight, setSunlight] = useSessionState("ExplorePlants.sunlight"); + const [location, setLocation] = useSessionState("ExplorePlants.location"); + const [edibility, setEdibility] = useSessionState("ExplorePlants.edibility"); const filteredPlants = plants.filter( (plant) => @@ -59,10 +59,10 @@ export default function ExplorePage() { onSubmit={(e) => e.preventDefault()} >