Small fix to props and imports

This commit is contained in:
Peter KW 2024-03-20 00:16:30 +01:00
parent cc231dbfaa
commit b20817ec8a

View file

@ -1,14 +1,6 @@
import { useState } from "react"; import { useState } from "react";
import { PublicUser } from "../Types/goTypes";
import UserInfoModal from "./UserInfoModal"; import UserInfoModal from "./UserInfoModal";
/**
* The props for the UserProps component
*/
interface UserProps {
users: PublicUser[];
}
/** /**
* A list of users for admin manage users page, that sets an onClick * A list of users for admin manage users page, that sets an onClick
* function for eact user <li> element, which displays a modul with * function for eact user <li> element, which displays a modul with
@ -20,7 +12,7 @@ interface UserProps {
* return <UserList users={users} />; * return <UserList users={users} />;
*/ */
export function UserListAdmin(props: UserProps): JSX.Element { export function UserListAdmin(props: { users: string[] }): JSX.Element {
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
@ -46,12 +38,12 @@ export function UserListAdmin(props: UserProps): JSX.Element {
{props.users.map((user) => ( {props.users.map((user) => (
<li <li
className="pt-5" className="pt-5"
key={user.userId} key={user}
onClick={() => { onClick={() => {
handleClick(user.username); handleClick(user);
}} }}
> >
{user.username} {user}
</li> </li>
))} ))}
</ul> </ul>