[WEB-3856]chore: refactor work item activity (#6923)

* chore: refactor work item activity

* chore: added estimate render for notifications
This commit is contained in:
Vamsi Krishna
2025-04-15 16:35:28 +05:30
committed by GitHub
parent a4bca0c39c
commit c401b26dd4
9 changed files with 25 additions and 13 deletions

View File

@@ -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(() => <></>);

View File

@@ -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";

View File

@@ -1,3 +0,0 @@
import { TIssueActivity } from "@plane/types";
export const renderEstimate = (activity: TIssueActivity, value: string) => value;

View File

@@ -1,2 +1 @@
export * from "./root";
export * from "./helper";

View File

@@ -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} />}.
</>

View File

@@ -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} />;
}
});

View File

@@ -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;
};

View File

@@ -0,0 +1 @@
export { AdditionalActivityRoot } from "ce/components/issues/issue-details/additional-activity-root";

View File

@@ -1 +0,0 @@
export * from "ce/components/issues/issue-details/issue-properties-activity";