Merge pull request #9 from aaryan610/master

feat: preview modal, style: issues page
This commit is contained in:
Vamsi Kurama 2022-11-28 17:46:39 +05:30 committed by GitHub
commit be3d0deafd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 555 additions and 387 deletions

View File

@ -71,9 +71,9 @@ const ShortcutsModal: React.FC<Props> = ({ isOpen, setIsOpen }) => {
{ {
title: "Common", title: "Common",
shortcuts: [ shortcuts: [
{ key: "Ctrl + p", description: "To open create project modal" }, { key: "Ctrl + p", description: "To create project" },
{ key: "Ctrl + i", description: "To open create issue modal" }, { key: "Ctrl + i", description: "To create issue" },
{ key: "Ctrl + q", description: "To open create cycle modal" }, { key: "Ctrl + q", description: "To create cycle" },
{ key: "Ctrl + h", description: "To open shortcuts guide" }, { key: "Ctrl + h", description: "To open shortcuts guide" },
{ {
key: "Ctrl + alt + c", key: "Ctrl + alt + c",

View File

@ -199,110 +199,107 @@ const SingleBoard: React.FC<Props> = ({
{groupedByIssues[groupTitle].map((childIssue: any, index: number) => ( {groupedByIssues[groupTitle].map((childIssue: any, index: number) => (
<Draggable key={childIssue.id} draggableId={childIssue.id} index={index}> <Draggable key={childIssue.id} draggableId={childIssue.id} index={index}>
{(provided, snapshot) => ( {(provided, snapshot) => (
<div <Link href={`/projects/${childIssue.project}/issues/${childIssue.id}`}>
className={`border rounded bg-white shadow-sm cursor-pointer ${ <a
snapshot.isDragging ? "border-indigo-600 shadow-lg bg-indigo-50" : "" className={`group block border rounded bg-white shadow-sm ${
}`} snapshot.isDragging ? "border-indigo-600 shadow-lg bg-indigo-50" : ""
ref={provided.innerRef} }`}
{...provided.draggableProps} ref={provided.innerRef}
> {...provided.draggableProps}
<div
className="px-2 py-3 space-y-1.5 select-none"
{...provided.dragHandleProps}
> >
{Object.keys(properties).map( <div
(key) => className="px-2 py-3 space-y-1.5 select-none"
properties[key as keyof Properties] && {...provided.dragHandleProps}
!Array.isArray(childIssue[key as keyof IIssue]) && ( >
<div {Object.keys(properties).map(
key={key} (key) =>
className={`${ properties[key as keyof Properties] &&
key === "name" !Array.isArray(childIssue[key as keyof IIssue]) && (
? "text-sm font-medium mb-2" <div
: key === "description" key={key}
? "text-xs text-black" className={`${
: key === "priority" key === "name"
? `text-xs bg-gray-200 px-2 py-1 mt-2 flex items-center gap-x-1 rounded w-min whitespace-nowrap capitalize font-medium ${ ? "text-sm font-medium mb-2"
childIssue.priority === "high" : key === "description"
? "bg-red-100 text-red-600" ? "text-xs text-black"
: childIssue.priority === "medium" : key === "priority"
? "bg-orange-100 text-orange-500" ? `text-xs bg-gray-200 px-2 py-1 mt-2 flex items-center gap-x-1 rounded w-min whitespace-nowrap capitalize font-medium ${
: childIssue.priority === "low" childIssue.priority === "high"
? "bg-green-100 text-green-500" ? "bg-red-100 text-red-600"
: "hidden" : childIssue.priority === "medium"
}` ? "bg-orange-100 text-orange-500"
: key === "target_date" : childIssue.priority === "low"
? "text-xs bg-indigo-50 px-2 py-1 mt-2 flex items-center gap-x-1 rounded w-min whitespace-nowrap" ? "bg-green-100 text-green-500"
: "text-sm text-gray-500" : "hidden"
} gap-1 }`
: key === "target_date"
? "text-xs bg-indigo-50 px-2 py-1 mt-2 flex items-center gap-x-1 rounded w-min whitespace-nowrap"
: "text-sm text-gray-500"
} gap-1
`} `}
> >
{key === "target_date" ? ( {key === "target_date" ? (
<> <>
<CalendarDaysIcon className="h-4 w-4" />{" "} <CalendarDaysIcon className="h-4 w-4" />{" "}
{childIssue.target_date {childIssue.target_date
? renderShortNumericDateFormat(childIssue.target_date) ? renderShortNumericDateFormat(childIssue.target_date)
: "N/A"} : "N/A"}
</> </>
) : ( ) : (
"" ""
)} )}
{key === "name" && ( {key === "name" && (
<Link <span className="group-hover:text-theme">
href={`/projects/${childIssue.project}/issues/${childIssue.id}`}
>
<a className="hover:text-theme duration-300">
{childIssue.name} {childIssue.name}
</a> </span>
</Link> )}
)} {key === "state" && (
{key === "state" && ( <>{addSpaceIfCamelCase(childIssue["state_detail"].name)}</>
<>{addSpaceIfCamelCase(childIssue["state_detail"].name)}</> )}
)} {key === "priority" && <>{childIssue.priority}</>}
{key === "priority" && <>{childIssue.priority}</>} {key === "description" && <>{childIssue.description}</>}
{key === "description" && <>{childIssue.description}</>} {key === "assignee" ? (
{key === "assignee" ? ( <div className="flex items-center gap-1 text-xs">
<div className="flex items-center gap-1 text-xs"> {childIssue?.assignee_details?.length > 0 ? (
{childIssue?.assignee_details?.length > 0 ? ( childIssue?.assignee_details?.map(
childIssue?.assignee_details?.map( (assignee: any, index: number) => (
(assignee: any, index: number) => ( <div
<div key={index}
key={index} className={`relative z-[1] h-5 w-5 rounded-full ${
className={`relative z-[1] h-5 w-5 rounded-full ${ index !== 0 ? "-ml-2.5" : ""
index !== 0 ? "-ml-2.5" : "" }`}
}`} >
> {assignee.avatar && assignee.avatar !== "" ? (
{assignee.avatar && assignee.avatar !== "" ? ( <div className="h-5 w-5 border-2 bg-white border-white rounded-full">
<div className="h-5 w-5 border-2 bg-white border-white rounded-full"> <Image
<Image src={assignee.avatar}
src={assignee.avatar} height="100%"
height="100%" width="100%"
width="100%" className="rounded-full"
className="rounded-full" alt={assignee.name}
alt={assignee.name} />
/> </div>
</div> ) : (
) : ( <div
<div className={`h-5 w-5 bg-gray-700 text-white border-2 border-white grid place-items-center rounded-full`}
className={`h-5 w-5 bg-gray-700 text-white border-2 border-white grid place-items-center rounded-full`} >
> {assignee.first_name.charAt(0)}
{assignee.first_name.charAt(0)} </div>
</div> )}
)} </div>
</div> )
) )
) ) : (
) : ( <span>None</span>
<span>None</span> )}
)} </div>
</div> ) : null}
) : null} </div>
</div> )
) )}
)} </div>
</div>
{/* <div {/* <div
className={`p-2 bg-indigo-50 flex items-center justify-between ${ className={`p-2 bg-indigo-50 flex items-center justify-between ${
snapshot.isDragging ? "bg-indigo-200" : "" snapshot.isDragging ? "bg-indigo-200" : ""
}`} }`}
@ -324,7 +321,8 @@ const SingleBoard: React.FC<Props> = ({
</button> </button>
</div> </div>
</div> */} </div> */}
</div> </a>
</Link>
)} )}
</Draggable> </Draggable>
))} ))}

View File

@ -1,5 +1,5 @@
// react // react
import React from "react"; import React, { useEffect, useState } from "react";
// next // next
import Link from "next/link"; import Link from "next/link";
import Image from "next/image"; import Image from "next/image";
@ -25,6 +25,7 @@ import {
renderShortNumericDateFormat, renderShortNumericDateFormat,
replaceUnderscoreIfSnakeCase, replaceUnderscoreIfSnakeCase,
} from "constants/common"; } from "constants/common";
import IssuePreviewModal from "../PreviewModal";
// types // types
type Props = { type Props = {
@ -44,6 +45,9 @@ const ListView: React.FC<Props> = ({
setSelectedIssue, setSelectedIssue,
handleDeleteIssue, handleDeleteIssue,
}) => { }) => {
const [issuePreviewModal, setIssuePreviewModal] = useState(false);
const [previewModalIssueId, setPreviewModalIssueId] = useState<string | null>(null);
const { activeWorkspace, activeProject, states } = useUser(); const { activeWorkspace, activeProject, states } = useUser();
const partialUpdateIssue = (formData: Partial<IIssue>, issueId: string) => { const partialUpdateIssue = (formData: Partial<IIssue>, issueId: string) => {
@ -71,8 +75,23 @@ const ListView: React.FC<Props> = ({
activeWorkspace ? () => workspaceService.workspaceMembers(activeWorkspace.slug) : null activeWorkspace ? () => workspaceService.workspaceMembers(activeWorkspace.slug) : null
); );
const handleHover = (issueId: string) => {
document.addEventListener("keydown", (e) => {
if (e.code === "Space") {
e.preventDefault();
setPreviewModalIssueId(issueId);
setIssuePreviewModal(true);
}
});
};
return ( return (
<div className="mt-4 flex flex-col"> <div className="mt-4 flex flex-col">
<IssuePreviewModal
isOpen={issuePreviewModal}
setIsOpen={setIssuePreviewModal}
issueId={previewModalIssueId}
/>
<div className="overflow-x-auto"> <div className="overflow-x-auto">
<div className="inline-block min-w-full p-0.5 align-middle"> <div className="inline-block min-w-full p-0.5 align-middle">
<div className="overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg"> <div className="overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg">
@ -135,6 +154,7 @@ const ListView: React.FC<Props> = ({
index === 0 ? "border-gray-300" : "border-gray-200", index === 0 ? "border-gray-300" : "border-gray-200",
"border-t" "border-t"
)} )}
onMouseEnter={() => handleHover(issue.id)}
> >
{Object.keys(properties).map( {Object.keys(properties).map(
(key) => (key) =>

View File

@ -0,0 +1,138 @@
// next
import { useRouter } from "next/router";
// react
import { Fragment } from "react";
// headless ui
import { Dialog, Transition } from "@headlessui/react";
// hooks
import useUser from "lib/hooks/useUser";
// services
import issuesServices from "lib/services/issues.services";
import projectService from "lib/services/project.service";
// swr
import useSWR from "swr";
// types
import { IIssue, ProjectMember } from "types";
// constants
import { PROJECT_ISSUES_DETAILS, PROJECT_MEMBERS } from "constants/fetch-keys";
import { Button } from "ui";
import { ChartBarIcon, Squares2X2Icon, TagIcon, UserIcon } from "@heroicons/react/24/outline";
type Props = {
isOpen: boolean;
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
issueId: string | null;
};
const IssuePreviewModal = ({ isOpen, setIsOpen, issueId }: Props) => {
const closeModal = () => {
setIsOpen(false);
};
const { activeWorkspace, activeProject } = useUser();
const router = useRouter();
const { data: issueDetails } = useSWR<IIssue | null>(
activeWorkspace && activeProject && issueId ? PROJECT_ISSUES_DETAILS(issueId) : null,
activeWorkspace && activeProject && issueId
? () => issuesServices.getIssue(activeWorkspace.slug, activeProject.id, issueId)
: null
);
const { data: users } = useSWR<ProjectMember[] | null>(
activeWorkspace && activeProject ? PROJECT_MEMBERS(activeProject.id) : null,
activeWorkspace && activeProject
? () => projectService.projectMembers(activeWorkspace.slug, activeProject.id)
: null
);
return (
<>
<Transition.Root appear show={isOpen} as={Fragment}>
<Dialog as="div" className="relative z-10" onClose={closeModal}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-25" />
</Transition.Child>
<div className="fixed inset-0 overflow-y-auto">
<div className="flex min-h-full items-center justify-center p-4 text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className="w-full max-w-3xl transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all">
<Dialog.Title
as="h3"
className="text-xl flex flex-col gap-1 font-medium leading-6 text-gray-900"
>
{issueDetails?.project_detail.identifier}-{issueDetails?.sequence_id}{" "}
{issueDetails?.name}
<span className="text-sm text-gray-500 font-normal">
Created by{" "}
{users?.find((u) => u.id === issueDetails?.created_by)?.member.first_name}
</span>
</Dialog.Title>
<div className="mt-4">
<p className="text-sm text-gray-500">{issueDetails?.description}</p>
</div>
<div className="mt-4 flex flex-wrap gap-2">
<span className="flex items-center gap-1 hover:bg-gray-100 border rounded-md shadow-sm px-2 py-1 sm:text-sm">
<Squares2X2Icon className="h-3 w-3" />
{issueDetails?.state_detail.name}
</span>
<span className="flex items-center gap-1 hover:bg-gray-100 border rounded-md shadow-sm px-2 py-1 capitalize sm:text-sm">
<ChartBarIcon className="h-3 w-3" />
{issueDetails?.priority}
</span>
<span className="flex items-center gap-1 hover:bg-gray-100 border rounded-md shadow-sm px-2 py-1 capitalize sm:text-sm">
<TagIcon className="h-3 w-3" />
{issueDetails?.label_details && issueDetails.label_details.length > 0
? issueDetails.label_details.map((label) => (
<span key={label.id}>{label.name}</span>
))
: "None"}
</span>
<span className="flex items-center gap-1 hover:bg-gray-100 border rounded-md shadow-sm px-2 py-1 capitalize sm:text-sm">
<UserIcon className="h-3 w-3" />
{issueDetails?.assignee_details && issueDetails.assignee_details.length > 0
? issueDetails.assignee_details.map((assignee) => (
<span key={assignee.id}>{assignee.first_name}</span>
))
: "None"}
</span>
</div>
<div className="mt-4 flex gap-3 justify-end">
<Button
onClick={() =>
router.push(`/projects/${activeProject?.id}/issues/${issueId}`)
}
>
View in Detail
</Button>
<Button onClick={closeModal}>Close</Button>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition.Root>
</>
);
};
export default IssuePreviewModal;

View File

@ -409,17 +409,6 @@ const Sidebar: React.FC = () => {
</a> </a>
</Link> </Link>
))} ))}
<button
type="button"
className="w-full flex items-center gap-3 p-2 hover:bg-indigo-100 text-xs font-medium rounded-md outline-none"
onClick={() => {
const e = new KeyboardEvent("keydown", { key: "h", ctrlKey: true });
document.dispatchEvent(e);
}}
>
<QuestionMarkCircleIcon className="flex-shrink-0 h-4 w-4" />
{!sidebarCollapse && "Help Centre"}
</button>
</div> </div>
</div> </div>
<div <div
@ -432,68 +421,83 @@ const Sidebar: React.FC = () => {
{projects.length > 0 ? ( {projects.length > 0 ? (
projects.map((project) => ( projects.map((project) => (
<Disclosure key={project?.id} defaultOpen={projectId === project?.id}> <Disclosure key={project?.id} defaultOpen={projectId === project?.id}>
<Disclosure.Button {({ open }) => (
className={`w-full flex items-center gap-2 font-medium rounded-md p-2 text-sm ${ <>
sidebarCollapse ? "justify-center" : "" <Disclosure.Button
}`} className={`w-full flex items-center gap-2 font-medium rounded-md p-2 text-sm ${
> sidebarCollapse ? "justify-center" : ""
<span className="bg-gray-700 text-white rounded h-7 w-7 grid place-items-center uppercase"> }`}
{project?.name.charAt(0)} >
</span> <span className="bg-gray-700 text-white rounded h-7 w-7 grid place-items-center uppercase flex-shrink-0">
{!sidebarCollapse && project?.name} {project?.name.charAt(0)}
</Disclosure.Button> </span>
<Transition {!sidebarCollapse && (
enter="transition duration-100 ease-out" <span className="flex items-center justify-between w-full">
enterFrom="transform scale-95 opacity-0" {project?.name}
enterTo="transform scale-100 opacity-100" <ChevronDownIcon
leave="transition duration-75 ease-out" className={`h-4 w-4 duration-300 ${open ? "rotate-180" : ""}`}
leaveFrom="transform scale-100 opacity-100"
leaveTo="transform scale-95 opacity-0"
>
<Disclosure.Panel
className={`${
sidebarCollapse ? "" : "ml-[2.25rem]"
} flex flex-col gap-y-1`}
>
{navigation(project?.id).map((item) => (
<Link key={item.name} href={item.href}>
<a
className={classNames(
item.href === router.asPath
? "bg-gray-200 text-gray-900"
: "text-gray-500 hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:text-gray-900",
"group flex items-center px-2 py-2 text-xs font-medium rounded-md outline-none",
sidebarCollapse ? "justify-center" : ""
)}
>
<item.icon
className={classNames(
item.href === router.asPath
? "text-gray-900"
: "text-gray-500 group-hover:text-gray-900",
"flex-shrink-0 h-4 w-4",
!sidebarCollapse ? "mr-3" : ""
)}
aria-hidden="true"
/> />
{!sidebarCollapse && item.name} </span>
</a> )}
</Link> </Disclosure.Button>
))} <Transition
</Disclosure.Panel> enter="transition duration-100 ease-out"
</Transition> enterFrom="transform scale-95 opacity-0"
enterTo="transform scale-100 opacity-100"
leave="transition duration-75 ease-out"
leaveFrom="transform scale-100 opacity-100"
leaveTo="transform scale-95 opacity-0"
>
<Disclosure.Panel
className={`${
sidebarCollapse ? "" : "ml-[2.25rem]"
} flex flex-col gap-y-1`}
>
{navigation(project?.id).map((item) => (
<Link key={item.name} href={item.href}>
<a
className={classNames(
item.href === router.asPath
? "bg-gray-200 text-gray-900"
: "text-gray-500 hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:text-gray-900",
"group flex items-center px-2 py-2 text-xs font-medium rounded-md outline-none",
sidebarCollapse ? "justify-center" : ""
)}
>
<item.icon
className={classNames(
item.href === router.asPath
? "text-gray-900"
: "text-gray-500 group-hover:text-gray-900",
"flex-shrink-0 h-4 w-4",
!sidebarCollapse ? "mr-3" : ""
)}
aria-hidden="true"
/>
{!sidebarCollapse && item.name}
</a>
</Link>
))}
</Disclosure.Panel>
</Transition>
</>
)}
</Disclosure> </Disclosure>
)) ))
) : ( ) : (
<div className="text-center space-y-3"> <div className="text-center space-y-3">
<h4 className="text-gray-700 text-sm">You don{"'"}t have any project yet</h4> {!sidebarCollapse && (
<h4 className="text-gray-700 text-sm">
You don{"'"}t have any project yet
</h4>
)}
<button <button
type="button" type="button"
className="group flex justify-center items-center gap-2 w-full rounded-md p-2 text-sm bg-theme text-white" className="group flex justify-center items-center gap-2 w-full rounded-md p-2 text-sm bg-theme text-white"
onClick={() => setCreateProjectModal(true)} onClick={() => setCreateProjectModal(true)}
> >
<PlusIcon className="h-5 w-5" /> <PlusIcon className="h-5 w-5" />
Create Project {!sidebarCollapse && "Create Project"}
</button> </button>
</div> </div>
)} )}

View File

@ -25,6 +25,7 @@ import ChangeStateDropdown from "components/project/issues/my-issues/ChangeState
import { PlusIcon, RectangleStackIcon } from "@heroicons/react/24/outline"; import { PlusIcon, RectangleStackIcon } from "@heroicons/react/24/outline";
// types // types
import { IIssue } from "types"; import { IIssue } from "types";
import Link from "next/link";
const MyIssues: NextPage = () => { const MyIssues: NextPage = () => {
const { user } = useUser(); const { user } = useUser();
@ -139,8 +140,10 @@ const MyIssues: NextPage = () => {
"border-t text-sm text-gray-900" "border-t text-sm text-gray-900"
)} )}
> >
<td className="px-3 py-4 text-sm font-medium text-gray-900 max-w-[15rem]"> <td className="px-3 py-4 text-sm font-medium text-gray-900 hover:text-theme max-w-[15rem] duration-300">
{myIssue.name} <Link href={`/projects/${myIssue.project}/issues/${myIssue.id}`}>
<a>{myIssue.name}</a>
</Link>
</td> </td>
<td className="px-3 py-4 max-w-[15rem]">{myIssue.description}</td> <td className="px-3 py-4 max-w-[15rem]">{myIssue.description}</td>
<td className="px-3 py-4"> <td className="px-3 py-4">

View File

@ -136,199 +136,197 @@ const ProjectIssues: NextPage = () => {
isOpen={!!deleteIssue} isOpen={!!deleteIssue}
data={projectIssues?.results.find((issue) => issue.id === deleteIssue)} data={projectIssues?.results.find((issue) => issue.id === deleteIssue)}
/> />
<div className="w-full"> {!projectIssues ? (
{!projectIssues ? ( <div className="h-full w-full flex justify-center items-center">
<div className="h-full w-full flex justify-center items-center"> <Spinner />
<Spinner /> </div>
</div> ) : projectIssues.count > 0 ? (
) : projectIssues.count > 0 ? ( <div className="w-full space-y-5">
<div className="w-full space-y-5"> <Breadcrumbs>
<Breadcrumbs> <BreadcrumbItem title="Projects" link="/projects" />
<BreadcrumbItem title="Projects" link="/projects" /> <BreadcrumbItem title={`${activeProject?.name ?? "Project"} Issues`} />
<BreadcrumbItem title={`${activeProject?.name ?? "Project"} Issues`} /> </Breadcrumbs>
</Breadcrumbs> <div className="flex items-center justify-between w-full">
<div className="flex items-center justify-between w-full"> <h2 className="text-2xl font-medium">Project Issues</h2>
<h2 className="text-2xl font-medium">Project Issues</h2> <div className="flex items-center gap-x-3">
<div className="flex items-center gap-x-3"> <div className="flex items-center gap-x-1">
<div className="flex items-center gap-x-1"> <button
<button type="button"
type="button" className={`h-7 w-7 p-1 grid place-items-center rounded hover:bg-gray-200 duration-300 outline-none ${
className={`h-7 w-7 p-1 grid place-items-center rounded hover:bg-gray-200 duration-300 outline-none ${ issueView === "list" ? "bg-gray-200" : ""
issueView === "list" ? "bg-gray-200" : "" }`}
}`}
onClick={() => {
setIssueView("list");
setGroupByProperty(null);
}}
>
<ListBulletIcon className="h-4 w-4" />
</button>
<button
type="button"
className={`h-7 w-7 p-1 grid place-items-center rounded hover:bg-gray-200 duration-300 outline-none ${
issueView === "kanban" ? "bg-gray-200" : ""
}`}
onClick={() => {
setIssueView("kanban");
setGroupByProperty("state_detail.name");
}}
>
<Squares2X2Icon className="h-4 w-4" />
</button>
</div>
<Menu as="div" className="relative inline-block w-40">
<div className="w-full">
<Menu.Button className="inline-flex justify-between items-center w-full rounded-md shadow-sm p-2 bg-white border border-gray-300 text-xs font-semibold text-gray-700 hover:bg-gray-50 focus:outline-none">
<span className="flex gap-x-1 items-center">
{groupByOptions.find((option) => option.key === groupByProperty)?.name ??
"No Grouping"}
</span>
<div className="flex-grow flex justify-end">
<ChevronDownIcon className="h-4 w-4" aria-hidden="true" />
</div>
</Menu.Button>
</div>
<Transition
as={React.Fragment}
enter="transition ease-out duration-100"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
leave="transition ease-in duration-75"
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items className="origin-top-left absolute left-0 mt-2 w-full rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none z-50">
<div className="p-1">
{groupByOptions.map((option) => (
<Menu.Item key={option.key}>
{({ active }) => (
<button
type="button"
className={`${
active ? "bg-theme text-white" : "text-gray-900"
} group flex w-full items-center rounded-md p-2 text-xs`}
onClick={() => setGroupByProperty(option.key)}
>
{option.name}
</button>
)}
</Menu.Item>
))}
{issueView === "list" ? (
<Menu.Item>
{({ active }) => (
<button
type="button"
className={`hover:bg-theme hover:text-white ${
active ? "bg-theme text-white" : "text-gray-900"
} group flex w-full items-center rounded-md p-2 text-xs`}
onClick={() => setGroupByProperty(null)}
>
No grouping
</button>
)}
</Menu.Item>
) : null}
</div>
</Menu.Items>
</Transition>
</Menu>
<Popover className="relative">
{({ open }) => (
<>
<Popover.Button className="inline-flex justify-between items-center rounded-md shadow-sm p-2 bg-white border border-gray-300 text-xs font-semibold text-gray-700 hover:bg-gray-50 focus:outline-none w-40">
<span>Properties</span>
<ChevronDownIcon className="h-4 w-4" />
</Popover.Button>
<Transition
as={React.Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel className="absolute left-1/2 z-10 mt-1 -translate-x-1/2 transform px-2 sm:px-0 w-full">
<div className="overflow-hidden rounded-lg shadow-lg ring-1 ring-black ring-opacity-5">
<div className="relative grid bg-white p-1">
{Object.keys(properties).map((key) => (
<button
key={key}
className={`text-gray-900 hover:bg-theme hover:text-white flex justify-between w-full items-center rounded-md p-2 text-xs`}
onClick={() => setProperties(key as keyof Properties)}
>
<p className="capitalize">{key.replace("_", " ")}</p>
<span className="self-end">
{properties[key as keyof Properties] ? (
<EyeIcon width="18" height="18" />
) : (
<EyeSlashIcon width="18" height="18" />
)}
</span>
</button>
))}
</div>
</div>
</Popover.Panel>
</Transition>
</>
)}
</Popover>
<HeaderButton
Icon={PlusIcon}
label="Add Issue"
onClick={() => { onClick={() => {
const e = new KeyboardEvent("keydown", { setIssueView("list");
key: "i", setGroupByProperty(null);
ctrlKey: true,
});
document.dispatchEvent(e);
}} }}
/> >
<ListBulletIcon className="h-4 w-4" />
</button>
<button
type="button"
className={`h-7 w-7 p-1 grid place-items-center rounded hover:bg-gray-200 duration-300 outline-none ${
issueView === "kanban" ? "bg-gray-200" : ""
}`}
onClick={() => {
setIssueView("kanban");
setGroupByProperty("state_detail.name");
}}
>
<Squares2X2Icon className="h-4 w-4" />
</button>
</div> </div>
</div> <Menu as="div" className="relative inline-block w-40">
{issueView === "list" ? ( <div className="w-full">
<ListView <Menu.Button className="inline-flex justify-between items-center w-full rounded-md shadow-sm p-2 border border-gray-300 text-xs font-semibold text-gray-700 hover:bg-gray-100 focus:outline-none">
properties={properties} <span className="flex gap-x-1 items-center">
groupedByIssues={groupedByIssues} {groupByOptions.find((option) => option.key === groupByProperty)?.name ??
selectedGroup={groupByProperty} "No Grouping"}
setSelectedIssue={setSelectedIssue} </span>
handleDeleteIssue={setDeleteIssue} <div className="flex-grow flex justify-end">
/> <ChevronDownIcon className="h-4 w-4" aria-hidden="true" />
) : ( </div>
<BoardView </Menu.Button>
properties={properties} </div>
selectedGroup={groupByProperty}
groupedByIssues={groupedByIssues} <Transition
members={members} as={React.Fragment}
/> enter="transition ease-out duration-100"
)} enterFrom="transform opacity-0 scale-95"
</div> enterTo="transform opacity-100 scale-100"
) : ( leave="transition ease-in duration-75"
<div className="h-full w-full grid place-items-center px-4 sm:px-0"> leaveFrom="transform opacity-100 scale-100"
<EmptySpace leaveTo="transform opacity-0 scale-95"
title="You don't have any issue yet." >
description="Issues help you track individual pieces of work. With Issues, keep track of what's going on, who is working on it, and what's done." <Menu.Items className="origin-top-left absolute left-0 mt-2 w-full rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none z-50">
Icon={RectangleStackIcon} <div className="p-1">
> {groupByOptions.map((option) => (
<EmptySpaceItem <Menu.Item key={option.key}>
title="Create a new issue" {({ active }) => (
description={ <button
<span> type="button"
Use <pre className="inline bg-gray-100 px-2 py-1 rounded">Ctrl/Command + I</pre>{" "} className={`${
shortcut to create a new issue active ? "bg-theme text-white" : "text-gray-900"
</span> } group flex w-full items-center rounded-md p-2 text-xs`}
} onClick={() => setGroupByProperty(option.key)}
>
{option.name}
</button>
)}
</Menu.Item>
))}
{issueView === "list" ? (
<Menu.Item>
{({ active }) => (
<button
type="button"
className={`hover:bg-theme hover:text-white ${
active ? "bg-theme text-white" : "text-gray-900"
} group flex w-full items-center rounded-md p-2 text-xs`}
onClick={() => setGroupByProperty(null)}
>
No grouping
</button>
)}
</Menu.Item>
) : null}
</div>
</Menu.Items>
</Transition>
</Menu>
<Popover className="relative">
{({ open }) => (
<>
<Popover.Button className="inline-flex justify-between items-center rounded-md shadow-sm p-2 border border-gray-300 text-xs font-semibold text-gray-700 hover:bg-gray-100 focus:outline-none w-40">
<span>Properties</span>
<ChevronDownIcon className="h-4 w-4" />
</Popover.Button>
<Transition
as={React.Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel className="absolute left-1/2 z-10 mt-1 -translate-x-1/2 transform px-2 sm:px-0 w-full">
<div className="overflow-hidden rounded-lg shadow-lg ring-1 ring-black ring-opacity-5">
<div className="relative grid bg-white p-1">
{Object.keys(properties).map((key) => (
<button
key={key}
className={`text-gray-900 hover:bg-theme hover:text-white flex justify-between w-full items-center rounded-md p-2 text-xs`}
onClick={() => setProperties(key as keyof Properties)}
>
<p className="capitalize">{key.replace("_", " ")}</p>
<span className="self-end">
{properties[key as keyof Properties] ? (
<EyeIcon width="18" height="18" />
) : (
<EyeSlashIcon width="18" height="18" />
)}
</span>
</button>
))}
</div>
</div>
</Popover.Panel>
</Transition>
</>
)}
</Popover>
<HeaderButton
Icon={PlusIcon} Icon={PlusIcon}
action={() => setIsOpen(true)} label="Add Issue"
onClick={() => {
const e = new KeyboardEvent("keydown", {
key: "i",
ctrlKey: true,
});
document.dispatchEvent(e);
}}
/> />
</EmptySpace> </div>
</div> </div>
)} {issueView === "list" ? (
</div> <ListView
properties={properties}
groupedByIssues={groupedByIssues}
selectedGroup={groupByProperty}
setSelectedIssue={setSelectedIssue}
handleDeleteIssue={setDeleteIssue}
/>
) : (
<BoardView
properties={properties}
selectedGroup={groupByProperty}
groupedByIssues={groupedByIssues}
members={members}
/>
)}
</div>
) : (
<div className="h-full w-full grid place-items-center px-4 sm:px-0">
<EmptySpace
title="You don't have any issue yet."
description="Issues help you track individual pieces of work. With Issues, keep track of what's going on, who is working on it, and what's done."
Icon={RectangleStackIcon}
>
<EmptySpaceItem
title="Create a new issue"
description={
<span>
Use <pre className="inline bg-gray-100 px-2 py-1 rounded">Ctrl/Command + I</pre>{" "}
shortcut to create a new issue
</span>
}
Icon={PlusIcon}
action={() => setIsOpen(true)}
/>
</EmptySpace>
</div>
)}
</AdminLayout> </AdminLayout>
); );
}; };

View File

@ -444,6 +444,15 @@ const ProjectSettings: NextPage = () => {
</div> </div>
</div> </div>
</section> </section>
<section className="space-y-5">
<div>
<h3 className="text-lg font-medium leading-6 text-gray-900">Labels</h3>
<p className="mt-1 text-sm text-gray-500">
Manage the labels of this project.
</p>
</div>
<div></div>
</section>
</div> </div>
</form> </form>
</div> </div>

View File

@ -1,4 +1,4 @@
@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@200;300;400;500;600;700;800&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600;700;800&display=swap");
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@ -6,7 +6,7 @@
@layer base { @layer base {
html { html {
font-family: "Lexend", sans-serif; font-family: "Inter", sans-serif;
} }
} }

View File

@ -64,7 +64,7 @@ const CustomListbox: React.FC<Props> = ({
leaveTo="opacity-0" leaveTo="opacity-0"
> >
<Listbox.Options <Listbox.Options
className={`absolute mt-1 bg-white shadow-lg ${ className={`absolute mt-1 bg-white shadow-lg max-h-32 overflow-auto ${
width === "sm" width === "sm"
? "w-32" ? "w-32"
: width === "md" : width === "md"

View File

@ -35,7 +35,7 @@ const Input: React.FC<Props> = ({
onChange && onChange(e); onChange && onChange(e);
}} }}
className={classNames( className={classNames(
"mt-1 block w-full px-3 py-2 text-base focus:outline-none sm:text-sm rounded-md", "mt-1 block w-full px-3 py-2 text-base focus:outline-none sm:text-sm rounded-md bg-transparent",
mode === "primary" ? "border border-gray-300 rounded-md" : "", mode === "primary" ? "border border-gray-300 rounded-md" : "",
mode === "transparent" mode === "transparent"
? "bg-transparent border-none transition-all ring-0 focus:ring-1 focus:ring-indigo-500 rounded" ? "bg-transparent border-none transition-all ring-0 focus:ring-1 focus:ring-indigo-500 rounded"

View File

@ -82,7 +82,7 @@ const SearchListbox: React.FC<Props> = ({
leaveTo="opacity-0" leaveTo="opacity-0"
> >
<Combobox.Options <Combobox.Options
className={`absolute mt-1 bg-white shadow-lg rounded-md py-1 ring-1 ring-black ring-opacity-5 focus:outline-none z-10 ${ className={`absolute mt-1 bg-white shadow-lg rounded-md py-1 ring-1 ring-black ring-opacity-5 focus:outline-none max-h-32 overflow-auto z-10 ${
width === "sm" width === "sm"
? "w-32" ? "w-32"
: width === "md" : width === "md"
@ -109,36 +109,34 @@ const SearchListbox: React.FC<Props> = ({
} ${optionsClassName || ""}`} } ${optionsClassName || ""}`}
> >
<Combobox.Input <Combobox.Input
className="w-full bg-transparent border-b py-2 pl-3 mb-1 focus:outline-none sm:text-sm" className="w-full bg-transparent border-b p-2 mb-1 focus:outline-none sm:text-sm"
onChange={(event) => setQuery(event.target.value)} onChange={(event) => setQuery(event.target.value)}
placeholder="Search" placeholder="Search"
displayValue={(assigned: any) => assigned?.name} displayValue={(assigned: any) => assigned?.name}
/> />
{filteredOptions ? ( <div className="p-1">
filteredOptions.length > 0 ? ( {filteredOptions ? (
filteredOptions.map((option) => ( filteredOptions.length > 0 ? (
<Combobox.Option filteredOptions.map((option) => (
key={option.value} <Combobox.Option
className={({ active }) => key={option.value}
`${ className={({ active }) =>
active ? "text-white bg-theme" : "text-gray-900" `${
} cursor-pointer select-none relative p-2 rounded-md` active ? "text-white bg-theme" : "text-gray-900"
} } cursor-pointer select-none truncate font-medium relative p-2 rounded-md`
value={option.value} }
> value={option.value}
<div className="flex items-center"> >
<span className="ml-3 block truncate font-medium"> {option.element ?? option.display}
{option.element ?? option.display} </Combobox.Option>
</span> ))
</div> ) : (
</Combobox.Option> <p className="text-sm text-gray-500">No {title.toLowerCase()} found</p>
)) )
) : ( ) : (
<p className="text-sm text-gray-500">No {title.toLowerCase()} found</p> <p className="text-sm text-gray-500">Loading...</p>
) )}
) : ( </div>
<p className="text-sm text-gray-500">Loading...</p>
)}
</Combobox.Options> </Combobox.Options>
</Transition> </Transition>
</div> </div>

View File

@ -27,7 +27,7 @@ const Select: React.FC<Props> = ({
value={value} value={value}
{...(register && register(name, validations))} {...(register && register(name, validations))}
disabled={disabled} disabled={disabled}
className="mt-1 block w-full px-3 py-2 text-base border border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md" className="mt-1 block w-full px-3 py-2 text-base border border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md bg-transparent"
> >
{options.map((option, index) => ( {options.map((option, index) => (
<option value={option.value} key={index}> <option value={option.value} key={index}>

View File

@ -54,7 +54,7 @@ const TextArea: React.FC<Props> = ({
setTextareaValue(e.target.value); setTextareaValue(e.target.value);
}} }}
className={classNames( className={classNames(
"w-full outline-none px-3 py-2", "w-full outline-none px-3 py-2 bg-transparent",
mode === "primary" ? "border border-gray-300 rounded-md" : "", mode === "primary" ? "border border-gray-300 rounded-md" : "",
mode === "transparent" mode === "transparent"
? "bg-transparent border-none transition-all ring-0 focus:ring-1 focus:ring-indigo-600 rounded" ? "bg-transparent border-none transition-all ring-0 focus:ring-1 focus:ring-indigo-600 rounded"