diff --git a/src/Routes/Logs/Logs.tsx b/src/Routes/Logs/Logs.tsx index 621dab1..5ab5a68 100644 --- a/src/Routes/Logs/Logs.tsx +++ b/src/Routes/Logs/Logs.tsx @@ -28,7 +28,7 @@ export default function Logs() { (state: OldSessionState) => state.old_session_checked.value ); const [searchTerm, setSearchTerm] = useState(""); - const [searchToday, setSearchToday] = useState(true); + const [searchToday, setSearchToday] = useState(""); function getToday() { const current = new Date(); const date = @@ -84,11 +84,10 @@ export default function Logs() { { - setSearchToday(!searchToday); - if (searchTerm != getToday()) { - setSearchTerm(getToday()); + if (searchToday === "") { + setSearchToday(getToday()); } else { - setSearchTerm(""); + setSearchToday(""); } }} /> @@ -112,7 +111,6 @@ export default function Logs() { }} value={searchTerm} onChange={(e: React.ChangeEvent) => { - setSearchToday(false); setSearchTerm(e.target.value); }} /> @@ -145,9 +143,10 @@ export default function Logs() { {logs.data .filter( (Log: ProductLog) => - Log.name.toLowerCase().includes(searchTerm) || - Log.history_user.toLowerCase().includes(searchTerm) || - Log.history_date.toLowerCase().includes(searchTerm) + (Log.name.toLowerCase().includes(searchTerm) || + Log.history_user.toLowerCase().includes(searchTerm) || + Log.history_date.toLowerCase().includes(searchTerm)) && + Log.history_date.toLowerCase().includes(searchToday) ) .map((row: ProductLog, index: number) => (