mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
9075f9441c
* style: added cta at the bottom of sidebar, added missing icons as well, showing dynamic workspace member count on workspace dropdown * refractor: running parallel request, made create/edit label function to async function * fix: sidebar dropdown content going below kanban items outside click detection in need help dropdown * refractor: making parallel api calls fix: create state input comes at bottom, create state input gets on focus automatically, form is getting submitted on enter click * refactoring file structure and signin page * style: changed text and added spinner for signing in loading * refractor: removed unused type * fix: my issue cta in profile page sending to 404 page * fix: added new s3 bucket url in next.config.js file increased image modal height * packaging UI components * eslint config * eslint fixes * refactoring changes * build fixes * minor fixes * adding todo comments for reference * refactor: cleared unused imports and re ordered imports * refactor: removed unused imports * fix: added workspace argument to useissues hook * refactor: removed api-routes file, unnecessary constants * refactor: created helpers folder, removed unnecessary constants * refactor: new context for issue view * refactoring issues page * build fixes * refactoring * refactor: create issue modal * refactor: module ui * fix: sub-issues mutation * fix: create more option in create issue modal * description form debounce issue * refactor: global component for assignees list * fix: link module interface * fix: priority icons and sub-issues count added * fix: cycle mutation in issue details page * fix: remove issue from cycle mutation * fix: create issue modal in home page * fix: removed unnecessary props * fix: updated create issue form status * fix: settings auth breaking * refactor: issue details page Co-authored-by: Dakshesh Jain <dakshesh.jain14@gmail.com> Co-authored-by: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Co-authored-by: venkatesh-soulpage <venkatesh.marreboyina@soulpageit.com> Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia1001@gmail.com>
121 lines
4.1 KiB
TypeScript
121 lines
4.1 KiB
TypeScript
import React from "react";
|
|
import Link from "next/link";
|
|
import { useRouter } from "next/router";
|
|
// ui
|
|
// icons
|
|
import {
|
|
CalendarDaysIcon,
|
|
CheckIcon,
|
|
PencilIcon,
|
|
PlusIcon,
|
|
TrashIcon,
|
|
ClipboardDocumentListIcon,
|
|
} from "@heroicons/react/24/outline";
|
|
// types
|
|
import type { IProject } from "types";
|
|
// ui
|
|
import { Button } from "components/ui";
|
|
// hooks
|
|
import useProjectMembers from "hooks/use-project-members";
|
|
// helpers
|
|
import { renderShortNumericDateFormat } from "helpers/date-time.helper";
|
|
|
|
export type ProjectCardProps = {
|
|
workspaceSlug: string;
|
|
project: IProject;
|
|
setToJoinProject: (id: string | null) => void;
|
|
setDeleteProject: (id: string | null) => void;
|
|
};
|
|
|
|
export const ProjectCard: React.FC<ProjectCardProps> = (props) => {
|
|
const { workspaceSlug, project, setToJoinProject, setDeleteProject } = props;
|
|
// router
|
|
const router = useRouter();
|
|
// fetching project members information
|
|
const { members, isMember, canDelete, canEdit } = useProjectMembers(workspaceSlug, project.id);
|
|
|
|
if (!members) {
|
|
return (
|
|
<div className="flex h-36 w-full flex-col rounded-md bg-white px-4 py-3">
|
|
<div className="h-full w-full animate-pulse bg-gray-50" />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<div className="flex h-full w-full flex-col rounded-md border bg-white px-4 py-3">
|
|
<div className="flex items-center justify-between">
|
|
<div className="flex gap-2 text-lg font-medium">
|
|
<Link href={`/${workspaceSlug}/projects/${project.id}/issues`}>
|
|
<a className="flex items-center gap-x-3">
|
|
{project.icon && (
|
|
<span className="text-base">{String.fromCodePoint(parseInt(project.icon))}</span>
|
|
)}
|
|
<span>{project.name}</span>
|
|
<span className="text-xs text-gray-500">{project.identifier}</span>
|
|
</a>
|
|
</Link>
|
|
</div>
|
|
{isMember ? (
|
|
<div className="flex">
|
|
{canEdit && (
|
|
<Link href={`/${workspaceSlug}/projects/${project.id}/settings`}>
|
|
<a className="grid h-7 w-7 cursor-pointer place-items-center rounded p-1 duration-300 hover:bg-gray-100">
|
|
<PencilIcon className="h-4 w-4" />
|
|
</a>
|
|
</Link>
|
|
)}
|
|
{canDelete && (
|
|
<button
|
|
type="button"
|
|
className="grid h-7 w-7 place-items-center rounded p-1 outline-none duration-300 hover:bg-gray-100"
|
|
onClick={() => setDeleteProject(project.id)}
|
|
>
|
|
<TrashIcon className="h-4 w-4 text-red-500" />
|
|
</button>
|
|
)}
|
|
</div>
|
|
) : null}
|
|
</div>
|
|
<div className="mt-2">
|
|
<p className="text-sm">{project.description}</p>
|
|
</div>
|
|
<div className="mt-3 flex h-full items-end justify-between">
|
|
<div className="flex gap-2">
|
|
{!isMember ? (
|
|
<button
|
|
type="button"
|
|
onClick={() => {
|
|
setToJoinProject(project.id);
|
|
}}
|
|
className="flex cursor-pointer items-center gap-1 rounded border p-2 text-xs font-medium duration-300 hover:bg-gray-100"
|
|
>
|
|
<PlusIcon className="h-3 w-3" />
|
|
<span>Select to Join</span>
|
|
</button>
|
|
) : (
|
|
<Button theme="secondary" className="flex items-center gap-1" disabled>
|
|
<CheckIcon className="h-3 w-3" />
|
|
Member
|
|
</Button>
|
|
)}
|
|
<Button
|
|
theme="secondary"
|
|
className="flex items-center gap-1"
|
|
onClick={() => router.push(`/${workspaceSlug}/projects/${project.id}/issues`)}
|
|
>
|
|
<ClipboardDocumentListIcon className="h-3 w-3" />
|
|
Open Project
|
|
</Button>
|
|
</div>
|
|
<div className="mb-1 flex items-center gap-1 text-xs">
|
|
<CalendarDaysIcon className="h-4 w-4" />
|
|
{renderShortNumericDateFormat(project.created_at)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|