feat(tables): integrate EmptyListWrapper component for improved empty state handling
- Add EmptyListWrapper to various tables (Admins, Companies, Customers, Feedback, Notification History, Tenders) to provide a consistent empty state message when no data is available. - Update phone number and status display logic in the Profile page to handle null values gracefully. - Introduce worktree setup configuration in worktrees.json for easier project setup.
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
PencilSquareIcon,
|
||||
TrashIcon,
|
||||
} from "@/assets/icons";
|
||||
import EmptyListWrapper from "@/components/HOC/EmptyListWrapper";
|
||||
import ConfirmationModal from "@/components/ui/ConfirmationModal";
|
||||
import {
|
||||
Table,
|
||||
@@ -44,6 +45,9 @@ const CompaniesTable = () => {
|
||||
setFilterValue,
|
||||
isMutating,
|
||||
} = useCompanyListPresenter();
|
||||
const companies = allCompanies.filter(
|
||||
(c): c is NonNullable<typeof c> => c != null,
|
||||
);
|
||||
return (
|
||||
<div className="flex flex-col rounded-[10px] bg-white px-7.5 pb-4 pt-7.5 shadow-1 dark:bg-gray-dark dark:shadow-card">
|
||||
<ListHeader
|
||||
@@ -66,10 +70,12 @@ const CompaniesTable = () => {
|
||||
</TableHeader>
|
||||
{isPending && <TableSkeleton column={columns.length} />}
|
||||
<TableBody>
|
||||
{allCompanies.map((company, index) =>
|
||||
!company ? (
|
||||
<h6 key={index}>No Data was Found</h6>
|
||||
) : (
|
||||
<EmptyListWrapper
|
||||
list={companies}
|
||||
columns={columns}
|
||||
emptyMessage="No companies were found"
|
||||
>
|
||||
{companies.map((company, index) => (
|
||||
<TableRow
|
||||
key={company.id}
|
||||
className="odd:bg-gray-2 dark:odd:bg-gray-7"
|
||||
@@ -156,8 +162,8 @@ const CompaniesTable = () => {
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
),
|
||||
)}
|
||||
))}
|
||||
</EmptyListWrapper>
|
||||
</TableBody>
|
||||
</Table>
|
||||
<Modal
|
||||
|
||||
Reference in New Issue
Block a user