mirror of
https://github.com/makeplane/plane.git
synced 2025-12-23 23:29:37 +01:00
[WEB-3856]chore: refactor work item activity (#6923)
* chore: refactor work item activity * chore: added estimate render for notifications
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { FC } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
|
||||
export type TAdditionalActivityRoot = {
|
||||
activityId: string;
|
||||
showIssue?: boolean;
|
||||
ends: "top" | "bottom" | undefined;
|
||||
field: string | undefined;
|
||||
};
|
||||
|
||||
export const AdditionalActivityRoot: FC<TAdditionalActivityRoot> = observer(() => <></>);
|
||||
@@ -4,3 +4,4 @@ export * from "./issue-type-switcher";
|
||||
export * from "./issue-type-activity";
|
||||
export * from "./parent-select-root";
|
||||
export * from "./issue-creator";
|
||||
export * from "./additional-activity-root";
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import { TIssueActivity } from "@plane/types";
|
||||
|
||||
export const renderEstimate = (activity: TIssueActivity, value: string) => value;
|
||||
@@ -1,2 +1 @@
|
||||
export * from "./root";
|
||||
export * from "./helper";
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Triangle } from "lucide-react";
|
||||
// hooks
|
||||
import { useIssueDetail } from "@/hooks/store";
|
||||
// components
|
||||
import { renderEstimate } from "@/plane-web/components/issues/issue-details";
|
||||
import { IssueActivityBlockComponent, IssueLink } from "./";
|
||||
|
||||
type TIssueEstimateActivity = { activityId: string; showIssue?: boolean; ends: "top" | "bottom" | undefined };
|
||||
@@ -27,10 +26,8 @@ export const IssueEstimateActivity: FC<TIssueEstimateActivity> = observer((props
|
||||
ends={ends}
|
||||
>
|
||||
<>
|
||||
{activity.new_value ? `set the estimate to ` : `removed the estimate `}
|
||||
{activity.new_value
|
||||
? renderEstimate(activity, activity.new_value)
|
||||
: renderEstimate(activity, activity?.old_value || "")}
|
||||
{activity.new_value ? `set the estimate point to ` : `removed the estimate point`}
|
||||
{activity.new_value ? activity.new_value : activity?.old_value}
|
||||
{showIssue && (activity.new_value ? ` to ` : ` from `)}
|
||||
{showIssue && <IssueLink activityId={activityId} />}.
|
||||
</>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { getValidKeysFromObject } from "@/helpers/array.helper";
|
||||
// hooks
|
||||
import { useIssueDetail } from "@/hooks/store";
|
||||
// plane web components
|
||||
import { IssueTypeActivity } from "@/plane-web/components/issues/issue-details";
|
||||
import { IssueTypeActivity, AdditionalActivityRoot } from "@/plane-web/components/issues/issue-details";
|
||||
import { useTimeLineRelationOptions } from "@/plane-web/components/relations";
|
||||
// local components
|
||||
import {
|
||||
@@ -61,6 +61,7 @@ export const IssueActivityItem: FC<TIssueActivityItem> = observer((props) => {
|
||||
case "priority":
|
||||
return <IssuePriorityActivity {...componentDefaultProps} showIssue={false} />;
|
||||
case "estimate_point":
|
||||
case "estimate_categories":
|
||||
return <IssueEstimateActivity {...componentDefaultProps} showIssue={false} />;
|
||||
case "parent":
|
||||
return <IssueParentActivity {...componentDefaultProps} showIssue={false} />;
|
||||
@@ -88,6 +89,6 @@ export const IssueActivityItem: FC<TIssueActivityItem> = observer((props) => {
|
||||
case "type":
|
||||
return <IssueTypeActivity {...componentDefaultProps} />;
|
||||
default:
|
||||
return <></>;
|
||||
return <AdditionalActivityRoot {...componentDefaultProps} field={activityField} />;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import { TNotification } from "@plane/types";
|
||||
// components
|
||||
import { LiteTextReadOnlyEditor } from "@/components/editor";
|
||||
// helpers
|
||||
import { renderFormattedDate } from "@/helpers/date-time.helper";
|
||||
import { convertMinutesToHoursMinutesString, renderFormattedDate } from "@/helpers/date-time.helper";
|
||||
import { sanitizeCommentForNotification } from "@/helpers/notification.helper";
|
||||
import { replaceUnderscoreIfSnakeCase, stripAndTruncateHTML } from "@/helpers/string.helper";
|
||||
|
||||
@@ -68,6 +68,10 @@ export const NotificationContent: FC<{
|
||||
if (notificationField === "assignees") return newValue !== "" ? newValue : oldValue;
|
||||
if (notificationField === "labels") return newValue !== "" ? newValue : oldValue;
|
||||
if (notificationField === "parent") return newValue !== "" ? newValue : oldValue;
|
||||
if (notificationField === "estimate_time")
|
||||
return newValue !== ""
|
||||
? convertMinutesToHoursMinutesString(Number(newValue))
|
||||
: convertMinutesToHoursMinutesString(Number(oldValue));
|
||||
return newValue;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { AdditionalActivityRoot } from "ce/components/issues/issue-details/additional-activity-root";
|
||||
@@ -1 +0,0 @@
|
||||
export * from "ce/components/issues/issue-details/issue-properties-activity";
|
||||
Reference in New Issue
Block a user