From 3d4c0d1d39707f965fb8010530891e99d2ef21fb Mon Sep 17 00:00:00 2001 From: Igor IHIMBAZWE Date: Tue, 19 Nov 2024 10:06:48 +0200 Subject: [PATCH] fix-siderbar-scroll --- src/components/DashHeader.tsx | 6 +-- src/components/Sidebar.tsx | 4 +- src/containers/DashRoutes.tsx | 9 ++-- src/hook/menuProvider.tsx | 1 - src/index.css | 8 +-- .../AdminTraineeDashboard.test.tsx.snap | 2 +- .../__snapshots__/DashHeader.test.tsx.snap | 3 +- .../__snapshots__/Footer.test.tsx.snap | 8 ++- .../__snapshots__/SideNavLink.test.tsx.snap | 4 +- .../__snapshots__/MainRoutes.test.tsx.snap | 16 +++++- .../__snapshots__/App.test.tsx.snap | 8 ++- .../__snapshots__/Siderbar.test.tsx.snap | 8 ++- tests/pages/TraineeAttendance.test.tsx | 2 +- .../__snapshots__/AdminLogin.test.tsx.snap | 26 ++++----- .../AdminTraineeDashboard.test.tsx.snap | 2 +- tests/pages/__snapshots__/Home.test.tsx.snap | 8 ++- .../__snapshots__/Settings.test.tsx.snap | 54 +++++++------------ .../SuperAdminDashboard.test.tsx.snap | 4 +- .../__snapshots__/userRegister.test.tsx.snap | 2 +- 19 files changed, 96 insertions(+), 79 deletions(-) diff --git a/src/components/DashHeader.tsx b/src/components/DashHeader.tsx index e08ed7296..e648c213a 100644 --- a/src/components/DashHeader.tsx +++ b/src/components/DashHeader.tsx @@ -39,7 +39,7 @@ export const TICKETS_NOTS_SUB = gql` } `; -function DashHeader() { +function DashHeader({minimize}: any) { /* istanbul ignore next */ const { minimized, toggleMinMenu, showNav, toggleNav } = useContext(MenuContext); @@ -126,7 +126,7 @@ function DashHeader() { handleShowProfileDropdown={handleShowProfileDropdown} /> )} -
+
{ minimize(!minimized); return toggleMinMenu() }} className="w-7" role="button" tabIndex={0} diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index b4eda3ca8..fd013761b 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -39,10 +39,10 @@ function Sidebar({ style, toggle }: { style: string; toggle: () => void }) {
diff --git a/src/containers/DashRoutes.tsx b/src/containers/DashRoutes.tsx index 423da373c..db57b4281 100644 --- a/src/containers/DashRoutes.tsx +++ b/src/containers/DashRoutes.tsx @@ -83,18 +83,17 @@ const CoordinatorCards = React.lazy( const AdminSission = React.lazy(() => import('./admin-dashBoard/Sessions')); function DashRoutes() { - const { toggleNav } = useContext(MenuContext); - + const { toggleNav } = useContext(MenuContext); + const [minimized, setMinimized] = useState(false); const [nav, setNav] = useState(false); const handleClick = () => setNav(!nav); - return ( - + -
+
} /> diff --git a/src/hook/menuProvider.tsx b/src/hook/menuProvider.tsx index 44acd7212..c2019fdf5 100644 --- a/src/hook/menuProvider.tsx +++ b/src/hook/menuProvider.tsx @@ -14,7 +14,6 @@ export const MenuContext = createContext({ export function ThemeProvider({ children }: Props) { const [minimized, setMinimized] = useState(false); const [showNav, setShowNav] = useState(false); - const toggleMinMenu = () => setMinimized((p) => !p); const toggleNav = () => setShowNav((p) => !p); diff --git a/src/index.css b/src/index.css index dc015494c..abcc8d5ee 100644 --- a/src/index.css +++ b/src/index.css @@ -484,10 +484,10 @@ th { .page-layout { display: grid; grid-template-areas: - 'header header' - 'side_nav main' - 'footer footer'; - grid-template-columns: auto 1fr; + 'header' + 'main' + 'footer'; + grid-template-columns: auto; grid-template-rows: auto 1fr auto; } diff --git a/tests/components/__snapshots__/AdminTraineeDashboard.test.tsx.snap b/tests/components/__snapshots__/AdminTraineeDashboard.test.tsx.snap index 6af0d7afa..8eb69ae1b 100644 --- a/tests/components/__snapshots__/AdminTraineeDashboard.test.tsx.snap +++ b/tests/components/__snapshots__/AdminTraineeDashboard.test.tsx.snap @@ -463,7 +463,7 @@ Array [ name="date" readOnly={true} type="text" - value="2024-11-14" + value="2024-11-19" />
diff --git a/tests/components/__snapshots__/Footer.test.tsx.snap b/tests/components/__snapshots__/Footer.test.tsx.snap index afcaa31d8..a6934aeb1 100644 --- a/tests/components/__snapshots__/Footer.test.tsx.snap +++ b/tests/components/__snapshots__/Footer.test.tsx.snap @@ -216,7 +216,13 @@ exports[`
Renders Header 1`] = `
  • - Community + + Community + +
  • - Community + + Community + +
  • - Community + + Community + +
  • - Community + + Community + +
  • Renders Home 1`] = `
  • - Community + + Community + +
  • { expect(await screen.findByText("You don't have an attendance record in the system at the moment.")).toBeInTheDocument(); }); -}); +}); \ No newline at end of file diff --git a/tests/pages/__snapshots__/AdminLogin.test.tsx.snap b/tests/pages/__snapshots__/AdminLogin.test.tsx.snap index 00ec8efe2..957b0f652 100644 --- a/tests/pages/__snapshots__/AdminLogin.test.tsx.snap +++ b/tests/pages/__snapshots__/AdminLogin.test.tsx.snap @@ -3,13 +3,13 @@ exports[`Admin Login Should render 1`] = ` Array [
  • - Privacy and Security + Two-factor authentication

    - Privacy and Security + Get extra security by receiving a code on your email

  • - -

    - Change -

    -
    - -
  • -
    -

    - Login Activity -

    -

    - History of your login sessions -

    -
    - -

    - View -

    -
    + +
  • diff --git a/tests/pages/__snapshots__/SuperAdminDashboard.test.tsx.snap b/tests/pages/__snapshots__/SuperAdminDashboard.test.tsx.snap index 261bcc9e3..d0e95db82 100644 --- a/tests/pages/__snapshots__/SuperAdminDashboard.test.tsx.snap +++ b/tests/pages/__snapshots__/SuperAdminDashboard.test.tsx.snap @@ -5,7 +5,7 @@ exports[`Super Admin Dashboard test Should render SuperAdminDashboard 1`] = ` className="flex flex-col gap-5 lg:gap-8 text-[.92rem] xmd:text-[.95rem]" >