/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import { LinkIcon } from "lucide-react"; // plane imports import { useTranslation } from "@plane/i18n"; import { StatePropertyIcon, StateGroupIcon, PriorityPropertyIcon, DueDatePropertyIcon, PriorityIcon, } from "@plane/propel/icons"; import { TOAST_TYPE, setToast } from "@plane/propel/toast"; import { cn, getIssuePriorityFilters } from "@plane/utils"; // helpers import { renderFormattedDate } from "@/helpers/date-time.helper"; import { shouldHighlightIssueDueDate } from "@/helpers/issue.helper"; import { copyTextToClipboard, addSpaceIfCamelCase } from "@/helpers/string.helper"; // hooks import { usePublish } from "@/hooks/store/publish"; import { useStates } from "@/hooks/store/use-state"; // types import type { IIssue, IPeekMode } from "@/types/issue"; type Props = { issueDetails: IIssue; mode?: IPeekMode; }; export const PeekOverviewIssueProperties = observer(function PeekOverviewIssueProperties({ issueDetails, mode, }: Props) { // hooks const { t } = useTranslation(); const { getStateById } = useStates(); const state = getStateById(issueDetails?.state_id ?? undefined); const { anchor } = useParams(); const { project_details } = usePublish(anchor?.toString()); const priority = issueDetails.priority ? getIssuePriorityFilters(issueDetails.priority) : null; const handleCopyLink = () => { const urlToCopy = window.location.href; copyTextToClipboard(urlToCopy).then(() => { setToast({ type: TOAST_TYPE.INFO, title: "Link copied!", message: "Work item link copied to clipboard", }); }); }; return (
{mode === "full" && (
{project_details?.identifier}-{issueDetails.sequence_id}
)}
State
{addSpaceIfCamelCase(state?.name ?? "")}
Priority
{priority && } {t(priority?.titleTranslationKey || "common.none")}
Due date
{issueDetails.target_date ? (
{renderFormattedDate(issueDetails.target_date)}
) : ( Empty )}
); });