From 82da7a39c637bbc0910c97964ed0582d8a6b242e Mon Sep 17 00:00:00 2001 From: Gregg Stubberfield Date: Thu, 14 Aug 2025 21:49:06 -0400 Subject: [PATCH 1/3] feat: #331 - Add selected state to top nav items, including Admin Portal dropdown items --- docker-compose.yml | 106 +++++++++--------- frontend/.env | 4 +- .../components/Header/FeatureMenuDropDown.tsx | 20 ++-- frontend/src/components/Header/Header.tsx | 28 +++-- frontend/src/components/Header/header.css | 16 +++ server/Dockerfile | 6 +- server/entrypoint.sh | 4 +- 7 files changed, 106 insertions(+), 78 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d8a8ca75..b04f4cf0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,49 +1,49 @@ services: - db: - build: - context: ./db - dockerfile: Dockerfile - volumes: - - postgres_data:/var/lib/postgresql/data/ - environment: - - POSTGRES_USER=balancer - - POSTGRES_PASSWORD=balancer - - POSTGRES_DB=balancer_dev - ports: - - "5433:5432" - networks: - app_net: - ipv4_address: 192.168.0.2 - pgadmin: - container_name: pgadmin4 - image: dpage/pgadmin4 - environment: - PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org - PGADMIN_DEFAULT_PASSWORD: balancer - # PGADMIN_LISTEN_PORT = 80 - # volumes: - # - ./pgadmin-data:/var/lib/pgadmin - # # PGADMIN_LISTEN_PORT = 80 - ports: - - "5050:80" - networks: - app_net: - ipv4_address: 192.168.0.4 - backend: - image: balancer-backend - build: ./server - command: python manage.py runserver 0.0.0.0:8000 - ports: - - "8000:8000" - env_file: - - ./config/env/env.dev - depends_on: - - db - volumes: - - ./server:/usr/src/server - networks: - app_net: - ipv4_address: 192.168.0.3 + # db: + # build: + # context: ./db + # dockerfile: Dockerfile + # volumes: + # - postgres_data:/var/lib/postgresql/data/ + # environment: + # - POSTGRES_USER=balancer + # - POSTGRES_PASSWORD=balancer + # - POSTGRES_DB=balancer_dev + # ports: + # - "5433:5432" + # networks: + # app_net: + # ipv4_address: 192.168.0.2 + # pgadmin: + # container_name: pgadmin4 + # image: dpage/pgadmin4 + # environment: + # PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org + # PGADMIN_DEFAULT_PASSWORD: balancer + # # PGADMIN_LISTEN_PORT = 80 + # # volumes: + # # - ./pgadmin-data:/var/lib/pgadmin + # # # PGADMIN_LISTEN_PORT = 80 + # ports: + # - "5050:80" + # networks: + # app_net: + # ipv4_address: 192.168.0.4 + # backend: + # image: balancer-backend + # build: ./server + # command: python manage.py runserver 0.0.0.0:8000 + # ports: + # - "8000:8000" + # env_file: + # - ./config/env/env.dev + # depends_on: + # - db + # volumes: + # - ./server:/usr/src/server + # networks: + # app_net: + # ipv4_address: 192.168.0.3 frontend: image: balancer-frontend build: @@ -52,15 +52,15 @@ services: args: - IMAGE_NAME=balancer-frontend ports: - - "3000:3000" + - "3000:3000" environment: - - CHOKIDAR_USEPOLLING=true - # - VITE_API_BASE_URL=https://balancertestsite.com/ + - CHOKIDAR_USEPOLLING=true + # - VITE_API_BASE_URL=https://balancertestsite.com/ volumes: - - "./frontend:/usr/src/app:delegated" - - "/usr/src/app/node_modules/" - depends_on: - - backend + - "./frontend:/usr/src/app:delegated" + - "/usr/src/app/node_modules/" + # depends_on: + # - backend networks: app_net: ipv4_address: 192.168.0.5 @@ -72,4 +72,4 @@ networks: driver: default config: - subnet: "192.168.0.0/24" - gateway: 192.168.0.1 \ No newline at end of file + gateway: 192.168.0.1 diff --git a/frontend/.env b/frontend/.env index 2bfce617..38d1ea0e 100644 --- a/frontend/.env +++ b/frontend/.env @@ -1,2 +1,2 @@ -# VITE_API_BASE_URL=https://balancertestsite.com/ -VITE_API_BASE_URL=http://localhost:8000 \ No newline at end of file +VITE_API_BASE_URL=https://balancertestsite.com/ +# VITE_API_BASE_URL=http://localhost:8000 \ No newline at end of file diff --git a/frontend/src/components/Header/FeatureMenuDropDown.tsx b/frontend/src/components/Header/FeatureMenuDropDown.tsx index a5c88356..aa8d918f 100644 --- a/frontend/src/components/Header/FeatureMenuDropDown.tsx +++ b/frontend/src/components/Header/FeatureMenuDropDown.tsx @@ -1,21 +1,23 @@ -import { Link } from "react-router-dom"; +import { Link, useLocation } from "react-router-dom"; export const FeatureMenuDropDown = () => { + const location = useLocation(); + const currentPath = location.pathname; return (
-
    - Manage files +
      + Manage files
      - Mange and chat with files. + Manage and chat with files
    -
      - Manage rules +
        + Manage rules
        Manage list of rules @@ -23,15 +25,15 @@ export const FeatureMenuDropDown = () => {
      -
        - Manage meds +
          + Manage meds
          Manage list of meds
        - {/* + {/*
          Manage Prompts diff --git a/frontend/src/components/Header/Header.tsx b/frontend/src/components/Header/Header.tsx index 5ba2a9eb..17ef0857 100644 --- a/frontend/src/components/Header/Header.tsx +++ b/frontend/src/components/Header/Header.tsx @@ -1,7 +1,7 @@ import {useState, useRef, useEffect, Fragment} from "react"; // import { useState, Fragment } from "react"; import accountLogo from "../../assets/account.svg"; -import {Link, useNavigate} from "react-router-dom"; +import {Link, useNavigate, useLocation} from "react-router-dom"; import LoginMenuDropDown from "./LoginMenuDropDown"; import "../../components/Header/header.css"; import Chat from "./Chat"; @@ -98,6 +98,9 @@ const Header: React.FC = ({ navigate("/"); }; + const location = useLocation(); + const currentPath = location.pathname; + return (
          @@ -136,38 +139,38 @@ const Header: React.FC = ({ handleForm()} - className=" text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline" + className={currentPath === "/" ? "header-nav-item header-nav-item-selected" : "header-nav-item"} > Medication Suggester <> Medication List About Help Leave Feedback Donate @@ -179,11 +182,12 @@ const Header: React.FC = ({ className="" > Admin Portal Date: Thu, 14 Aug 2025 22:39:15 -0400 Subject: [PATCH 2/3] Revert "feat: #331 - Add selected state to top nav items, including Admin Portal dropdown items" This reverts commit 82da7a39c637bbc0910c97964ed0582d8a6b242e. --- docker-compose.yml | 106 +++++++++--------- frontend/.env | 4 +- .../components/Header/FeatureMenuDropDown.tsx | 20 ++-- frontend/src/components/Header/Header.tsx | 28 ++--- frontend/src/components/Header/header.css | 16 --- server/Dockerfile | 6 +- server/entrypoint.sh | 4 +- 7 files changed, 78 insertions(+), 106 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b04f4cf0..d8a8ca75 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,49 +1,49 @@ services: - # db: - # build: - # context: ./db - # dockerfile: Dockerfile - # volumes: - # - postgres_data:/var/lib/postgresql/data/ - # environment: - # - POSTGRES_USER=balancer - # - POSTGRES_PASSWORD=balancer - # - POSTGRES_DB=balancer_dev - # ports: - # - "5433:5432" - # networks: - # app_net: - # ipv4_address: 192.168.0.2 - # pgadmin: - # container_name: pgadmin4 - # image: dpage/pgadmin4 - # environment: - # PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org - # PGADMIN_DEFAULT_PASSWORD: balancer - # # PGADMIN_LISTEN_PORT = 80 - # # volumes: - # # - ./pgadmin-data:/var/lib/pgadmin - # # # PGADMIN_LISTEN_PORT = 80 - # ports: - # - "5050:80" - # networks: - # app_net: - # ipv4_address: 192.168.0.4 - # backend: - # image: balancer-backend - # build: ./server - # command: python manage.py runserver 0.0.0.0:8000 - # ports: - # - "8000:8000" - # env_file: - # - ./config/env/env.dev - # depends_on: - # - db - # volumes: - # - ./server:/usr/src/server - # networks: - # app_net: - # ipv4_address: 192.168.0.3 + db: + build: + context: ./db + dockerfile: Dockerfile + volumes: + - postgres_data:/var/lib/postgresql/data/ + environment: + - POSTGRES_USER=balancer + - POSTGRES_PASSWORD=balancer + - POSTGRES_DB=balancer_dev + ports: + - "5433:5432" + networks: + app_net: + ipv4_address: 192.168.0.2 + pgadmin: + container_name: pgadmin4 + image: dpage/pgadmin4 + environment: + PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org + PGADMIN_DEFAULT_PASSWORD: balancer + # PGADMIN_LISTEN_PORT = 80 + # volumes: + # - ./pgadmin-data:/var/lib/pgadmin + # # PGADMIN_LISTEN_PORT = 80 + ports: + - "5050:80" + networks: + app_net: + ipv4_address: 192.168.0.4 + backend: + image: balancer-backend + build: ./server + command: python manage.py runserver 0.0.0.0:8000 + ports: + - "8000:8000" + env_file: + - ./config/env/env.dev + depends_on: + - db + volumes: + - ./server:/usr/src/server + networks: + app_net: + ipv4_address: 192.168.0.3 frontend: image: balancer-frontend build: @@ -52,15 +52,15 @@ services: args: - IMAGE_NAME=balancer-frontend ports: - - "3000:3000" + - "3000:3000" environment: - - CHOKIDAR_USEPOLLING=true - # - VITE_API_BASE_URL=https://balancertestsite.com/ + - CHOKIDAR_USEPOLLING=true + # - VITE_API_BASE_URL=https://balancertestsite.com/ volumes: - - "./frontend:/usr/src/app:delegated" - - "/usr/src/app/node_modules/" - # depends_on: - # - backend + - "./frontend:/usr/src/app:delegated" + - "/usr/src/app/node_modules/" + depends_on: + - backend networks: app_net: ipv4_address: 192.168.0.5 @@ -72,4 +72,4 @@ networks: driver: default config: - subnet: "192.168.0.0/24" - gateway: 192.168.0.1 + gateway: 192.168.0.1 \ No newline at end of file diff --git a/frontend/.env b/frontend/.env index 38d1ea0e..2bfce617 100644 --- a/frontend/.env +++ b/frontend/.env @@ -1,2 +1,2 @@ -VITE_API_BASE_URL=https://balancertestsite.com/ -# VITE_API_BASE_URL=http://localhost:8000 \ No newline at end of file +# VITE_API_BASE_URL=https://balancertestsite.com/ +VITE_API_BASE_URL=http://localhost:8000 \ No newline at end of file diff --git a/frontend/src/components/Header/FeatureMenuDropDown.tsx b/frontend/src/components/Header/FeatureMenuDropDown.tsx index aa8d918f..a5c88356 100644 --- a/frontend/src/components/Header/FeatureMenuDropDown.tsx +++ b/frontend/src/components/Header/FeatureMenuDropDown.tsx @@ -1,23 +1,21 @@ -import { Link, useLocation } from "react-router-dom"; +import { Link } from "react-router-dom"; export const FeatureMenuDropDown = () => { - const location = useLocation(); - const currentPath = location.pathname; return (
          -
            - Manage files +
              + Manage files
              - Manage and chat with files + Mange and chat with files.
            -
              - Manage rules +
                + Manage rules
                Manage list of rules @@ -25,15 +23,15 @@ export const FeatureMenuDropDown = () => {
              -
                - Manage meds +
                  + Manage meds
                  Manage list of meds
                - {/* + {/*
                  Manage Prompts diff --git a/frontend/src/components/Header/Header.tsx b/frontend/src/components/Header/Header.tsx index 17ef0857..5ba2a9eb 100644 --- a/frontend/src/components/Header/Header.tsx +++ b/frontend/src/components/Header/Header.tsx @@ -1,7 +1,7 @@ import {useState, useRef, useEffect, Fragment} from "react"; // import { useState, Fragment } from "react"; import accountLogo from "../../assets/account.svg"; -import {Link, useNavigate, useLocation} from "react-router-dom"; +import {Link, useNavigate} from "react-router-dom"; import LoginMenuDropDown from "./LoginMenuDropDown"; import "../../components/Header/header.css"; import Chat from "./Chat"; @@ -98,9 +98,6 @@ const Header: React.FC = ({ navigate("/"); }; - const location = useLocation(); - const currentPath = location.pathname; - return (
                  @@ -139,38 +136,38 @@ const Header: React.FC = ({ handleForm()} - className={currentPath === "/" ? "header-nav-item header-nav-item-selected" : "header-nav-item"} + className=" text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline" > Medication Suggester <> Medication List About Help Leave Feedback Donate @@ -182,12 +179,11 @@ const Header: React.FC = ({ className="" > Admin Portal Date: Thu, 14 Aug 2025 23:00:34 -0400 Subject: [PATCH 3/3] bugfix: #331 - Reapply commit 82da7a3 but without environment changes --- .../components/Header/FeatureMenuDropDown.tsx | 22 +++++++------- frontend/src/components/Header/Header.tsx | 30 +++++++++++-------- frontend/src/components/Header/header.css | 16 ++++++++++ 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/frontend/src/components/Header/FeatureMenuDropDown.tsx b/frontend/src/components/Header/FeatureMenuDropDown.tsx index a5c88356..b1bbf03e 100644 --- a/frontend/src/components/Header/FeatureMenuDropDown.tsx +++ b/frontend/src/components/Header/FeatureMenuDropDown.tsx @@ -1,21 +1,23 @@ -import { Link } from "react-router-dom"; +import { Link, useLocation } from "react-router-dom"; export const FeatureMenuDropDown = () => { + const location = useLocation(); + const currentPath = location.pathname; return (
                  -
                    - Manage files +
                      + Manage files
                      - Mange and chat with files. + Manage and chat with files
                    -
                      - Manage rules +
                        + Manage rules
                        Manage list of rules @@ -23,15 +25,15 @@ export const FeatureMenuDropDown = () => {
                      -
                        - Manage meds +
                          + Manage meds
                          Manage list of meds
                        - {/* + {/*
                          Manage Prompts @@ -63,4 +65,4 @@ export const FeatureMenuDropDown = () => {
                  ); -}; +}; \ No newline at end of file diff --git a/frontend/src/components/Header/Header.tsx b/frontend/src/components/Header/Header.tsx index 5ba2a9eb..0df73a25 100644 --- a/frontend/src/components/Header/Header.tsx +++ b/frontend/src/components/Header/Header.tsx @@ -1,7 +1,7 @@ import {useState, useRef, useEffect, Fragment} from "react"; // import { useState, Fragment } from "react"; import accountLogo from "../../assets/account.svg"; -import {Link, useNavigate} from "react-router-dom"; +import {Link, useNavigate, useLocation} from "react-router-dom"; import LoginMenuDropDown from "./LoginMenuDropDown"; import "../../components/Header/header.css"; import Chat from "./Chat"; @@ -98,6 +98,9 @@ const Header: React.FC = ({ navigate("/"); }; + const location = useLocation(); + const currentPath = location.pathname; + return (
                  @@ -136,38 +139,38 @@ const Header: React.FC = ({ handleForm()} - className=" text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline" + className={currentPath === "/" ? "header-nav-item header-nav-item-selected" : "header-nav-item"} > Medication Suggester <> Medication List About Help Leave Feedback Donate @@ -179,11 +182,12 @@ const Header: React.FC = ({ className="" > Admin Portal ({ }); const ConnectedLayout = connect(mapStateToProps)(Header); -export default ConnectedLayout; +export default ConnectedLayout; \ No newline at end of file diff --git a/frontend/src/components/Header/header.css b/frontend/src/components/Header/header.css index f5c56227..4b0f4a2c 100644 --- a/frontend/src/components/Header/header.css +++ b/frontend/src/components/Header/header.css @@ -21,3 +21,19 @@ .arrow:hover { animation: none; } + +.header-nav-item { + @apply text-black border-transparent border-b-2 hover:border-blue-600 hover:text-blue-600 hover:border-b-2 hover:border-blue-600; +} + +.header-nav-item.header-nav-item-selected { + @apply text-blue-600; +} + +.subheader-nav-item { + @apply cursor-pointer rounded-lg p-3 transition duration-300 hover:bg-gray-100; +} + +.subheader-nav-item.subheader-nav-item-selected { + @apply text-blue-600; +} \ No newline at end of file