diff --git a/src/components/Layouts/ProtectedLayout/index.tsx b/src/components/Layouts/ProtectedLayout/index.tsx
index 808af8d..bef7029 100644
--- a/src/components/Layouts/ProtectedLayout/index.tsx
+++ b/src/components/Layouts/ProtectedLayout/index.tsx
@@ -1,4 +1,4 @@
-import { Box, HStack } from '@chakra-ui/react';
+import { Box, Flex, HStack, useBreakpointValue } from '@chakra-ui/react';
import { Outlet, Navigate, useNavigate } from 'react-router-dom';
import { useContext, useEffect } from 'react';
import 'react-toastify/dist/ReactToastify.css';
@@ -13,14 +13,15 @@ export const ProtectedLayout = () => {
if (!user) navigate('/login');
}, [user, navigate]);
+ const flexDir = useBreakpointValue({ base: 'column', md: 'row' }) as 'column' | 'row';
+ const isMobile = useBreakpointValue({ base: true, md: false });
+
return (
-
-
-
-
-
+
+
+
-
+
);
};
diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx
index 768181c..7692e21 100644
--- a/src/components/Navbar/index.tsx
+++ b/src/components/Navbar/index.tsx
@@ -1,43 +1,33 @@
-import React, { useContext } from "react";
-import { Image, Stack, Text, VStack } from "@chakra-ui/react";
-import { useTranslation } from "react-i18next";
-import { MenuItems } from "./common";
-import { MenuItem } from "./MenuItem";
-import { CoachLogo } from "@/assets/images/logos";
-import { UserContext } from "@/contexts/UserContext";
-import UserCard from "../UserCard";
+import React, { useContext, useState } from 'react';
+import { Box, HStack, Image, Stack, Text, VStack, useBreakpointValue } from '@chakra-ui/react';
+import { useTranslation } from 'react-i18next';
+import { MenuItems } from './common';
+import { MenuItem } from './MenuItem';
+import { CoachLogo } from '@/assets/images/logos';
+import { UserContext } from '@/contexts/UserContext';
+import UserCard from '../UserCard';
+import { HamburgerIcon } from '@chakra-ui/icons';
+import { useNavigate } from 'react-router-dom';
const Navbar: React.FC = () => {
const { logout, user } = useContext(UserContext);
const { t } = useTranslation();
+ const [open, setOpen] = useState(false);
+ const navigate = useNavigate();
- return (
-
-
-
-
+ const isMobile = useBreakpointValue({ base: true, md: false });
+ const navbarWidth = useBreakpointValue({ base: 'full', md: '240px' });
-
+ const menu = (
+ <>
+
+
+
+
{MenuItems.map((item, index) =>
item.subItems ? (
-
-
+
+
{t(`Navbar.${item.label}`)}
{item.subItems.map((subItem, sIndex) => (
@@ -46,6 +36,10 @@ const Navbar: React.FC = () => {
icon={subItem.icon}
label={t(`Navbar.${subItem.label}`)}
route={subItem.route}
+ onClick={() => {
+ setOpen(false);
+ navigate(subItem.route);
+ }}
/>
))}
@@ -55,10 +49,48 @@ const Navbar: React.FC = () => {
icon={item.icon}
label={t(`Navbar.${item.label}`)}
route={item.route}
+ onClick={() => {
+ setOpen(false);
+ navigate(item.route);
+ }}
/>
- )
+ ),
)}
+ >
+ );
+
+ return (
+
+ {isMobile ? (
+
+
+ setOpen(!open)} cursor="pointer" />
+
+
+
+ {menu}
+
+ ) : (
+ <>
+
+ {menu}
+ >
+ )}
);
};
diff --git a/src/pages/Dashboard/index.tsx b/src/pages/Dashboard/index.tsx
index 65e5e21..b45dcd3 100644
--- a/src/pages/Dashboard/index.tsx
+++ b/src/pages/Dashboard/index.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
-import { Button, Center, HStack, Select, Spinner, Text, VStack } from '@chakra-ui/react';
+import { Box, Button, Center, Flex, HStack, Select, Spinner, Text, VStack, useBreakpointValue } from '@chakra-ui/react';
import { IDashboard, ISchool, ITeachingPractices } from '@/types';
import DashboardService from '@/services/dashboard';
import Loader from '@/components/Base/Loader';
@@ -23,6 +23,7 @@ const DashboardPage: React.FC = () => {
const [schoolName, setSchoolName] = useState();
const [schoolList, setSchoolList] = useState([]);
const [selected, setSelected] = useState();
+ const isMobile = useBreakpointValue({ base: true, md: false });
useEffect(() => {
if (!loading) {
@@ -58,8 +59,8 @@ const DashboardPage: React.FC = () => {
return (
-
-
+
+
Select region
{user?.role === ROLES.admin ? (
-
+
Select district
{user?.role === ROLES.admin || user?.role === ROLES['region-analyst'] ? (
{
)}
-
+
Select school
{loading ? (
@@ -103,7 +104,7 @@ const DashboardPage: React.FC = () => {
)}
-
+
{loading || !dashboard || !selected ? (
@@ -111,7 +112,7 @@ const DashboardPage: React.FC = () => {
) : (
<>
-
+
Engagement
@@ -164,36 +165,38 @@ const DashboardPage: React.FC = () => {
values={dashboard.teachingPractices.map((item) => item.data.teachers)}
/>
-
+
Select Teaching Practices to show
-
- {dashboard.teachingPractices.map((item) => (
-
- ))}
-
+
+
+ {dashboard.teachingPractices.map((item) => (
+
+ ))}
+
+
{selected.name}
-
+
{
]}
/>
-
+
{
/>
-
+
>
)}