forked from github/plane
Merge pull request #11 from makeplane/stage-release
promote staging branch to master
This commit is contained in:
commit
0bfb0a136a
@ -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",
|
||||||
|
@ -199,8 +199,9 @@ 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
|
||||||
|
className={`group block border rounded bg-white shadow-sm ${
|
||||||
snapshot.isDragging ? "border-indigo-600 shadow-lg bg-indigo-50" : ""
|
snapshot.isDragging ? "border-indigo-600 shadow-lg bg-indigo-50" : ""
|
||||||
}`}
|
}`}
|
||||||
ref={provided.innerRef}
|
ref={provided.innerRef}
|
||||||
@ -248,13 +249,9 @@ const SingleBoard: React.FC<Props> = ({
|
|||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
{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)}</>
|
||||||
@ -324,7 +321,8 @@ const SingleBoard: React.FC<Props> = ({
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div> */}
|
</div> */}
|
||||||
</div>
|
</a>
|
||||||
|
</Link>
|
||||||
)}
|
)}
|
||||||
</Draggable>
|
</Draggable>
|
||||||
))}
|
))}
|
||||||
|
@ -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) =>
|
||||||
|
138
components/project/issues/PreviewModal/index.tsx
Normal file
138
components/project/issues/PreviewModal/index.tsx
Normal 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;
|
@ -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,15 +421,24 @@ 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}>
|
||||||
|
{({ open }) => (
|
||||||
|
<>
|
||||||
<Disclosure.Button
|
<Disclosure.Button
|
||||||
className={`w-full flex items-center gap-2 font-medium rounded-md p-2 text-sm ${
|
className={`w-full flex items-center gap-2 font-medium rounded-md p-2 text-sm ${
|
||||||
sidebarCollapse ? "justify-center" : ""
|
sidebarCollapse ? "justify-center" : ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<span className="bg-gray-700 text-white rounded h-7 w-7 grid place-items-center uppercase">
|
<span className="bg-gray-700 text-white rounded h-7 w-7 grid place-items-center uppercase flex-shrink-0">
|
||||||
{project?.name.charAt(0)}
|
{project?.name.charAt(0)}
|
||||||
</span>
|
</span>
|
||||||
{!sidebarCollapse && project?.name}
|
{!sidebarCollapse && (
|
||||||
|
<span className="flex items-center justify-between w-full">
|
||||||
|
{project?.name}
|
||||||
|
<ChevronDownIcon
|
||||||
|
className={`h-4 w-4 duration-300 ${open ? "rotate-180" : ""}`}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</Disclosure.Button>
|
</Disclosure.Button>
|
||||||
<Transition
|
<Transition
|
||||||
enter="transition duration-100 ease-out"
|
enter="transition duration-100 ease-out"
|
||||||
@ -482,18 +480,24 @@ const Sidebar: React.FC = () => {
|
|||||||
))}
|
))}
|
||||||
</Disclosure.Panel>
|
</Disclosure.Panel>
|
||||||
</Transition>
|
</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>
|
||||||
)}
|
)}
|
||||||
|
@ -1,30 +1,32 @@
|
|||||||
import React, { useEffect } from "react";
|
import React from "react";
|
||||||
// next
|
// next
|
||||||
import type { NextPage } from "next";
|
import type { NextPage } from "next";
|
||||||
// axios configurations
|
|
||||||
import { setAxiosHeader } from "configuration/axios-configuration";
|
|
||||||
// redirect
|
// redirect
|
||||||
import redirect from "lib/redirect";
|
import redirect from "lib/redirect";
|
||||||
|
|
||||||
const withAuthWrapper = (WrappedComponent: NextPage) => {
|
const withAuth = (WrappedComponent: NextPage) => {
|
||||||
const Wrapper: NextPage<any> = (props) => {
|
const Wrapper: NextPage<any> = (props) => {
|
||||||
useEffect(() => {
|
|
||||||
if (props?.tokenDetails && props?.tokenDetails?.access_token) {
|
|
||||||
setAxiosHeader(props.tokenDetails.access_token);
|
|
||||||
}
|
|
||||||
}, [props]);
|
|
||||||
|
|
||||||
return <WrappedComponent {...props} />;
|
return <WrappedComponent {...props} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
Wrapper.getInitialProps = async (ctx) => {
|
Wrapper.getInitialProps = async (ctx) => {
|
||||||
const componentProps =
|
const isServer = typeof window === "undefined";
|
||||||
WrappedComponent.getInitialProps &&
|
|
||||||
(await WrappedComponent.getInitialProps(ctx));
|
const cookies = isServer ? ctx?.req?.headers.cookie : document.cookie;
|
||||||
return { ...componentProps };
|
|
||||||
|
const token = cookies?.split("accessToken=")?.[1]?.split(";")?.[0];
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
redirect(ctx, "/signin");
|
||||||
|
}
|
||||||
|
|
||||||
|
const pageProps =
|
||||||
|
WrappedComponent.getInitialProps && (await WrappedComponent.getInitialProps(ctx));
|
||||||
|
|
||||||
|
return { ...pageProps };
|
||||||
};
|
};
|
||||||
|
|
||||||
return Wrapper;
|
return Wrapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withAuthWrapper;
|
export default withAuth;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
// next imports
|
// next imports
|
||||||
|
import type { NextPageContext } from "next";
|
||||||
import Router from "next/router";
|
import Router from "next/router";
|
||||||
|
|
||||||
const redirect = (context: any, target: any) => {
|
const redirect = (context: NextPageContext, target: any) => {
|
||||||
if (context.res) {
|
if (context.res) {
|
||||||
// server
|
// server
|
||||||
// 303: "See other"
|
// 303: "See other"
|
||||||
|
@ -5,8 +5,6 @@ import Link from "next/link";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
// swr
|
// swr
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
// headless ui
|
|
||||||
import { Dialog, Transition } from "@headlessui/react";
|
|
||||||
// services
|
// services
|
||||||
import workspaceService from "lib/services/workspace.service";
|
import workspaceService from "lib/services/workspace.service";
|
||||||
import userService from "lib/services/user.service";
|
import userService from "lib/services/user.service";
|
||||||
@ -14,19 +12,16 @@ import userService from "lib/services/user.service";
|
|||||||
import useUser from "lib/hooks/useUser";
|
import useUser from "lib/hooks/useUser";
|
||||||
// constants
|
// constants
|
||||||
import { USER_WORKSPACE_INVITATIONS } from "constants/api-routes";
|
import { USER_WORKSPACE_INVITATIONS } from "constants/api-routes";
|
||||||
// hoc
|
|
||||||
import withAuthWrapper from "lib/hoc/withAuthWrapper";
|
|
||||||
// layouts
|
// layouts
|
||||||
import DefaultLayout from "layouts/DefaultLayout";
|
import DefaultLayout from "layouts/DefaultLayout";
|
||||||
// ui
|
// ui
|
||||||
import { Button, Spinner } from "ui";
|
import { Button, Spinner } from "ui";
|
||||||
// types
|
// types
|
||||||
import type { IWorkspaceInvitation } from "types";
|
import type { IWorkspaceInvitation } from "types";
|
||||||
import { ChartBarIcon, ChevronRightIcon, CubeIcon, PlusIcon } from "@heroicons/react/24/outline";
|
import { CubeIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||||
import { EmptySpace, EmptySpaceItem } from "ui/EmptySpace";
|
import { EmptySpace, EmptySpaceItem } from "ui/EmptySpace";
|
||||||
|
|
||||||
const OnBoard: NextPage = () => {
|
const OnBoard: NextPage = () => {
|
||||||
const [canRedirect, setCanRedirect] = useState(true);
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const { workspaces, mutateWorkspaces, user } = useUser();
|
const { workspaces, mutateWorkspaces, user } = useUser();
|
||||||
@ -63,28 +58,18 @@ const OnBoard: NextPage = () => {
|
|||||||
console.log(res);
|
console.log(res);
|
||||||
await mutate();
|
await mutate();
|
||||||
await mutateWorkspaces();
|
await mutateWorkspaces();
|
||||||
|
router.push("/workspace");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// if (!invitations) return;
|
|
||||||
// else
|
|
||||||
// invitations.forEach((invite) => {
|
|
||||||
// if (invite.accepted)
|
|
||||||
// setInvitationsRespond((prevData) => {
|
|
||||||
// return [...prevData, invite.workspace.id];
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// }, [invitations, router, workspaces]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (workspaces && workspaces.length === 0) {
|
userService.updateUserOnBoard().then((response) => {
|
||||||
setCanRedirect(false);
|
console.log(response);
|
||||||
}
|
});
|
||||||
}, [workspaces]);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DefaultLayout
|
<DefaultLayout
|
||||||
@ -101,7 +86,7 @@ const OnBoard: NextPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="w-full md:w-2/3 lg:w-1/3 p-8 rounded-lg">
|
<div className="w-full md:w-2/3 lg:w-1/3 p-8 rounded-lg">
|
||||||
{invitations ? (
|
{invitations && workspaces ? (
|
||||||
invitations.length > 0 ? (
|
invitations.length > 0 ? (
|
||||||
<div className="mt-3 sm:mt-5">
|
<div className="mt-3 sm:mt-5">
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
@ -139,23 +124,6 @@ const OnBoard: NextPage = () => {
|
|||||||
Accept
|
Accept
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="h-full flex items-center gap-x-1">
|
|
||||||
<input
|
|
||||||
id={`${item.id}`}
|
|
||||||
aria-describedby="workspaces"
|
|
||||||
name={`${item.id}`}
|
|
||||||
checked={invitationsRespond.includes(item.workspace.id)}
|
|
||||||
value={item.workspace.name}
|
|
||||||
onChange={() => {
|
|
||||||
handleInvitation(item, invitationsRespond.includes(item.workspace.id) ? "withdraw" : "accepted");
|
|
||||||
}}
|
|
||||||
type="checkbox"
|
|
||||||
className="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
|
|
||||||
/>
|
|
||||||
<label htmlFor={item.id} className="text-sm">
|
|
||||||
Reject
|
|
||||||
</label>
|
|
||||||
</div> */}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@ -167,27 +135,46 @@ const OnBoard: NextPage = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
) : workspaces && workspaces.length > 0 ? (
|
||||||
|
<div className="mt-3 flex flex-col gap-y-3">
|
||||||
|
<h2 className="text-2xl font-medium mb-4">Your workspaces</h2>
|
||||||
|
{workspaces.map((workspace) => (
|
||||||
|
<div
|
||||||
|
className="flex items-center justify-between border px-4 py-2 rounded mb-2"
|
||||||
|
key={workspace.id}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-x-2">
|
||||||
|
<CubeIcon className="h-5 w-5 text-gray-400" />
|
||||||
|
<Link href={"/workspace"}>
|
||||||
|
<a>{workspace.name}</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-x-2">
|
||||||
|
<p className="text-sm">{workspace.owner.first_name}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<Link href={"/workspace"}>
|
||||||
|
<Button type="button">Go to workspaces</Button>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
invitations.length === 0 &&
|
||||||
|
workspaces.length === 0 && (
|
||||||
<EmptySpace
|
<EmptySpace
|
||||||
title={`${
|
title="You don't have any workspaces yet"
|
||||||
canRedirect
|
|
||||||
? `You haven't been invited to any workspace yet.`
|
|
||||||
: "You don't have any workspaces, Start by creating one."
|
|
||||||
}`}
|
|
||||||
description="Your workspace is where you'll create projects, collaborate on your issues, and organize different streams of work in your Plane account."
|
description="Your workspace is where you'll create projects, collaborate on your issues, and organize different streams of work in your Plane account."
|
||||||
>
|
>
|
||||||
<EmptySpaceItem
|
<EmptySpaceItem
|
||||||
Icon={canRedirect ? CubeIcon : PlusIcon}
|
Icon={PlusIcon}
|
||||||
title={canRedirect ? "Continue to Dashboard" : "Create your Workspace"}
|
title={"Create your Workspace"}
|
||||||
action={() => {
|
action={() => {
|
||||||
userService.updateUserOnBoard().then((response) => {
|
router.push("/create-workspace");
|
||||||
console.log(response);
|
|
||||||
});
|
|
||||||
router.push(canRedirect ? "/" : "/create-workspace");
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</EmptySpace>
|
</EmptySpace>
|
||||||
)
|
)
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<div className="w-full h-full flex justify-center items-center">
|
<div className="w-full h-full flex justify-center items-center">
|
||||||
<Spinner />
|
<Spinner />
|
||||||
@ -199,4 +186,4 @@ const OnBoard: NextPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withAuthWrapper(OnBoard);
|
export default OnBoard;
|
||||||
|
@ -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">
|
||||||
|
@ -136,7 +136,6 @@ 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 />
|
||||||
@ -178,7 +177,7 @@ const ProjectIssues: NextPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<Menu as="div" className="relative inline-block w-40">
|
<Menu as="div" className="relative inline-block w-40">
|
||||||
<div className="w-full">
|
<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">
|
<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">
|
||||||
<span className="flex gap-x-1 items-center">
|
<span className="flex gap-x-1 items-center">
|
||||||
{groupByOptions.find((option) => option.key === groupByProperty)?.name ??
|
{groupByOptions.find((option) => option.key === groupByProperty)?.name ??
|
||||||
"No Grouping"}
|
"No Grouping"}
|
||||||
@ -237,7 +236,7 @@ const ProjectIssues: NextPage = () => {
|
|||||||
<Popover className="relative">
|
<Popover className="relative">
|
||||||
{({ open }) => (
|
{({ 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">
|
<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>
|
<span>Properties</span>
|
||||||
<ChevronDownIcon className="h-4 w-4" />
|
<ChevronDownIcon className="h-4 w-4" />
|
||||||
</Popover.Button>
|
</Popover.Button>
|
||||||
@ -328,7 +327,6 @@ const ProjectIssues: NextPage = () => {
|
|||||||
</EmptySpace>
|
</EmptySpace>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
|
||||||
</AdminLayout>
|
</AdminLayout>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -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>
|
||||||
|
@ -8,8 +8,6 @@ import Image from "next/image";
|
|||||||
import useUser from "lib/hooks/useUser";
|
import useUser from "lib/hooks/useUser";
|
||||||
// services
|
// services
|
||||||
import authenticationService from "lib/services/authentication.service";
|
import authenticationService from "lib/services/authentication.service";
|
||||||
// hoc
|
|
||||||
import withAuthWrapper from "lib/hoc/withAuthWrapper";
|
|
||||||
// layouts
|
// layouts
|
||||||
import DefaultLayout from "layouts/DefaultLayout";
|
import DefaultLayout from "layouts/DefaultLayout";
|
||||||
// social button
|
// social button
|
||||||
@ -180,4 +178,4 @@ const SignIn: NextPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withAuthWrapper(SignIn);
|
export default SignIn;
|
||||||
|
@ -11,8 +11,6 @@ import workspaceService from "lib/services/workspace.service";
|
|||||||
import { WORKSPACE_INVITATION } from "constants/fetch-keys";
|
import { WORKSPACE_INVITATION } from "constants/fetch-keys";
|
||||||
// hooks
|
// hooks
|
||||||
import useUser from "lib/hooks/useUser";
|
import useUser from "lib/hooks/useUser";
|
||||||
// hoc
|
|
||||||
import withAuthWrapper from "lib/hoc/withAuthWrapper";
|
|
||||||
// layouts
|
// layouts
|
||||||
import DefaultLayout from "layouts/DefaultLayout";
|
import DefaultLayout from "layouts/DefaultLayout";
|
||||||
// ui
|
// ui
|
||||||
@ -149,4 +147,4 @@ const WorkspaceInvitation: NextPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withAuthWrapper(WorkspaceInvitation);
|
export default WorkspaceInvitation;
|
||||||
|
@ -9,6 +9,8 @@ import AdminLayout from "layouts/AdminLayout";
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
// hooks
|
// hooks
|
||||||
import useUser from "lib/hooks/useUser";
|
import useUser from "lib/hooks/useUser";
|
||||||
|
// hoc
|
||||||
|
import withAuthWrapper from "lib/hoc/withAuthWrapper";
|
||||||
// fetch keys
|
// fetch keys
|
||||||
import { USER_ISSUE } from "constants/fetch-keys";
|
import { USER_ISSUE } from "constants/fetch-keys";
|
||||||
// services
|
// services
|
||||||
@ -167,4 +169,4 @@ const Workspace: NextPage = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Workspace;
|
export default withAuthWrapper(Workspace);
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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"
|
||||||
|
@ -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"
|
||||||
|
@ -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,11 +109,12 @@ 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}
|
||||||
/>
|
/>
|
||||||
|
<div className="p-1">
|
||||||
{filteredOptions ? (
|
{filteredOptions ? (
|
||||||
filteredOptions.length > 0 ? (
|
filteredOptions.length > 0 ? (
|
||||||
filteredOptions.map((option) => (
|
filteredOptions.map((option) => (
|
||||||
@ -122,15 +123,11 @@ const SearchListbox: React.FC<Props> = ({
|
|||||||
className={({ active }) =>
|
className={({ active }) =>
|
||||||
`${
|
`${
|
||||||
active ? "text-white bg-theme" : "text-gray-900"
|
active ? "text-white bg-theme" : "text-gray-900"
|
||||||
} cursor-pointer select-none relative p-2 rounded-md`
|
} 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}
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</Combobox.Option>
|
</Combobox.Option>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
@ -139,6 +136,7 @@ const SearchListbox: React.FC<Props> = ({
|
|||||||
) : (
|
) : (
|
||||||
<p className="text-sm text-gray-500">Loading...</p>
|
<p className="text-sm text-gray-500">Loading...</p>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
</Combobox.Options>
|
</Combobox.Options>
|
||||||
</Transition>
|
</Transition>
|
||||||
</div>
|
</div>
|
||||||
|
@ -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}>
|
||||||
|
@ -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"
|
||||||
|
Loading…
Reference in New Issue
Block a user