chore: show workspace members (#852)

This commit is contained in:
Aaryan Khandelwal 2023-04-17 16:41:16 +05:30 committed by GitHub
parent f5351e4419
commit dc53708109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 19 deletions

View File

@ -1,7 +1,5 @@
import { FC } from "react";
import { useRouter } from "next/router";
// react-hook-form
import { UseFormWatch } from "react-hook-form";
// ui
@ -22,8 +20,6 @@ type Props = {
};
export const GithubImportUsers: FC<Props> = ({ handleStepChange, users, setUsers, watch }) => {
const router = useRouter();
const isInvalid = users.filter((u) => u.import !== false && u.email === "").length > 0;
return (
@ -44,7 +40,6 @@ export const GithubImportUsers: FC<Props> = ({ handleStepChange, users, setUsers
index={index}
users={users}
setUsers={setUsers}
project={watch("project")}
/>
))}
</div>

View File

@ -4,21 +4,20 @@ import { useRouter } from "next/router";
import useSWR from "swr";
// services
import projectService from "services/project.service";
import workspaceService from "services/workspace.service";
// ui
import { Avatar, CustomSearchSelect, CustomSelect, Input } from "components/ui";
// types
import { IGithubRepoCollaborator } from "types";
import { IUserDetails } from "./root";
// fetch-keys
import { PROJECT_MEMBERS } from "constants/fetch-keys";
import { WORKSPACE_MEMBERS } from "constants/fetch-keys";
type Props = {
collaborator: IGithubRepoCollaborator;
index: number;
users: IUserDetails[];
setUsers: React.Dispatch<React.SetStateAction<IUserDetails[]>>;
project: string | null;
};
const importOptions = [
@ -36,21 +35,13 @@ const importOptions = [
},
];
export const SingleUserSelect: React.FC<Props> = ({
collaborator,
index,
users,
setUsers,
project,
}) => {
export const SingleUserSelect: React.FC<Props> = ({ collaborator, index, users, setUsers }) => {
const router = useRouter();
const { workspaceSlug } = router.query;
const { data: members } = useSWR(
workspaceSlug && project ? PROJECT_MEMBERS(project) : null,
workspaceSlug && project
? () => projectService.projectMembers(workspaceSlug as string, project)
: null
workspaceSlug ? WORKSPACE_MEMBERS(workspaceSlug.toString()) : null,
workspaceSlug ? () => workspaceService.workspaceMembers(workspaceSlug.toString()) : null
);
const options =