From 5bddb971eee0fe598fd10d8ecc2a4eeab6fea2ef Mon Sep 17 00:00:00 2001 From: CK-7vn Date: Wed, 15 Jan 2025 12:22:07 -0500 Subject: [PATCH] fix: fix navbar issues when screen is smaller --- frontend/src/Components/Navbar.tsx | 317 +++++++++++++---------------- frontend/src/css/app.css | 8 + 2 files changed, 151 insertions(+), 174 deletions(-) diff --git a/frontend/src/Components/Navbar.tsx b/frontend/src/Components/Navbar.tsx index 4cabd200..232a14b5 100644 --- a/frontend/src/Components/Navbar.tsx +++ b/frontend/src/Components/Navbar.tsx @@ -48,14 +48,17 @@ export default function Navbar({ if (!user) { return null; } + const { toaster } = useToast(); const confirmSeedModal = useRef(null); const [seedInProgress, setSeedInProgress] = useState(false); + const dashboardTitleStudent = new Map([ ['/trending-content', 'Trending Content'], ['/learning-path', 'Learning Path'], ['/program-tracker', 'Program Tracker'] ]); + const handleSeedDemoData = async () => { setSeedInProgress(true); const resp = await API.post(`auth/demo-seed`, {}); @@ -82,9 +85,9 @@ export default function Navbar({ data-tip="Close sidebar" > + /> ) : (
+ />
)} @@ -103,202 +106,168 @@ export default function Navbar({ -
-
    -
    - {/* admin view */} - {user && isAdministrator(user) ? ( - <> - {hasFeature( - user, - FeatureAccess.OpenContentAccess - ) && ( +
    +
      + {user && isAdministrator(user) ? ( + <> + {hasFeature( + user, + FeatureAccess.OpenContentAccess + ) && ( +
    • + + + Knowledge Insights + +
    • + )} + {hasFeature(user, FeatureAccess.ProviderAccess) && ( +
    • + + + Learning Insights + +
    • + )} +
    • + + + Operational Insights + +
    • + {hasFeature(user, FeatureAccess.ProviderAccess) && ( + <>
    • - - - Knowledge Insights + + + Course Catalog
    • - )} - {hasFeature( - user, - FeatureAccess.ProviderAccess - ) && (
    • - - - Learning Insights + + + Learning Platforms
    • - )} - {/* this acts as the dashboard in the case there are no features enabled */} + + )} + {hasFeature(user, FeatureAccess.ProgramAccess) && (
    • - - - Operational Insights + + + Programs
    • - {hasFeature( - user, - FeatureAccess.ProviderAccess - ) && ( - <> -
    • - - - Course Catalog - -
    • + )} + {hasFeature( + user, + FeatureAccess.OpenContentAccess + ) && ( +
    • + + + Knowledge Center + +
    • + )} +
    • + + + Residents + +
    • +
    • + + + Admins + +
    • +
    • + + + Facilities + +
    • + + ) : ( + <> +
    • + + + {dashboardTitleStudent.get( + getDashboardLink(user) + ) ?? 'Home'} + +
    • + {hasFeature(user, FeatureAccess.ProviderAccess) && ( + <> + {getDashboardLink(user) !== + '/learning-path' && (
    • - - - Learning Platforms + + + My Learning
    • - - )} - {hasFeature( - user, - FeatureAccess.ProgramAccess - ) && ( - <> + )} +
    • + + + My Courses + +
    • +
    • + + + My Progress + +
    • + + )} + {hasFeature( + user, + FeatureAccess.OpenContentAccess + ) && ( + <> + {user.feature_access.length > 1 && (
    • - + - Programs + Trending Content
    • - - )} - {hasFeature( - user, - FeatureAccess.OpenContentAccess - ) && ( + )}
    • - + Knowledge Center
    • - )} -
    • - - - Residents - -
    • + + )} + {hasFeature(user, FeatureAccess.ProgramAccess) && (
    • - - - Admins + + + Programs
    • + )} + + )} +
    +
    -
  • - - - Facilities - -
  • - - ) : ( - <> - {/* student view */} -
  • - - - {dashboardTitleStudent.get( - getDashboardLink(user) - ) ?? 'Home'} - -
  • - {hasFeature( - user, - FeatureAccess.ProviderAccess - ) && ( - <> - {getDashboardLink(user) !== - '/learning-path' && ( -
  • - - - My Learning - -
  • - )} -
  • - - {' '} - My Courses - -
  • -
  • - - {' '} - My Progress - -
  • - - )} - {hasFeature( - user, - FeatureAccess.OpenContentAccess - ) && ( - <> - {user.feature_access.length > 1 && ( -
  • - - - Trending Content - -
  • - )} -
  • - - - Knowledge Center - -
  • - - )} - {hasFeature( - user, - FeatureAccess.ProgramAccess - ) && ( - <> -
  • - - - Programs - -
  • - - )} - - )} -
    +
    +