From b5d4f1053f5c1707f275bbe3520a089bd2bcaa65 Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 5 Nov 2024 11:55:42 +0530 Subject: [PATCH 1/5] fix: added workspaceslug in renderChildren of project settings --- web/ce/constants/project/settings/features.tsx | 3 ++- web/core/components/project/settings/features-list.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/web/ce/constants/project/settings/features.tsx b/web/ce/constants/project/settings/features.tsx index b9b39700d68..b3601e27b15 100644 --- a/web/ce/constants/project/settings/features.tsx +++ b/web/ce/constants/project/settings/features.tsx @@ -13,7 +13,8 @@ export type TProperties = { renderChildren?: ( currentProjectDetails: IProject, isAdmin: boolean, - handleSubmit: (featureKey: string, featureProperty: string) => Promise + handleSubmit: (featureKey: string, featureProperty: string) => Promise, + workspaceSlug: string ) => ReactNode; }; export type TFeatureList = { diff --git a/web/core/components/project/settings/features-list.tsx b/web/core/components/project/settings/features-list.tsx index f1f17f2d598..7bd0a15e6d0 100644 --- a/web/core/components/project/settings/features-list.tsx +++ b/web/core/components/project/settings/features-list.tsx @@ -102,7 +102,7 @@ export const ProjectFeaturesList: FC = observer((props) => {
{currentProjectDetails?.[featureItem.property as keyof IProject] && featureItem.renderChildren && - featureItem.renderChildren(currentProjectDetails, isAdmin, handleSubmit)} + featureItem.renderChildren(currentProjectDetails, isAdmin, handleSubmit, workspaceSlug)}
); From 66d3b302913a970003e85bc08f3922a72254fe90 Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 5 Nov 2024 12:16:27 +0530 Subject: [PATCH 2/5] fix: updated apis --- web/core/services/inbox/inbox-issue.service.ts | 8 +++----- web/core/store/inbox/project-inbox.store.ts | 15 +++++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/web/core/services/inbox/inbox-issue.service.ts b/web/core/services/inbox/inbox-issue.service.ts index 61aaeb84906..b1bf74999fa 100644 --- a/web/core/services/inbox/inbox-issue.service.ts +++ b/web/core/services/inbox/inbox-issue.service.ts @@ -77,17 +77,15 @@ export class InboxIssueService extends APIService { } async retrievePublishForm(workspaceSlug: string, projectId: string): Promise { - return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/publish-intake/`) + return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/intake-settings/`) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; }); } - async updatePublishForm(workspaceSlug: string, projectId: string, is_disabled: boolean): Promise { - return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/publish-intake/`, { - is_disabled, - }) + async updatePublishForm(workspaceSlug: string, projectId: string, data: Partial): Promise { + return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/intake-settings/`, data) .then((response) => response?.data) .catch((error) => { throw error?.response?.data; diff --git a/web/core/store/inbox/project-inbox.store.ts b/web/core/store/inbox/project-inbox.store.ts index f6953debf82..9960faa1548 100644 --- a/web/core/store/inbox/project-inbox.store.ts +++ b/web/core/store/inbox/project-inbox.store.ts @@ -71,7 +71,7 @@ export interface IProjectInboxStore { fetchInboxPaginationIssues: (workspaceSlug: string, projectId: string) => Promise; fetchInboxIssueById: (workspaceSlug: string, projectId: string, inboxIssueId: string) => Promise; fetchIntakeForms: (workspaceSlug: string, projectId: string) => Promise; - toggleIntakeForms: (workspaceSlug: string, projectId: string, isDisabled: boolean) => Promise; + toggleIntakeForms: (workspaceSlug: string, projectId: string, data: Partial) => Promise; regenerateIntakeForms: (workspaceSlug: string, projectId: string) => Promise; createInboxIssue: ( workspaceSlug: string, @@ -329,20 +329,23 @@ export class ProjectInboxStore implements IProjectInboxStore { } }; - toggleIntakeForms = async (workspaceSlug: string, projectId: string, isDisabled: boolean) => { + toggleIntakeForms = async (workspaceSlug: string, projectId: string, data: Partial) => { + const initialData = this.intakeForms[projectId]; try { runInAction(() => { - set(this.intakeForms, projectId, { ...this.intakeForms[projectId], is_disabled: isDisabled }); + set(this.intakeForms, projectId, { ...this.intakeForms[projectId], ...data }); + }); + const result = await this.inboxIssueService.updatePublishForm(workspaceSlug, projectId, data); + runInAction(() => { + set(this.intakeForms, projectId, { ...this.intakeForms[projectId], anchor: result?.anchor }); }); - await this.inboxIssueService.updatePublishForm(workspaceSlug, projectId, isDisabled); } catch { console.error("Error fetching the publish forms"); runInAction(() => { - set(this.intakeForms, projectId, { ...this.intakeForms[projectId], is_disabled: !isDisabled }); + set(this.intakeForms, projectId, initialData); }); } }; - regenerateIntakeForms = async (workspaceSlug: string, projectId: string) => { try { const form = await this.inboxIssueService.regeneratePublishForm(workspaceSlug, projectId); From 0bdd499b87b4ed74d9b7914d90ad12819010b8a6 Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 5 Nov 2024 12:16:59 +0530 Subject: [PATCH 3/5] fix: types --- packages/types/src/inbox.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/types/src/inbox.d.ts b/packages/types/src/inbox.d.ts index bb60b35a21e..5ae6c160e80 100644 --- a/packages/types/src/inbox.d.ts +++ b/packages/types/src/inbox.d.ts @@ -100,7 +100,8 @@ export type TInboxIssueWithPagination = TInboxIssuePaginationInfo & { export type TInboxForm = { anchor: string; id: string; - is_disabled: boolean; + is_in_app_enabled: boolean; + is_form_enabled: boolean; }; export type TInboxIssueForm = { From 8ee91714f00f9e2aad7b7e9f87b897c696dc28d4 Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 5 Nov 2024 14:52:20 +0530 Subject: [PATCH 4/5] fix: added editor --- .../components/editor/rich-text-editor.tsx | 41 +++++++++++++++++++ space/core/store/issue-detail.store.ts | 19 +++++++++ space/core/types/intake.d.ts | 6 +++ 3 files changed, 66 insertions(+) create mode 100644 space/core/components/editor/rich-text-editor.tsx create mode 100644 space/core/types/intake.d.ts diff --git a/space/core/components/editor/rich-text-editor.tsx b/space/core/components/editor/rich-text-editor.tsx new file mode 100644 index 00000000000..af4cf971368 --- /dev/null +++ b/space/core/components/editor/rich-text-editor.tsx @@ -0,0 +1,41 @@ +import React, { forwardRef } from "react"; +// editor +import { EditorRefApi, IMentionHighlight, IRichTextEditor, RichTextEditorWithRef } from "@plane/editor"; +// types +// helpers +import { cn } from "@/helpers/common.helper"; +import { getEditorFileHandlers } from "@/helpers/editor.helper"; + +interface RichTextEditorWrapperProps extends Omit { + uploadFile: (file: File) => Promise; +} + +export const RichTextEditor = forwardRef((props, ref) => { + const { containerClassName, uploadFile, ...rest } = props; + // store hooks + + // use-mention + + // file size + + return ( + { + throw new Error("Function not implemented."); + }, + suggestions: undefined, + }} + ref={ref} + fileHandler={getEditorFileHandlers({ + uploadFile, + workspaceId: "", + anchor: "", + })} + {...rest} + containerClassName={cn("relative pl-3 pb-3", containerClassName)} + /> + ); +}); + +RichTextEditor.displayName = "RichTextEditor"; diff --git a/space/core/store/issue-detail.store.ts b/space/core/store/issue-detail.store.ts index ee8a3031ed0..31058f790f7 100644 --- a/space/core/store/issue-detail.store.ts +++ b/space/core/store/issue-detail.store.ts @@ -36,6 +36,7 @@ export interface IIssueDetailStore { updateIssueComment: (anchor: string, issueID: string, commentID: string, data: any) => Promise; deleteIssueComment: (anchor: string, issueID: string, commentID: string) => void; uploadCommentAsset: (file: File, anchor: string, commentID?: string) => Promise; + uploadIssueAsset: (file: File, anchor: string, commentID?: string) => Promise; addCommentReaction: (anchor: string, issueID: string, commentID: string, reactionHex: string) => void; removeCommentReaction: (anchor: string, issueID: string, commentID: string, reactionHex: string) => void; // reaction actions @@ -79,6 +80,7 @@ export class IssueDetailStore implements IIssueDetailStore { updateIssueComment: action, deleteIssueComment: action, uploadCommentAsset: action, + uploadIssueAsset: action, addCommentReaction: action, removeCommentReaction: action, // reaction actions @@ -245,6 +247,23 @@ export class IssueDetailStore implements IIssueDetailStore { } }; + uploadIssueAsset = async (file: File, anchor: string, commentID?: string) => { + try { + const res = await this.fileService.uploadAsset( + anchor, + { + entity_identifier: commentID ?? "", + entity_type: EFileAssetType.ISSUE_ATTACHMENT, + }, + file + ); + return res; + } catch (error) { + console.log("Error in uploading comment asset:", error); + throw new Error("Asset upload failed. Please try again later."); + } + }; + addCommentReaction = async (anchor: string, issueID: string, commentID: string, reactionHex: string) => { const newReaction = { id: uuidv4(), diff --git a/space/core/types/intake.d.ts b/space/core/types/intake.d.ts new file mode 100644 index 00000000000..9cf2934f63f --- /dev/null +++ b/space/core/types/intake.d.ts @@ -0,0 +1,6 @@ +export type TIntakeIssueForm = { + name: string; + email: string; + username: string; + description_html: string; +}; From f489f4f657fda50dfe0dbb8342a27024f0d9d8e5 Mon Sep 17 00:00:00 2001 From: gakshita Date: Tue, 5 Nov 2024 15:18:48 +0530 Subject: [PATCH 5/5] fix: handled avatar for intake --- web/core/components/inbox/sidebar/inbox-list-item.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/core/components/inbox/sidebar/inbox-list-item.tsx b/web/core/components/inbox/sidebar/inbox-list-item.tsx index c1574fe29e6..6762c25280d 100644 --- a/web/core/components/inbox/sidebar/inbox-list-item.tsx +++ b/web/core/components/inbox/sidebar/inbox-list-item.tsx @@ -4,7 +4,7 @@ import { FC, MouseEvent } from "react"; import { observer } from "mobx-react"; import Link from "next/link"; import { useSearchParams } from "next/navigation"; -import { Tooltip, PriorityIcon, Row } from "@plane/ui"; +import { Tooltip, PriorityIcon, Row, Avatar } from "@plane/ui"; // components import { ButtonAvatars } from "@/components/dropdowns/member/avatar"; import { InboxIssueStatus } from "@/components/inbox"; @@ -12,6 +12,7 @@ import { InboxIssueStatus } from "@/components/inbox"; import { cn } from "@/helpers/common.helper"; import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks +import { getFileURL } from "@/helpers/file.helper"; import { useLabel, useMember, useProjectInbox } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; @@ -116,7 +117,11 @@ export const InboxIssueListItem: FC = observer((props) )} {/* created by */} - {createdByDetails && } + {createdByDetails && createdByDetails.email?.includes("intake@plane.so") ? ( + + ) : createdByDetails ? ( + + ) : null}