Now shows users in project when clicked
This commit is contained in:
parent
6dfc31832c
commit
e8262ed5e0
1 changed files with 32 additions and 9 deletions
|
@ -1,6 +1,8 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { NewProject } from "../Types/goTypes";
|
import { NewProject } from "../Types/goTypes";
|
||||||
import ProjectInfoModal from "./ProjectInfoModal";
|
import ProjectInfoModal from "./ProjectInfoModal";
|
||||||
|
import UserInfoModal from "./UserInfoModal";
|
||||||
|
import DeleteUser from "./DeleteUser";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of projects for admin manage projects page, that sets an onClick
|
* A list of projects for admin manage projects page, that sets an onClick
|
||||||
|
@ -16,26 +18,47 @@ import ProjectInfoModal from "./ProjectInfoModal";
|
||||||
export function ProjectListAdmin(props: {
|
export function ProjectListAdmin(props: {
|
||||||
projects: NewProject[];
|
projects: NewProject[];
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
const [modalVisible, setModalVisible] = useState(false);
|
const [projectModalVisible, setProjectModalVisible] = useState(false);
|
||||||
const [projectname, setProjectname] = useState("");
|
const [projectname, setProjectname] = useState("");
|
||||||
|
const [userModalVisible, setUserModalVisible] = useState(false);
|
||||||
|
const [username, setUsername] = useState("");
|
||||||
|
|
||||||
const handleClick = (username: string): void => {
|
const handleClickUser = (username: string): void => {
|
||||||
setProjectname(username);
|
setUsername(username);
|
||||||
setModalVisible(true);
|
setUserModalVisible(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = (): void => {
|
const handleClickProject = (username: string): void => {
|
||||||
|
setProjectname(username);
|
||||||
|
setProjectModalVisible(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCloseProject = (): void => {
|
||||||
setProjectname("");
|
setProjectname("");
|
||||||
setModalVisible(false);
|
setProjectModalVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCloseUser = (): void => {
|
||||||
|
setProjectname("");
|
||||||
|
setUserModalVisible(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ProjectInfoModal
|
<ProjectInfoModal
|
||||||
onClose={handleClose}
|
onClose={handleCloseProject}
|
||||||
isVisible={modalVisible}
|
onClick={handleClickUser}
|
||||||
|
isVisible={projectModalVisible}
|
||||||
projectname={projectname}
|
projectname={projectname}
|
||||||
/>
|
/>
|
||||||
|
<UserInfoModal
|
||||||
|
manageMember={true}
|
||||||
|
onClose={handleCloseUser}
|
||||||
|
//TODO: CHANGE TO REMOVE USER FROM PROJECT
|
||||||
|
onDelete={() => DeleteUser}
|
||||||
|
isVisible={userModalVisible}
|
||||||
|
username={username}
|
||||||
|
/>
|
||||||
<div>
|
<div>
|
||||||
<ul className="font-bold underline text-[30px] cursor-pointer padding">
|
<ul className="font-bold underline text-[30px] cursor-pointer padding">
|
||||||
{props.projects.map((project) => (
|
{props.projects.map((project) => (
|
||||||
|
@ -43,7 +66,7 @@ export function ProjectListAdmin(props: {
|
||||||
className="pt-5"
|
className="pt-5"
|
||||||
key={project.name}
|
key={project.name}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleClick(project.name);
|
handleClickProject(project.name);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{project.name}
|
{project.name}
|
||||||
|
|
Loading…
Reference in a new issue