@snapdragonsnursery/react-components 1.1.17 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ChildSearchPage.jsx +18 -12
package/package.json
CHANGED
package/src/ChildSearchPage.jsx
CHANGED
|
@@ -322,6 +322,13 @@ const ChildSearchPage = ({
|
|
|
322
322
|
const data = await apiResponse.json();
|
|
323
323
|
|
|
324
324
|
if (data.success) {
|
|
325
|
+
console.log("🔍 API Response:", {
|
|
326
|
+
children: data.data.children.length,
|
|
327
|
+
pagination: data.data.pagination,
|
|
328
|
+
totalCount: data.data.pagination.totalCount,
|
|
329
|
+
totalPages: data.data.pagination.totalPages
|
|
330
|
+
});
|
|
331
|
+
|
|
325
332
|
setChildren(data.data.children);
|
|
326
333
|
setPagination(data.data.pagination);
|
|
327
334
|
trackEvent("child_search_success", {
|
|
@@ -439,13 +446,12 @@ const ChildSearchPage = ({
|
|
|
439
446
|
<div className="p-6">
|
|
440
447
|
{/* Search Input */}
|
|
441
448
|
<div className="relative mb-4">
|
|
442
|
-
<MagnifyingGlassIcon className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400 pointer-events-none" />
|
|
443
449
|
<Input
|
|
444
450
|
type="text"
|
|
445
|
-
placeholder="🔧 UPDATED: Search by name or child ID... (v1.1.
|
|
451
|
+
placeholder="🔧 UPDATED: Search by name or child ID... (v1.1.17)"
|
|
446
452
|
value={searchTerm}
|
|
447
453
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
448
|
-
className="pl-
|
|
454
|
+
className="pl-4"
|
|
449
455
|
/>
|
|
450
456
|
</div>
|
|
451
457
|
|
|
@@ -661,9 +667,9 @@ const ChildSearchPage = ({
|
|
|
661
667
|
<div className="px-6 py-4 border-b border-gray-200 dark:border-gray-700">
|
|
662
668
|
<div className="flex items-center justify-between">
|
|
663
669
|
<div className="text-sm text-gray-600 dark:text-gray-400">
|
|
664
|
-
{pagination.totalCount
|
|
665
|
-
?
|
|
666
|
-
:
|
|
670
|
+
{(pagination.totalCount > 0 || children.length > 0)
|
|
671
|
+
? `Showing ${startItem} to ${endItem} of ${pagination.totalCount || children.length} children`
|
|
672
|
+
: "No children found"}
|
|
667
673
|
</div>
|
|
668
674
|
</div>
|
|
669
675
|
</div>
|
|
@@ -731,20 +737,20 @@ const ChildSearchPage = ({
|
|
|
731
737
|
)}
|
|
732
738
|
|
|
733
739
|
{/* Pagination */}
|
|
734
|
-
{pagination.totalCount > 0 && (
|
|
740
|
+
{(pagination.totalCount > 0 || children.length > 0) && (
|
|
735
741
|
<div className="px-6 py-4 border-t border-gray-200 dark:border-gray-700">
|
|
736
742
|
{/* Pagination Info */}
|
|
737
743
|
<div className="flex items-center justify-between mb-4">
|
|
738
744
|
<div className="text-sm text-gray-600 dark:text-gray-400">
|
|
739
|
-
Page {pagination.page} of {pagination.totalPages}
|
|
745
|
+
Page {pagination.page} of {pagination.totalPages || 1}
|
|
740
746
|
</div>
|
|
741
747
|
<div className="text-sm text-gray-600 dark:text-gray-400">
|
|
742
|
-
{pagination.totalCount} total children
|
|
748
|
+
{pagination.totalCount || children.length} total children
|
|
743
749
|
</div>
|
|
744
750
|
</div>
|
|
745
751
|
|
|
746
752
|
{/* Pagination Controls */}
|
|
747
|
-
{pagination.totalPages > 1 && (
|
|
753
|
+
{(pagination.totalPages > 1 || children.length > 0) && (
|
|
748
754
|
<Pagination>
|
|
749
755
|
<PaginationContent>
|
|
750
756
|
<PaginationItem>
|
|
@@ -759,12 +765,12 @@ const ChildSearchPage = ({
|
|
|
759
765
|
|
|
760
766
|
{/* Page numbers */}
|
|
761
767
|
{Array.from(
|
|
762
|
-
{ length: pagination.totalPages },
|
|
768
|
+
{ length: Math.max(pagination.totalPages, 1) },
|
|
763
769
|
(_, i) => i + 1
|
|
764
770
|
)
|
|
765
771
|
.filter((page) => {
|
|
766
772
|
const current = pagination.page;
|
|
767
|
-
const total = pagination.totalPages;
|
|
773
|
+
const total = Math.max(pagination.totalPages, 1);
|
|
768
774
|
return (
|
|
769
775
|
page === 1 ||
|
|
770
776
|
page === total ||
|