chore: add issue activity/ comments to peek-overview.

* imporve `showAccessIdentifier` logic.
This commit is contained in:
Prateek Shourya 2024-01-22 16:38:26 +05:30
parent b8b90032c9
commit b03aaa7e4b
3 changed files with 18 additions and 34 deletions

View File

@ -2,7 +2,7 @@ import { FC, useMemo, useState } from "react";
import { observer } from "mobx-react-lite";
import { History, LucideIcon, MessageSquare, Network } from "lucide-react";
// hooks
import { useIssueDetail } from "hooks/store";
import { useIssueDetail, useProject } from "hooks/store";
import useToast from "hooks/use-toast";
// components
import { IssueActivityCommentRoot, IssueActivityRoot, IssueCommentRoot, IssueCommentCreate } from "./";
@ -14,7 +14,6 @@ type TIssueActivity = {
projectId: string;
issueId: string;
disabled: boolean;
showAccessSpecifier?: boolean;
};
type TActivityTabs = "all" | "activity" | "comments";
@ -44,10 +43,11 @@ export type TActivityOperations = {
};
export const IssueActivity: FC<TIssueActivity> = observer((props) => {
const { workspaceSlug, projectId, issueId, disabled, showAccessSpecifier } = props;
const { workspaceSlug, projectId, issueId, disabled } = props;
// hooks
const { createComment, updateComment, removeComment } = useIssueDetail();
const { setToastAlert } = useToast();
const { getProjectById } = useProject();
// state
const [activityTab, setActivityTab] = useState<TActivityTabs>("all");
@ -108,6 +108,9 @@ export const IssueActivity: FC<TIssueActivity> = observer((props) => {
[workspaceSlug, projectId, issueId, createComment, updateComment, removeComment, setToastAlert]
);
const project = getProjectById(projectId);
if (!project) return <></>;
return (
<div className="space-y-3 pt-3">
{/* header */}
@ -142,14 +145,14 @@ export const IssueActivity: FC<TIssueActivity> = observer((props) => {
workspaceSlug={workspaceSlug}
issueId={issueId}
activityOperations={activityOperations}
showAccessSpecifier={showAccessSpecifier}
showAccessSpecifier={project.is_deployed}
/>
{!disabled && (
<IssueCommentCreate
workspaceSlug={workspaceSlug}
activityOperations={activityOperations}
disabled={disabled}
showAccessSpecifier={showAccessSpecifier}
showAccessSpecifier={project.is_deployed}
/>
)}
</div>
@ -161,14 +164,14 @@ export const IssueActivity: FC<TIssueActivity> = observer((props) => {
workspaceSlug={workspaceSlug}
issueId={issueId}
activityOperations={activityOperations}
showAccessSpecifier={showAccessSpecifier}
showAccessSpecifier={project.is_deployed}
/>
{!disabled && (
<IssueCommentCreate
workspaceSlug={workspaceSlug}
activityOperations={activityOperations}
disabled={disabled}
showAccessSpecifier={showAccessSpecifier}
showAccessSpecifier={project.is_deployed}
/>
)}
</div>

View File

@ -1,7 +1,7 @@
import { useState } from "react";
import { observer } from "mobx-react-lite";
// hooks
import { useIssueDetail, useProject, useProjectState, useUser } from "hooks/store";
import { useIssueDetail, useProjectState, useUser } from "hooks/store";
// components
import { IssueDescriptionForm, IssueAttachmentRoot, IssueUpdateStatus } from "components/issues";
import { IssueParentDetail } from "./parent";
@ -32,14 +32,10 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
const {
issue: { getIssueById },
} = useIssueDetail();
const { getProjectById } = useProject();
const issue = getIssueById(issueId);
if (!issue) return <></>;
const project = getProjectById(projectId);
if (!project) return <></>;
const currentIssueState = projectStates?.find((s) => s.id === issue.state_id);
return (
@ -109,7 +105,6 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
projectId={projectId}
issueId={issueId}
disabled={!is_editable}
showAccessSpecifier={project.is_deployed}
/>
</>
);

View File

@ -12,13 +12,13 @@ import useToast from "hooks/use-toast";
import {
DeleteArchivedIssueModal,
DeleteIssueModal,
IssueActivity,
IssueSubscription,
IssueUpdateStatus,
PeekOverviewIssueDetails,
PeekOverviewProperties,
TIssueOperations,
} from "components/issues";
import { IssueActivity } from "../issue-detail/issue-activity";
// ui
import { CenterPanelIcon, CustomSelect, FullScreenPanelIcon, SidePanelIcon, Spinner } from "@plane/ui";
// helpers
@ -237,19 +237,12 @@ export const IssueView: FC<IIssueView> = observer((props) => {
disabled={disabled}
/>
{/* <IssueActivity
<IssueActivity
workspaceSlug={workspaceSlug}
projectId={projectId}
issueId={issueId}
user={currentUser}
issueActivity={issueActivity}
issueCommentCreate={issueCommentCreate}
issueCommentUpdate={issueCommentUpdate}
issueCommentRemove={issueCommentRemove}
issueCommentReactionCreate={issueCommentReactionCreate}
issueCommentReactionRemove={issueCommentReactionRemove}
showCommentAccessSpecifier={showCommentAccessSpecifier}
/> */}
disabled={disabled}
/>
</div>
) : (
<div className={`flex h-full w-full overflow-auto ${is_archived ? "opacity-60" : ""}`}>
@ -266,19 +259,12 @@ export const IssueView: FC<IIssueView> = observer((props) => {
setIsSubmitting={(value) => setIsSubmitting(value)}
/>
{/* <IssueActivity
<IssueActivity
workspaceSlug={workspaceSlug}
projectId={projectId}
issueId={issueId}
user={currentUser}
issueActivity={issueActivity}
issueCommentCreate={issueCommentCreate}
issueCommentUpdate={issueCommentUpdate}
issueCommentRemove={issueCommentRemove}
issueCommentReactionCreate={issueCommentReactionCreate}
issueCommentReactionRemove={issueCommentReactionRemove}
showCommentAccessSpecifier={showCommentAccessSpecifier}
/> */}
disabled={disabled}
/>
</div>
</div>
<div