import useSWR from "swr"; import { useState, useMemo } from "react"; import { useTranslation } from "react-i18next"; import { Virtuoso } from "react-virtuoso"; import { Box, Paper, TextField } from "@mui/material"; import { getRules } from "@/services/api"; import { BaseEmpty, BasePage } from "@/components/base"; import RuleItem from "@/components/rule/rule-item"; const RulesPage = () => { const { t } = useTranslation(); const { data = [] } = useSWR("getRules", getRules); const [filterText, setFilterText] = useState(""); const rules = useMemo(() => { return data.filter((each) => each.payload.includes(filterText)); }, [data, filterText]); return ( setFilterText(e.target.value)} sx={{ input: { py: 0.65, px: 1.25 } }} /> {rules.length > 0 ? ( ( )} followOutput={"smooth"} /> ) : ( )} ); }; export default RulesPage;