Compare commits

...

3 Commits

Author SHA1 Message Date
gakshita c11d17f23b fix: refactor 2025-07-31 13:20:04 +05:30
gakshita 53d61c1a1d Merge branch 'preview' of https://github.com/makeplane/plane into fix-activity-refactor 2025-07-30 18:48:21 +05:30
gakshita 21b820487f fix: activity additional property handling 2025-06-25 15:47:10 +05:30
10 changed files with 51 additions and 19 deletions
@@ -5,3 +5,4 @@ export * from "./issue-type-activity";
export * from "./parent-select-root";
export * from "./issue-creator";
export * from "./additional-activity-root";
export * from "./page";
@@ -0,0 +1,8 @@
"use client";
import { FC } from "react";
import { observer } from "mobx-react";
export type TIssuePageActivity = { activityId: string; showIssue?: boolean; ends?: "top" | "bottom" | undefined };
export const IssuePageActivity: FC<TIssuePageActivity> = observer(() => <></>);
@@ -1,2 +1,3 @@
export * from "./notification-card/root";
export * from "./list-root";
export * from "./notification-card/content";
@@ -0,0 +1,19 @@
import { replaceUnderscoreIfSnakeCase } from "@plane/utils";
export const renderAdditionalAction = (notificationField: string, verb: string | undefined) => {
const baseAction = !["comment", "archived_at"].includes(notificationField) ? verb : "";
return `${baseAction} ${replaceUnderscoreIfSnakeCase(notificationField)}`;
};
export const renderAdditionalValue = (
notificationField: string | undefined,
newValue: string | undefined,
oldValue: string | undefined
) => newValue;
export const shouldShowConnector = (notificationField: string | undefined) =>
!["comment", "archived_at", "None", "assignees", "labels", "start_date", "target_date", "parent"].includes(
notificationField || ""
);
export const shouldRender = (notificationField: string | undefined, verb: string | undefined) => verb !== "deleted";
@@ -5,7 +5,11 @@ import { getValidKeysFromObject } from "@plane/utils";
// hooks
import { useIssueDetail } from "@/hooks/store";
// plane web components
import { IssueTypeActivity, AdditionalActivityRoot } from "@/plane-web/components/issues/issue-details";
import {
IssueTypeActivity,
AdditionalActivityRoot,
IssuePageActivity,
} from "@/plane-web/components/issues/issue-details";
import { useTimeLineRelationOptions } from "@/plane-web/components/relations";
// local components
import {
@@ -89,6 +93,8 @@ export const IssueActivityItem: FC<TIssueActivityItem> = observer((props) => {
return <IssueInboxActivity {...componentDefaultProps} />;
case "type":
return <IssueTypeActivity {...componentDefaultProps} />;
case "page":
return <IssuePageActivity {...componentDefaultProps} />;
default:
return <AdditionalActivityRoot {...componentDefaultProps} field={activityField} />;
}
@@ -1,4 +1,5 @@
import { FC } from "react";
import { TNotification } from "@plane/types";
import {
convertMinutesToHoursMinutesString,
@@ -9,6 +10,12 @@ import {
} from "@plane/utils";
// components
import { LiteTextEditor } from "@/components/editor/lite-text";
import {
renderAdditionalAction,
renderAdditionalValue,
shouldShowConnector,
shouldRender,
} from "@/plane-web/components/workspace-notifications";
export const NotificationContent: FC<{
notification: TNotification;
@@ -57,8 +64,7 @@ export const NotificationContent: FC<{
}
if (notificationField === "None") return null;
const baseAction = !["comment", "archived_at"].includes(notificationField) ? verb : "";
return `${baseAction} ${replaceUnderscoreIfSnakeCase(notificationField)}`;
return renderAdditionalAction(notificationField, verb);
};
const renderValue = () => {
@@ -75,27 +81,16 @@ export const NotificationContent: FC<{
return newValue !== ""
? convertMinutesToHoursMinutesString(Number(newValue))
: convertMinutesToHoursMinutesString(Number(oldValue));
return newValue;
return renderAdditionalValue(notificationField, newValue, oldValue);
};
const shouldShowConnector = ![
"comment",
"archived_at",
"None",
"assignees",
"labels",
"start_date",
"target_date",
"parent",
].includes(notificationField || "");
return (
<>
{renderTriggerName()}
<span className="text-custom-text-300">{renderAction()} </span>
{verb !== "deleted" && (
{shouldRender(notificationField, verb) && (
<>
{shouldShowConnector && <span className="text-custom-text-300">to </span>}
{shouldShowConnector(notificationField) && <span className="text-custom-text-300">to </span>}
<span className="text-custom-text-100 font-medium">{renderValue()}</span>
{notificationField === "comment" && renderCommentBox && (
<div className="scale-75 origin-left">
@@ -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 "./page";
@@ -0,0 +1 @@
export * from "ce/components/issues/issue-details/page";
+1 -1
View File
@@ -27,4 +27,4 @@ export type TProjectBaseActivity<K extends string = string, V extends string = s
project: string;
};
export type TBaseActivityVerbs = "created" | "updated" | "deleted";
export type TBaseActivityVerbs = "created" | "updated" | "deleted" | "added";
@@ -28,7 +28,7 @@ export type TNotificationData = {
actor: string | undefined;
field: string | undefined;
issue_comment: string | undefined;
verb: "created" | "updated" | "deleted";
verb: "created" | "updated" | "deleted" | "added";
new_value: string | undefined;
old_value: string | undefined;
};