feat(AdminPage): add support for displaying user ID, creation date, and update date in the user table
fix(AdminPage): add type annotations to user variables in filter and map functions to improve type safety
This commit is contained in:
parent
21ef1b43c7
commit
bf81507447
2 changed files with 6 additions and 2 deletions
|
|
@ -27,6 +27,7 @@ import ConfirmationModal from "../../modals/ConfirmationModal";
|
||||||
import UserManagementModal from "../../modals/UserManagementModal";
|
import UserManagementModal from "../../modals/UserManagementModal";
|
||||||
import { UserInputType } from "../../types/components";
|
import { UserInputType } from "../../types/components";
|
||||||
import Header from "../../components/headerComponent";
|
import Header from "../../components/headerComponent";
|
||||||
|
import { Users } from "../../types/api";
|
||||||
|
|
||||||
export default function AdminPage() {
|
export default function AdminPage() {
|
||||||
const [inputValue, setInputValue] = useState("");
|
const [inputValue, setInputValue] = useState("");
|
||||||
|
|
@ -88,7 +89,7 @@ export default function AdminPage() {
|
||||||
if (input === "") {
|
if (input === "") {
|
||||||
setFilterUserList(userList.current);
|
setFilterUserList(userList.current);
|
||||||
} else {
|
} else {
|
||||||
const filteredList = userList.current.filter((user) =>
|
const filteredList = userList.current.filter((user:Users) =>
|
||||||
user.username.toLowerCase().includes(input.toLowerCase())
|
user.username.toLowerCase().includes(input.toLowerCase())
|
||||||
);
|
);
|
||||||
setFilterUserList(filteredList);
|
setFilterUserList(filteredList);
|
||||||
|
|
@ -276,7 +277,7 @@ export default function AdminPage() {
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
{!loadingUsers && (
|
{!loadingUsers && (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{filterUserList.map((user, index) => (
|
{filterUserList.map((user:UserInputType, index) => (
|
||||||
<TableRow key={index}>
|
<TableRow key={index}>
|
||||||
<TableCell className="truncate py-2 font-medium">
|
<TableCell className="truncate py-2 font-medium">
|
||||||
<ShadTooltip content={user.id}>
|
<ShadTooltip content={user.id}>
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,9 @@ export type UserInputType = {
|
||||||
password: string;
|
password: string;
|
||||||
is_active?: boolean;
|
is_active?: boolean;
|
||||||
is_superuser?: boolean;
|
is_superuser?: boolean;
|
||||||
|
id: string;
|
||||||
|
create_at: string;
|
||||||
|
updated_at:string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ApiKeyType = {
|
export type ApiKeyType = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue