Revamped the statistical page to work with the new entity system, along with some other improvements to it

This commit is contained in:
Tiago Ribeiro
2024-11-21 15:37:53 +00:00
parent 0eed8e4612
commit f301001ebe
8 changed files with 1052 additions and 541 deletions

View File

@@ -1,11 +1,12 @@
import {useState, useMemo} from "react";
import { useState, useMemo } from "react";
import Input from "@/components/Low/Input";
import {search} from "@/utils/search";
import { search } from "@/utils/search";
export function useListSearch<T>(fields: string[][], rows: T[]) {
export function useListSearch<T>(fields: string[][], rows: T[], placeholder?: string) {
const [text, setText] = useState("");
const renderSearch = () => <Input type="text" name="search" onChange={setText} placeholder="Enter search text" value={text} />;
const renderSearch = () =>
<Input type="text" name="search" onChange={setText} placeholder={placeholder || "Enter search text"} value={text} />;
const updatedRows = useMemo(() => {
if (text.length > 0) return search(text, fields, rows);