small bugs fixed

This commit is contained in:
2025-07-18 19:28:15 +05:30
parent 1071b80930
commit 46be622851
4 changed files with 52 additions and 23 deletions

View File

@@ -9,7 +9,12 @@ interface Props {
onClear: () => void;
}
export const SeleniumTaskBanner = ({ status, message, show, onClear }: Props) => {
export const SeleniumTaskBanner = ({
status,
message,
show,
onClear,
}: Props) => {
if (!show) return null;
const getIcon = () => {
@@ -26,7 +31,7 @@ export const SeleniumTaskBanner = ({ status, message, show, onClear }: Props) =>
};
return (
<div className="bg-white border border-gray-200 shadow-md rounded-lg p-3 mb-4 flex items-start justify-between">
<div className="bg-white border border-gray-200 shadow-md rounded-lg p-3 m-4 flex items-start justify-between">
<div className="flex items-start gap-3">
{getIcon()}
<div>
@@ -34,8 +39,8 @@ export const SeleniumTaskBanner = ({ status, message, show, onClear }: Props) =>
{status === "pending"
? "Selenium Task In Progress"
: status === "success"
? "Selenium Task Completed"
: "Selenium Task Error"}
? "Selenium Task Completed"
: "Selenium Task Error"}
</div>
<p className="text-gray-600 text-sm">{message}</p>
</div>

View File

@@ -1,4 +1,4 @@
import { useMemo, useState } from "react";
import { useEffect, useMemo, useState } from "react";
import {
Table,
TableBody,
@@ -69,6 +69,8 @@ interface PatientTableProps {
allowDelete?: boolean;
allowCheckbox?: boolean;
onSelectPatient?: (patient: Patient | null) => void;
onPageChange?: (page: number) => void;
onSearchChange?: (searchTerm: string) => void;
}
export function PatientTable({
@@ -77,6 +79,8 @@ export function PatientTable({
allowDelete,
allowCheckbox,
onSelectPatient,
onPageChange,
onSearchChange,
}: PatientTableProps) {
const { toast } = useToast();
const { user } = useAuth();
@@ -289,6 +293,15 @@ export function PatientTable({
}
};
useEffect(() => {
if (onPageChange) onPageChange(currentPage);
}, [currentPage, onPageChange]);
useEffect(() => {
const term = debouncedSearchCriteria?.searchTerm?.trim() || "recent";
if (onSearchChange) onSearchChange(term);
}, [debouncedSearchCriteria, onSearchChange]);
const totalPages = useMemo(
() => Math.ceil((patientsData?.totalCount || 0) / patientsPerPage),
[patientsData]