From ddf2b0f98675fb7902db5b928d5cee2e065ab942 Mon Sep 17 00:00:00 2001 From: J ATULYA <109218299+jatulya@users.noreply.github.com> Date: Fri, 13 Dec 2024 23:03:26 +0530 Subject: [PATCH] Message to be displayed for empty tables (Issue 578) (#588) * Events Navbar persistent * Relevant messages displayed for empty tables * Prettier --- .../[eventId]/attributes/[attributeId]/index.jsx | 14 +++++++++++++- .../events/[eventId]/attributes/index.jsx | 16 +++++++++++++++- .../events/[eventId]/extras/[extraId]/index.jsx | 14 +++++++++++++- .../[orgId]/events/[eventId]/extras/index.jsx | 13 +++++++++++++ .../participants/[participantId]/index.jsx | 12 ++++++++++++ .../[eventId]/participants/check-in/index.jsx | 14 +++++++++++++- .../events/[eventId]/participants/index.jsx | 14 +++++++++++++- .../web-admin/src/pages/[orgId]/events/index.jsx | 15 ++++++++++++++- .../src/pages/[orgId]/members/index.jsx | 13 +++++++++++++ 9 files changed, 119 insertions(+), 6 deletions(-) diff --git a/apps/web-admin/src/pages/[orgId]/events/[eventId]/attributes/[attributeId]/index.jsx b/apps/web-admin/src/pages/[orgId]/events/[eventId]/attributes/[attributeId]/index.jsx index e2fd6abf..7174cb25 100644 --- a/apps/web-admin/src/pages/[orgId]/events/[eventId]/attributes/[attributeId]/index.jsx +++ b/apps/web-admin/src/pages/[orgId]/events/[eventId]/attributes/[attributeId]/index.jsx @@ -1,7 +1,7 @@ import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; -import { Button, Flex } from '@chakra-ui/react'; +import { Text, Button, Flex } from '@chakra-ui/react'; import DashboardLayout from '@/layouts/DashboardLayout'; import DataDisplay from '@/components/DataDisplay'; @@ -98,6 +98,18 @@ export default function AttributeById() { router.push(`/${orgId}/events/${eventId}/participants/${row.id}`); }} /> + {attributeDetails.length === 0 ? ( +
+ + No participants assigned + + + Assign participants to see details + +
+ ) : ( + <> + )} ); } diff --git a/apps/web-admin/src/pages/[orgId]/events/[eventId]/attributes/index.jsx b/apps/web-admin/src/pages/[orgId]/events/[eventId]/attributes/index.jsx index f578fad1..f6e4cde4 100644 --- a/apps/web-admin/src/pages/[orgId]/events/[eventId]/attributes/index.jsx +++ b/apps/web-admin/src/pages/[orgId]/events/[eventId]/attributes/index.jsx @@ -97,6 +97,7 @@ import { ModalHeader, ModalBody, ModalCloseButton, + Text, useDisclosure, } from '@chakra-ui/react'; import DashboardLayout from '@/layouts/DashboardLayout'; @@ -150,13 +151,14 @@ export default function Attributes() { headerButton={ <> } debugInfo={JSON.stringify(attributes)} > + + {attributes.length === 0 ? ( +
+ + No attributes created + + + Add attributes and assign participants to see details + +
+ ) : ( + <> + )} diff --git a/apps/web-admin/src/pages/[orgId]/events/[eventId]/extras/[extraId]/index.jsx b/apps/web-admin/src/pages/[orgId]/events/[eventId]/extras/[extraId]/index.jsx index 54ac8378..cb0e68a5 100644 --- a/apps/web-admin/src/pages/[orgId]/events/[eventId]/extras/[extraId]/index.jsx +++ b/apps/web-admin/src/pages/[orgId]/events/[eventId]/extras/[extraId]/index.jsx @@ -1,7 +1,7 @@ import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; -import { Button, Flex } from '@chakra-ui/react'; +import { Text, Button, Flex } from '@chakra-ui/react'; import DashboardLayout from '@/layouts/DashboardLayout'; import DataDisplay from '@/components/DataDisplay'; @@ -112,6 +112,18 @@ export default function ExtraById() { router.push(`/${orgId}/events/${eventId}/participants/${row.id}`); }} /> + {extraDetails.length === 0 ? ( +
+ + No participants assigned + + + Assign participants for extras to see details + +
+ ) : ( + <> + )} ); } diff --git a/apps/web-admin/src/pages/[orgId]/events/[eventId]/extras/index.jsx b/apps/web-admin/src/pages/[orgId]/events/[eventId]/extras/index.jsx index 78efe1ce..cfb7919a 100644 --- a/apps/web-admin/src/pages/[orgId]/events/[eventId]/extras/index.jsx +++ b/apps/web-admin/src/pages/[orgId]/events/[eventId]/extras/index.jsx @@ -103,6 +103,7 @@ import { ModalHeader, ModalBody, ModalCloseButton, + Text, useDisclosure, } from '@chakra-ui/react'; import DashboardLayout from '@/layouts/DashboardLayout'; @@ -176,6 +177,18 @@ export default function Extras() { router.push(`/${orgId}/events/${eventId}/extras/${row.id}`); }} /> + {extras.length === 0 ? ( +
+ + No extras created + + + Add extras assigned and checked in to see details + +
+ ) : ( + <> + )} {/* Modal for creating a new extra */} diff --git a/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/[participantId]/index.jsx b/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/[participantId]/index.jsx index bc68b92c..1ba53e7e 100644 --- a/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/[participantId]/index.jsx +++ b/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/[participantId]/index.jsx @@ -95,6 +95,18 @@ export default function ParticipantById() { Extras - {participant.numberOfExtrasCheckedIn} checked in + {participant.length === 0 ? ( +
+ + No participants created + + + Add participants and assignment to see details + +
+ ) : ( + <> + )} ); } diff --git a/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/check-in/index.jsx b/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/check-in/index.jsx index 7bcf34d1..e43149c1 100644 --- a/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/check-in/index.jsx +++ b/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/check-in/index.jsx @@ -1,7 +1,7 @@ import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; -import { Button, Flex } from '@chakra-ui/react'; +import { Button, Flex, Text } from '@chakra-ui/react'; import DashboardLayout from '@/layouts/DashboardLayout'; @@ -111,6 +111,18 @@ export default function ParticipantsCheckIn() { router.push(`/${orgId}/events/${eventId}/participants/${row.id}`); }} /> + {participantsCheckIn.length === 0 ? ( +
+ + No participants checked-in + + + Add details about the checked-in participants + +
+ ) : ( + <> + )} ); } diff --git a/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/index.jsx b/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/index.jsx index 6911866f..4f521c31 100644 --- a/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/index.jsx +++ b/apps/web-admin/src/pages/[orgId]/events/[eventId]/participants/index.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { Button, useDisclosure } from '@chakra-ui/react'; +import { Button, Text, useDisclosure } from '@chakra-ui/react'; import { useRouter } from 'next/router'; import DashboardLayout from '@/layouts/DashboardLayout'; import DataDisplay from '@/components/DataDisplay'; @@ -175,6 +175,18 @@ export default function Participants() { > + {participants.length === 0 ? ( +
+ + No participants + + + Add participants for the event to see details + +
+ ) : ( + <> + )} { - console.log(data.data.events); + console.log(`events: ${data.data.events}`); setEvents(data.data.events || []); }, ); @@ -207,6 +208,18 @@ export default function Events() { router.push(`/${orgId}/events/${row.id}/participants`); }} /> + {events.length === 0 ? ( +
+ + No events for this organization + + + Add events for this organization to see details + +
+ ) : ( + <> + )} diff --git a/apps/web-admin/src/pages/[orgId]/members/index.jsx b/apps/web-admin/src/pages/[orgId]/members/index.jsx index 2ccc3ccc..88cb5884 100644 --- a/apps/web-admin/src/pages/[orgId]/members/index.jsx +++ b/apps/web-admin/src/pages/[orgId]/members/index.jsx @@ -88,6 +88,7 @@ import { ModalHeader, ModalBody, ModalCloseButton, + Text, useDisclosure, } from '@chakra-ui/react'; import DashboardLayout from '@/layouts/DashboardLayout'; @@ -143,6 +144,18 @@ export default function OrganizationMembers() { debugInfo={members} > + {members.length === 0 ? ( +
+ + No members for the event + + + Add members for the event and their details + +
+ ) : ( + <> + )}