ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: web-доступ к внешним контурам и исправление модалки запроса
This commit is contained in:
@@ -9,10 +9,11 @@ import { useEffect, useMemo, useRef } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { EditorRefApi } from "@plane/editor";
|
||||
import { useTranslation } from "@plane/i18n";
|
||||
import { Badge } from "@plane/propel/badge";
|
||||
import { TOAST_TYPE, setToast } from "@plane/propel/toast";
|
||||
import type { TExternalContourRequest, TIssue, TNameDescriptionLoader } from "@plane/types";
|
||||
import { EFileAssetType } from "@plane/types";
|
||||
import { getTextContent } from "@plane/utils";
|
||||
import { getTextContent, renderFormattedDate } from "@plane/utils";
|
||||
import { DescriptionVersionsRoot } from "@/components/core/description-versions";
|
||||
import { DescriptionInput } from "@/components/editor/rich-text/description-input";
|
||||
import { DescriptionInputLoader } from "@/components/editor/rich-text/description-input/loader";
|
||||
@@ -38,13 +39,14 @@ type Props = {
|
||||
workspaceSlug: string;
|
||||
sourceProjectId: string;
|
||||
contourRequest: TExternalContourRequest;
|
||||
hasDirectTargetAccess: boolean;
|
||||
isEditable: boolean;
|
||||
isSubmitting: TNameDescriptionLoader;
|
||||
setIsSubmitting: Dispatch<SetStateAction<TNameDescriptionLoader>>;
|
||||
};
|
||||
|
||||
export const ExternalContoursIssueMainContent = observer(function ExternalContoursIssueMainContent(props: Props) {
|
||||
const { workspaceSlug, sourceProjectId, contourRequest, isEditable, isSubmitting, setIsSubmitting } = props;
|
||||
const { workspaceSlug, sourceProjectId, contourRequest, hasDirectTargetAccess, isEditable, isSubmitting, setIsSubmitting } = props;
|
||||
const { t } = useTranslation();
|
||||
const editorRef = useRef<EditorRefApi>(null);
|
||||
const { data: currentUser } = useUser();
|
||||
@@ -100,6 +102,73 @@ export const ExternalContoursIssueMainContent = observer(function ExternalContou
|
||||
|
||||
if (!issue || !issue.project_id || !issue.id) return <></>;
|
||||
|
||||
if (!hasDirectTargetAccess) {
|
||||
return (
|
||||
<>
|
||||
<div className="space-y-4 pb-4">
|
||||
<h1 className="text-xl font-semibold text-primary">{issue.name}</h1>
|
||||
<div
|
||||
className="prose prose-invert max-w-none text-sm text-secondary [&_p]:mb-3"
|
||||
dangerouslySetInnerHTML={{ __html: issue.description_html || "<p></p>" }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="py-4">
|
||||
<ExternalContoursRequestTraceability contourRequest={contourRequest} />
|
||||
</div>
|
||||
|
||||
<div className="py-4">
|
||||
<div className="mb-2 text-body-sm-medium">{t("external_contours_page.properties.section_title")}</div>
|
||||
<div className="flex flex-col gap-3 text-13 text-secondary">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-tertiary">{t("external_contours_page.properties.target_contour")}</span>
|
||||
<Badge variant="neutral">{issue.project_detail?.name || t("common.none")}</Badge>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-tertiary">{t("assignees")}</span>
|
||||
{issue.assignee_details?.length ? (
|
||||
issue.assignee_details.map((assignee) => (
|
||||
<Badge key={assignee.id} variant="neutral">
|
||||
{assignee.display_name}
|
||||
</Badge>
|
||||
))
|
||||
) : (
|
||||
<span>{t("external_contours_page.list.unassigned")}</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-tertiary">{t("priority")}</span>
|
||||
<Badge variant="neutral">{issue.priority || t("none")}</Badge>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-tertiary">{t("due_date")}</span>
|
||||
<span>{issue.target_date ? renderFormattedDate(issue.target_date) : t("common.none")}</span>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-tertiary">{t("labels")}</span>
|
||||
{issue.label_details?.length ? (
|
||||
issue.label_details.map((label) => (
|
||||
<div key={label.id} className="flex items-center gap-1 rounded-sm border border-strong px-2 py-1 text-11">
|
||||
<span className="h-2 w-2 rounded-full" style={{ backgroundColor: label.color }} />
|
||||
<span>{label.name}</span>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<span>{t("common.none")}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="py-4 text-13 text-secondary">{t("external_contours_page.readonly_source_view")}</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="space-y-4 pb-4">
|
||||
|
||||
Reference in New Issue
Block a user