2024-01-10 14:39:45 +00:00
|
|
|
import { FC, useMemo } from "react";
|
2024-03-06 13:09:14 +00:00
|
|
|
import { observer } from "mobx-react";
|
2024-01-10 14:39:45 +00:00
|
|
|
import { useRouter } from "next/router";
|
2024-03-19 14:38:35 +00:00
|
|
|
import { TIssue } from "@plane/types";
|
2024-01-10 14:39:45 +00:00
|
|
|
// components
|
2024-03-06 13:09:14 +00:00
|
|
|
import { TOAST_TYPE, setPromiseToast, setToast } from "@plane/ui";
|
2024-03-19 14:38:35 +00:00
|
|
|
import { EmptyState } from "@/components/common";
|
|
|
|
import { IssuePeekOverview } from "@/components/issues";
|
|
|
|
import { ISSUE_UPDATED, ISSUE_DELETED, ISSUE_ARCHIVED } from "@/constants/event-tracker";
|
|
|
|
import { EIssuesStoreType } from "@/constants/issue";
|
|
|
|
import { EUserProjectRoles } from "@/constants/project";
|
|
|
|
import { useApplication, useEventTracker, useIssueDetail, useIssues, useUser } from "@/hooks/store";
|
2024-03-06 13:09:14 +00:00
|
|
|
import emptyIssue from "public/empty-state/issue.svg";
|
2024-01-10 14:39:45 +00:00
|
|
|
import { IssueMainContent } from "./main-content";
|
|
|
|
import { IssueDetailsSidebar } from "./sidebar";
|
|
|
|
// ui
|
|
|
|
// images
|
|
|
|
// hooks
|
|
|
|
// types
|
2024-03-06 08:48:41 +00:00
|
|
|
// ui
|
2024-01-11 12:56:58 +00:00
|
|
|
// constants
|
2024-01-10 14:39:45 +00:00
|
|
|
|
|
|
|
export type TIssueOperations = {
|
2024-01-11 12:56:58 +00:00
|
|
|
fetch: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
|
2024-03-06 08:48:41 +00:00
|
|
|
update: (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) => Promise<void>;
|
2024-01-10 14:39:45 +00:00
|
|
|
remove: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
|
2024-02-28 11:23:26 +00:00
|
|
|
archive?: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
|
|
|
|
restore?: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
|
2024-05-07 08:35:56 +00:00
|
|
|
addCycleToIssue?: (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => Promise<void>;
|
2024-01-24 15:03:54 +00:00
|
|
|
addIssueToCycle?: (workspaceSlug: string, projectId: string, cycleId: string, issueIds: string[]) => Promise<void>;
|
|
|
|
removeIssueFromCycle?: (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => Promise<void>;
|
2024-01-30 09:53:20 +00:00
|
|
|
addModulesToIssue?: (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => Promise<void>;
|
2024-01-24 15:03:54 +00:00
|
|
|
removeIssueFromModule?: (
|
|
|
|
workspaceSlug: string,
|
|
|
|
projectId: string,
|
|
|
|
moduleId: string,
|
|
|
|
issueId: string
|
|
|
|
) => Promise<void>;
|
2024-01-30 09:53:20 +00:00
|
|
|
removeModulesFromIssue?: (
|
|
|
|
workspaceSlug: string,
|
|
|
|
projectId: string,
|
|
|
|
issueId: string,
|
|
|
|
moduleIds: string[]
|
|
|
|
) => Promise<void>;
|
2024-01-10 14:39:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export type TIssueDetailRoot = {
|
|
|
|
workspaceSlug: string;
|
|
|
|
projectId: string;
|
|
|
|
issueId: string;
|
|
|
|
is_archived?: boolean;
|
2024-04-11 15:58:59 +00:00
|
|
|
swrIssueDetails: TIssue | null | undefined;
|
2024-01-10 14:39:45 +00:00
|
|
|
};
|
|
|
|
|
2024-02-12 11:31:24 +00:00
|
|
|
export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
|
2024-04-11 15:58:59 +00:00
|
|
|
const { workspaceSlug, projectId, issueId, swrIssueDetails, is_archived = false } = props;
|
2024-01-10 14:39:45 +00:00
|
|
|
// router
|
|
|
|
const router = useRouter();
|
|
|
|
// hooks
|
|
|
|
const {
|
|
|
|
issue: { getIssueById },
|
2024-01-11 12:56:58 +00:00
|
|
|
fetchIssue,
|
2024-01-10 14:39:45 +00:00
|
|
|
updateIssue,
|
|
|
|
removeIssue,
|
2024-02-28 11:23:26 +00:00
|
|
|
archiveIssue,
|
2024-05-07 08:35:56 +00:00
|
|
|
addCycleToIssue,
|
2024-01-10 14:39:45 +00:00
|
|
|
addIssueToCycle,
|
|
|
|
removeIssueFromCycle,
|
2024-01-30 09:53:20 +00:00
|
|
|
addModulesToIssue,
|
2024-01-10 14:39:45 +00:00
|
|
|
removeIssueFromModule,
|
2024-01-30 09:53:20 +00:00
|
|
|
removeModulesFromIssue,
|
2024-01-10 14:39:45 +00:00
|
|
|
} = useIssueDetail();
|
2024-01-16 07:16:03 +00:00
|
|
|
const {
|
|
|
|
issues: { removeIssue: removeArchivedIssue },
|
|
|
|
} = useIssues(EIssuesStoreType.ARCHIVED);
|
2024-02-05 07:49:07 +00:00
|
|
|
const { captureIssueEvent } = useEventTracker();
|
2024-01-11 12:56:58 +00:00
|
|
|
const {
|
|
|
|
membership: { currentProjectRole },
|
|
|
|
} = useUser();
|
2024-02-12 11:31:24 +00:00
|
|
|
const { theme: themeStore } = useApplication();
|
2024-01-10 14:39:45 +00:00
|
|
|
|
|
|
|
const issueOperations: TIssueOperations = useMemo(
|
|
|
|
() => ({
|
2024-01-11 12:56:58 +00:00
|
|
|
fetch: async (workspaceSlug: string, projectId: string, issueId: string) => {
|
|
|
|
try {
|
|
|
|
await fetchIssue(workspaceSlug, projectId, issueId);
|
|
|
|
} catch (error) {
|
|
|
|
console.error("Error fetching the parent issue");
|
|
|
|
}
|
|
|
|
},
|
2024-03-06 08:48:41 +00:00
|
|
|
update: async (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) => {
|
2024-01-10 14:39:45 +00:00
|
|
|
try {
|
2024-02-22 15:28:34 +00:00
|
|
|
await updateIssue(workspaceSlug, projectId, issueId, data);
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-02-22 15:28:34 +00:00
|
|
|
payload: { ...data, issueId, state: "SUCCESS", element: "Issue detail page" },
|
2024-02-05 07:49:07 +00:00
|
|
|
updates: {
|
|
|
|
changed_property: Object.keys(data).join(","),
|
|
|
|
change_details: Object.values(data).join(","),
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
} catch (error) {
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-02-05 07:49:07 +00:00
|
|
|
payload: { state: "FAILED", element: "Issue detail page" },
|
|
|
|
updates: {
|
|
|
|
changed_property: Object.keys(data).join(","),
|
|
|
|
change_details: Object.values(data).join(","),
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-03-06 08:48:41 +00:00
|
|
|
setToast({
|
2024-05-07 09:33:24 +00:00
|
|
|
title: "Error!",
|
2024-03-06 08:48:41 +00:00
|
|
|
type: TOAST_TYPE.ERROR,
|
2024-01-10 14:39:45 +00:00
|
|
|
message: "Issue update failed",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
remove: async (workspaceSlug: string, projectId: string, issueId: string) => {
|
|
|
|
try {
|
2024-03-06 13:09:14 +00:00
|
|
|
if (is_archived) await removeArchivedIssue(workspaceSlug, projectId, issueId);
|
|
|
|
else await removeIssue(workspaceSlug, projectId, issueId);
|
2024-03-06 08:48:41 +00:00
|
|
|
setToast({
|
2024-05-07 09:33:24 +00:00
|
|
|
title: "Success!",
|
2024-03-06 08:48:41 +00:00
|
|
|
type: TOAST_TYPE.SUCCESS,
|
2024-01-10 14:39:45 +00:00
|
|
|
message: "Issue deleted successfully",
|
|
|
|
});
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_DELETED,
|
2024-02-05 07:49:07 +00:00
|
|
|
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
} catch (error) {
|
2024-03-06 08:48:41 +00:00
|
|
|
setToast({
|
2024-05-07 09:33:24 +00:00
|
|
|
title: "Error!",
|
2024-03-06 08:48:41 +00:00
|
|
|
type: TOAST_TYPE.ERROR,
|
2024-01-10 14:39:45 +00:00
|
|
|
message: "Issue delete failed",
|
|
|
|
});
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_DELETED,
|
2024-02-05 07:49:07 +00:00
|
|
|
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
}
|
|
|
|
},
|
2024-02-28 11:23:26 +00:00
|
|
|
archive: async (workspaceSlug: string, projectId: string, issueId: string) => {
|
|
|
|
try {
|
|
|
|
await archiveIssue(workspaceSlug, projectId, issueId);
|
|
|
|
captureIssueEvent({
|
|
|
|
eventName: ISSUE_ARCHIVED,
|
|
|
|
payload: { id: issueId, state: "SUCCESS", element: "Issue details page" },
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
captureIssueEvent({
|
|
|
|
eventName: ISSUE_ARCHIVED,
|
|
|
|
payload: { id: issueId, state: "FAILED", element: "Issue details page" },
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2024-05-07 08:35:56 +00:00
|
|
|
addCycleToIssue: async (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => {
|
2024-01-10 14:39:45 +00:00
|
|
|
try {
|
2024-05-07 08:35:56 +00:00
|
|
|
await addCycleToIssue(workspaceSlug, projectId, cycleId, issueId);
|
|
|
|
captureIssueEvent({
|
|
|
|
eventName: ISSUE_UPDATED,
|
|
|
|
payload: { issueId, state: "SUCCESS", element: "Issue detail page" },
|
|
|
|
updates: {
|
|
|
|
changed_property: "cycle_id",
|
|
|
|
change_details: cycleId,
|
2024-03-06 08:48:41 +00:00
|
|
|
},
|
2024-05-07 08:35:56 +00:00
|
|
|
path: router.asPath,
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
setToast({
|
|
|
|
type: TOAST_TYPE.ERROR,
|
|
|
|
title: "Error!",
|
|
|
|
message: "Issue could not be added to the cycle. Please try again.",
|
|
|
|
});
|
|
|
|
captureIssueEvent({
|
|
|
|
eventName: ISSUE_UPDATED,
|
|
|
|
payload: { state: "FAILED", element: "Issue detail page" },
|
|
|
|
updates: {
|
|
|
|
changed_property: "cycle_id",
|
|
|
|
change_details: cycleId,
|
2024-03-06 08:48:41 +00:00
|
|
|
},
|
2024-05-07 08:35:56 +00:00
|
|
|
path: router.asPath,
|
2024-01-27 09:50:36 +00:00
|
|
|
});
|
2024-05-07 08:35:56 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
addIssueToCycle: async (workspaceSlug: string, projectId: string, cycleId: string, issueIds: string[]) => {
|
|
|
|
try {
|
|
|
|
await addIssueToCycle(workspaceSlug, projectId, cycleId, issueIds);
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-02-21 11:26:02 +00:00
|
|
|
payload: { ...issueIds, state: "SUCCESS", element: "Issue detail page" },
|
2024-02-05 07:49:07 +00:00
|
|
|
updates: {
|
|
|
|
changed_property: "cycle_id",
|
|
|
|
change_details: cycleId,
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
} catch (error) {
|
2024-05-07 08:35:56 +00:00
|
|
|
setToast({
|
|
|
|
type: TOAST_TYPE.ERROR,
|
|
|
|
title: "Error!",
|
|
|
|
message: "Issue could not be added to the cycle. Please try again.",
|
|
|
|
});
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-02-05 07:49:07 +00:00
|
|
|
payload: { state: "FAILED", element: "Issue detail page" },
|
|
|
|
updates: {
|
|
|
|
changed_property: "cycle_id",
|
|
|
|
change_details: cycleId,
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
removeIssueFromCycle: async (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => {
|
|
|
|
try {
|
2024-03-06 08:48:41 +00:00
|
|
|
const removeFromCyclePromise = removeIssueFromCycle(workspaceSlug, projectId, cycleId, issueId);
|
|
|
|
setPromiseToast(removeFromCyclePromise, {
|
2024-05-07 08:35:56 +00:00
|
|
|
loading: "Removing issue from the cycle...",
|
2024-03-06 08:48:41 +00:00
|
|
|
success: {
|
|
|
|
title: "Success!",
|
2024-05-07 08:35:56 +00:00
|
|
|
message: () => "Issue removed from the cycle successfully.",
|
2024-03-06 08:48:41 +00:00
|
|
|
},
|
|
|
|
error: {
|
|
|
|
title: "Error!",
|
2024-05-07 08:35:56 +00:00
|
|
|
message: () => "Issue could not be removed from the cycle. Please try again.",
|
2024-03-06 08:48:41 +00:00
|
|
|
},
|
2024-01-10 14:39:45 +00:00
|
|
|
});
|
2024-03-06 15:17:38 +00:00
|
|
|
await removeFromCyclePromise;
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-03-06 15:17:38 +00:00
|
|
|
payload: { issueId, state: "SUCCESS", element: "Issue detail page" },
|
2024-02-05 07:49:07 +00:00
|
|
|
updates: {
|
|
|
|
changed_property: "cycle_id",
|
|
|
|
change_details: "",
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
} catch (error) {
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-02-05 07:49:07 +00:00
|
|
|
payload: { state: "FAILED", element: "Issue detail page" },
|
|
|
|
updates: {
|
|
|
|
changed_property: "cycle_id",
|
|
|
|
change_details: "",
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
}
|
|
|
|
},
|
2024-01-30 09:53:20 +00:00
|
|
|
addModulesToIssue: async (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => {
|
2024-01-10 14:39:45 +00:00
|
|
|
try {
|
2024-05-07 08:35:56 +00:00
|
|
|
const response = await addModulesToIssue(workspaceSlug, projectId, issueId, moduleIds);
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-02-05 07:49:07 +00:00
|
|
|
payload: { ...response, state: "SUCCESS", element: "Issue detail page" },
|
|
|
|
updates: {
|
|
|
|
changed_property: "module_id",
|
|
|
|
change_details: moduleIds,
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
} catch (error) {
|
2024-05-07 08:35:56 +00:00
|
|
|
setToast({
|
|
|
|
type: TOAST_TYPE.ERROR,
|
|
|
|
title: "Error!",
|
|
|
|
message: "Issue could not be added to the module. Please try again.",
|
|
|
|
});
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-02-05 07:49:07 +00:00
|
|
|
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
|
|
|
|
updates: {
|
|
|
|
changed_property: "module_id",
|
|
|
|
change_details: moduleIds,
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
removeIssueFromModule: async (workspaceSlug: string, projectId: string, moduleId: string, issueId: string) => {
|
|
|
|
try {
|
2024-03-06 08:48:41 +00:00
|
|
|
const removeFromModulePromise = removeIssueFromModule(workspaceSlug, projectId, moduleId, issueId);
|
|
|
|
setPromiseToast(removeFromModulePromise, {
|
2024-05-07 08:35:56 +00:00
|
|
|
loading: "Removing issue from the module...",
|
2024-03-06 08:48:41 +00:00
|
|
|
success: {
|
|
|
|
title: "Success!",
|
2024-05-07 08:35:56 +00:00
|
|
|
message: () => "Issue removed from the module successfully.",
|
2024-03-06 08:48:41 +00:00
|
|
|
},
|
|
|
|
error: {
|
|
|
|
title: "Error!",
|
2024-05-07 08:35:56 +00:00
|
|
|
message: () => "Issue could not be removed from the module. Please try again.",
|
2024-03-06 08:48:41 +00:00
|
|
|
},
|
2024-01-10 14:39:45 +00:00
|
|
|
});
|
2024-03-06 08:48:41 +00:00
|
|
|
await removeFromModulePromise;
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-02-05 07:49:07 +00:00
|
|
|
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
|
|
|
updates: {
|
|
|
|
changed_property: "module_id",
|
|
|
|
change_details: "",
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
} catch (error) {
|
2024-02-05 07:49:07 +00:00
|
|
|
captureIssueEvent({
|
2024-02-09 10:52:08 +00:00
|
|
|
eventName: ISSUE_UPDATED,
|
2024-02-05 07:49:07 +00:00
|
|
|
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
|
|
|
|
updates: {
|
|
|
|
changed_property: "module_id",
|
|
|
|
change_details: "",
|
|
|
|
},
|
|
|
|
path: router.asPath,
|
|
|
|
});
|
2024-01-10 14:39:45 +00:00
|
|
|
}
|
|
|
|
},
|
2024-01-30 09:53:20 +00:00
|
|
|
removeModulesFromIssue: async (
|
|
|
|
workspaceSlug: string,
|
|
|
|
projectId: string,
|
|
|
|
issueId: string,
|
|
|
|
moduleIds: string[]
|
|
|
|
) => {
|
2024-03-06 08:48:41 +00:00
|
|
|
const removeModulesFromIssuePromise = removeModulesFromIssue(workspaceSlug, projectId, issueId, moduleIds);
|
|
|
|
setPromiseToast(removeModulesFromIssuePromise, {
|
|
|
|
loading: "Removing module from issue...",
|
|
|
|
success: {
|
|
|
|
title: "Success!",
|
|
|
|
message: () => "Module removed from issue successfully",
|
|
|
|
},
|
|
|
|
error: {
|
2024-01-31 10:06:55 +00:00
|
|
|
title: "Error!",
|
2024-03-06 08:48:41 +00:00
|
|
|
message: () => "Module remove from issue failed",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
await removeModulesFromIssuePromise;
|
2024-01-30 09:53:20 +00:00
|
|
|
},
|
2024-01-10 14:39:45 +00:00
|
|
|
}),
|
|
|
|
[
|
2024-01-16 07:16:03 +00:00
|
|
|
is_archived,
|
2024-01-11 12:56:58 +00:00
|
|
|
fetchIssue,
|
2024-01-10 14:39:45 +00:00
|
|
|
updateIssue,
|
|
|
|
removeIssue,
|
2024-02-28 11:23:26 +00:00
|
|
|
archiveIssue,
|
2024-01-16 07:16:03 +00:00
|
|
|
removeArchivedIssue,
|
2024-01-10 14:39:45 +00:00
|
|
|
addIssueToCycle,
|
|
|
|
removeIssueFromCycle,
|
2024-01-30 09:53:20 +00:00
|
|
|
addModulesToIssue,
|
2024-01-10 14:39:45 +00:00
|
|
|
removeIssueFromModule,
|
2024-01-30 09:53:20 +00:00
|
|
|
removeModulesFromIssue,
|
2024-05-07 08:35:56 +00:00
|
|
|
captureIssueEvent,
|
|
|
|
router.asPath,
|
2024-01-10 14:39:45 +00:00
|
|
|
]
|
|
|
|
);
|
|
|
|
|
2024-01-16 07:16:03 +00:00
|
|
|
// issue details
|
2024-01-10 14:39:45 +00:00
|
|
|
const issue = getIssueById(issueId);
|
2024-01-16 07:16:03 +00:00
|
|
|
// checking if issue is editable, based on user role
|
2024-04-10 10:38:31 +00:00
|
|
|
const isEditable = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
2024-01-10 14:39:45 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{!issue ? (
|
|
|
|
<EmptyState
|
|
|
|
image={emptyIssue}
|
|
|
|
title="Issue does not exist"
|
|
|
|
description="The issue you are looking for does not exist, has been archived, or has been deleted."
|
|
|
|
primaryButton={{
|
|
|
|
text: "View other issues",
|
|
|
|
onClick: () => router.push(`/${workspaceSlug}/projects/${projectId}/issues`),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
2024-03-06 13:09:14 +00:00
|
|
|
<div className="flex h-full w-full overflow-hidden">
|
2024-05-01 12:31:30 +00:00
|
|
|
<div className="max-w-2/3 h-full w-full space-y-5 divide-y-2 divide-custom-border-200 overflow-y-auto px-6 py-5">
|
2024-01-10 14:39:45 +00:00
|
|
|
<IssueMainContent
|
|
|
|
workspaceSlug={workspaceSlug}
|
2024-04-11 15:58:59 +00:00
|
|
|
swrIssueDetails={swrIssueDetails}
|
2024-01-10 14:39:45 +00:00
|
|
|
projectId={projectId}
|
|
|
|
issueId={issueId}
|
|
|
|
issueOperations={issueOperations}
|
2024-04-10 10:38:31 +00:00
|
|
|
isEditable={!is_archived && isEditable}
|
2024-04-18 15:06:24 +00:00
|
|
|
isArchived={is_archived}
|
2024-01-10 14:39:45 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2024-02-12 11:39:22 +00:00
|
|
|
<div
|
2024-03-12 13:41:36 +00:00
|
|
|
className="fixed right-0 z-[5] h-full w-full min-w-[300px] overflow-hidden border-l border-custom-border-200 bg-custom-sidebar-background-100 py-5 sm:w-1/2 md:relative md:w-1/3 lg:min-w-80 xl:min-w-96"
|
2024-02-12 11:31:24 +00:00
|
|
|
style={themeStore.issueDetailSidebarCollapsed ? { right: `-${window?.innerWidth || 0}px` } : {}}
|
|
|
|
>
|
2024-01-10 14:39:45 +00:00
|
|
|
<IssueDetailsSidebar
|
|
|
|
workspaceSlug={workspaceSlug}
|
|
|
|
projectId={projectId}
|
|
|
|
issueId={issueId}
|
|
|
|
issueOperations={issueOperations}
|
|
|
|
is_archived={is_archived}
|
2024-04-10 10:38:31 +00:00
|
|
|
isEditable={!is_archived && isEditable}
|
2024-01-10 14:39:45 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
2024-01-16 07:16:03 +00:00
|
|
|
|
|
|
|
{/* peek overview */}
|
|
|
|
<IssuePeekOverview />
|
2024-01-10 14:39:45 +00:00
|
|
|
</>
|
|
|
|
);
|
2024-02-12 11:31:24 +00:00
|
|
|
});
|