用户管理页面优化

This commit is contained in:
sijinhui 2024-03-26 08:56:42 +08:00
parent aa8859b186
commit 532ace669e
2 changed files with 7 additions and 2 deletions

View File

@ -4,8 +4,11 @@ import { User } from "@prisma/client";
import UsersTable from "../../components/users-table";
async function getData() {
const users = await prisma.user.findMany();
return users;
return await prisma.user.findMany({
orderBy: {
createdAt: "desc",
},
});
}
export default async function UsersPage() {
const users: User[] = await getData();

View File

@ -118,11 +118,13 @@ function UsersTable({ users }: UserInterface) {
},
onFilterDropdownOpenChange: (visible) => {
if (visible) {
// @ts-ignore
setTimeout(() => searchInput.current?.select(), 100);
}
},
render: (text) =>
searchedColumn === dataIndex ? (
// @ts-ignore
<Highlighter
highlightStyle={{ backgroundColor: "#ffc069", padding: 0 }}
searchWords={[searchText]}