From 73f3f907376e4c3554ddc3965502484b3716f1dd Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 27 Feb 2024 18:20:56 +0300 Subject: [PATCH] Updated facilities page UI for small screen view port --- components/FacilitySideMenu.js | 5 +- components/HeaderLayout.js | 42 ++-- components/MainLayout.js | 12 +- package.json | 2 +- pages/community-units/index.js | 437 +++++++++++++++++---------------- pages/dashboard/index.js | 26 +- pages/facilities/index.js | 43 ++-- pages/index.js | 10 +- 8 files changed, 291 insertions(+), 286 deletions(-) diff --git a/components/FacilitySideMenu.js b/components/FacilitySideMenu.js index 049ccf44..36408b51 100644 --- a/components/FacilitySideMenu.js +++ b/components/FacilitySideMenu.js @@ -193,11 +193,14 @@ function FacilitySideMenu({ states, stateSetters, filters }) { return ( -
+
{/* All Facilities */} diff --git a/components/HeaderLayout.js b/components/HeaderLayout.js index cf18fc90..bc202bc6 100644 --- a/components/HeaderLayout.js +++ b/components/HeaderLayout.js @@ -189,7 +189,7 @@ export default function HeaderLayout({ {/* Logo And Title */}
{/* Heading */} -
+
{/* Heading */}
{/* Logo */} @@ -208,16 +208,16 @@ export default function HeaderLayout({ {/* Login / Logout button */} {isLoggedIn ? ( -
+
- + - + {user.full_name || "My account"} @@ -234,7 +234,7 @@ export default function HeaderLayout({ {({ active }) => (
+ @@ -200,228 +202,229 @@ function CommunityUnit (props) {
-
- {/* Side Menu Filters*/} - - - {/* Main body */} - -
- {/* Data Indicator section */} - {/* Data Indicator section */} -
- {/* search input */} - - { - - const query = values.q.split(' ').join('+'); - - - // console.log({values}) - switch((new URL(window.location.href))?.searchParams.get('qf')){ - case "all": - router.push(`/community-units/?q=${query}&qf=all`) - break; - case "approved": - router.push(`/community-units/?q=${query}&qf=approved&is_approved=true`) - break; - case "new_pending_approval": - router.push(`/community-units/?q=${query}&qf=new_pending_approval&has_edits=false&pending_approval=true`) - break; - case "updated_pending_approval": - router.push(`/community-units/?q=${query}&qf=updated_pending_approval&has_edits=true&is_approved=true`) - break; - default: - router.push(`/community-units/?q=${query}&qf=is_rejected&is_rejected=true`) - break; - - - } - - }} - > - -
- - - - -
- -
- {props?.data?.count && props?.data?.count > 0 && {props?.data?.start_index ?? ''} - {props?.data?.end_index ?? ''} of {props?.data?.count ?? ''} } -
-
- -
+
+ {/* Side Menu Filters*/} + + + + {/* Main body */} + +
+ {/* Data Indicator section */} + {/* Data Indicator section */} +
+ {/* search input */} -
+ { + + const query = values.q.split(' ').join('+'); + + + // console.log({values}) + switch((new URL(window.location.href))?.searchParams.get('qf')){ + case "all": + router.push(`/community-units/?q=${query}&qf=all`) + break; + case "approved": + router.push(`/community-units/?q=${query}&qf=approved&is_approved=true`) + break; + case "new_pending_approval": + router.push(`/community-units/?q=${query}&qf=new_pending_approval&has_edits=false&pending_approval=true`) + break; + case "updated_pending_approval": + router.push(`/community-units/?q=${query}&qf=updated_pending_approval&has_edits=true&is_approved=true`) + break; + default: + router.push(`/community-units/?q=${query}&qf=is_rejected&is_rejected=true`) + break; + + + } + + }} + > + +
0 ? ( - cus.map((comm_unit, index) => ( -
-
-

- - - {comm_unit.official_name || - comm_unit.official_name || - comm_unit.name} - -

- -
-
- - # {comm_unit.code ? comm_unit.code : 'NO_CODE' || ' '} -
- -
- - {comm_unit.facility_name ?? ' '} -
-
- -
-
- - {comm_unit.facility_county || - comm_unit.county || - 'N/A'} - -
-
- - {comm_unit.facility_subcounty || - comm_unit.sub_county || - 'N/A'} -
-
- - {comm_unit.facility_ward || 'N/A'} -
-
- - {comm_unit.constituency_name || - comm_unit.facility_constituency || - 'N/A'} -
-
+ > + + + + + + +
+ {props?.data?.count && props?.data?.count > 0 && {props?.data?.start_index ?? ''} - {props?.data?.end_index ?? ''} of {props?.data?.count ?? ''} } +
+
+ +
+ +
+ + {cus && cus.length > 0 ? ( + cus.map((comm_unit, index) => ( +
+
+

+ + + {comm_unit.official_name || + comm_unit.official_name || + comm_unit.name} + +

+ +
+
+ + # {comm_unit.code ? comm_unit.code : 'NO_CODE' || ' '} +
+ +
+ + {comm_unit.facility_name ?? ' '} +
-
- {comm_unit.status_name && {comm_unit.status_name}} - {comm_unit.has_edits && Has edits} - {/* {!comm_unit.rejected ? {comm_unit.approved ? "Approved" : "Not approved"} : {comm_unit.rejected ? "Rejected" : ""}} */} -
- +
+
+ + {comm_unit.facility_county || + comm_unit.county || + 'N/A'} + +
+
+ + {comm_unit.facility_subcounty || + comm_unit.sub_county || + 'N/A'} +
+
+ + {comm_unit.facility_ward || 'N/A'} +
+
+ + {comm_unit.constituency_name || + comm_unit.facility_constituency || + 'N/A'} +
+
+
+ +
+ {comm_unit.status_name && {comm_unit.status_name}} + {comm_unit.has_edits && Has edits} + {/* {!comm_unit.rejected ? {comm_unit.approved ? "Approved" : "Not approved"} : {comm_unit.rejected ? "Rejected" : ""}} */}
- - )) - ) : ( -
- - No community units found - - - - Refresh. - -
- )} - {cus && cus.length >= 30 && ( - - )} -
+ + )) + ) : ( +
+ + No community units found + + + + Refresh. + + +
+ )} + {cus && cus.length >= 30 && ( + + )}
+
-
- +
+
+ diff --git a/pages/dashboard/index.js b/pages/dashboard/index.js index 9da5ed3f..bb9baf6e 100644 --- a/pages/dashboard/index.js +++ b/pages/dashboard/index.js @@ -268,13 +268,13 @@ function Dashboard(props) { -
-
+
+
{/* Debug */} -
- Home {'/'} - Dashboard +
+ {/* Home */} + Dashboard
@@ -305,7 +305,7 @@ function Dashboard(props) { : <> - {groupID !== 7 && groupID !== 5 && / } + {groupID !== 7 || groupID !== 5 && / } {subcounties && subcounties?.subcounties && subcounties?.subcounties.find(ft => ft.id == drillDown?.subcounties)?.name != undefined ? subcounties.subcounties.find(ft => ft.id == drillDown?.subcounties)?.name + " Sub county" : !drillDown?.county && "" || ""} @@ -332,7 +332,7 @@ function Dashboard(props) {
{/* */} -
- {/* ~~~F L T R S~~~ */}
- } + } */} {/* filter by organizational units */} {/* national */} @@ -606,7 +604,7 @@ function Dashboard(props) { Object.keys(filters)?.map(ft => (
{/* */} - ({ ...baseStyles, @@ -784,7 +782,7 @@ function Dashboard(props) { Object.keys(wards)?.map(ft => (
{/* */} -