From ccd03a4a45c6a51da13d8c3acfdabc3e67fda856 Mon Sep 17 00:00:00 2001 From: kunalv17 <116634168+kunalv17@users.noreply.github.com> Date: Tue, 28 Mar 2023 18:28:26 +0530 Subject: [PATCH 01/13] refactor: constants fetchkeys strings to upper case (#563) --- apps/app/constants/fetch-keys.ts | 98 ++++++++++++++++---------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/apps/app/constants/fetch-keys.ts b/apps/app/constants/fetch-keys.ts index f2698cd2b..4ad9d75bd 100644 --- a/apps/app/constants/fetch-keys.ts +++ b/apps/app/constants/fetch-keys.ts @@ -23,95 +23,95 @@ export const USER_WORKSPACE_INVITATIONS = "USER_WORKSPACE_INVITATIONS"; export const USER_WORKSPACES = "USER_WORKSPACES"; export const APP_INTEGRATIONS = "APP_INTEGRATIONS"; -export const WORKSPACE_DETAILS = (workspaceSlug: string) => `WORKSPACE_DETAILS_${workspaceSlug}`; +export const WORKSPACE_DETAILS = (workspaceSlug: string) => `WORKSPACE_DETAILS_${workspaceSlug.toUpperCase()}`; export const WORKSPACE_INTEGRATIONS = (workspaceSlug: string) => - `WORKSPACE_INTEGRATIONS_${workspaceSlug}`; + `WORKSPACE_INTEGRATIONS_${workspaceSlug.toUpperCase()}`; -export const WORKSPACE_MEMBERS = (workspaceSlug: string) => `WORKSPACE_MEMBERS_${workspaceSlug}`; +export const WORKSPACE_MEMBERS = (workspaceSlug: string) => `WORKSPACE_MEMBERS_${workspaceSlug.toUpperCase()}`; export const WORKSPACE_MEMBERS_ME = (workspaceSlug: string) => - `WORKSPACE_MEMBERS_ME${workspaceSlug}`; + `WORKSPACE_MEMBERS_ME${workspaceSlug.toUpperCase()}`; export const WORKSPACE_INVITATIONS = "WORKSPACE_INVITATIONS"; export const WORKSPACE_INVITATION = "WORKSPACE_INVITATION"; export const LAST_ACTIVE_WORKSPACE_AND_PROJECTS = "LAST_ACTIVE_WORKSPACE_AND_PROJECTS"; -export const PROJECTS_LIST = (workspaceSlug: string) => `PROJECTS_LIST_${workspaceSlug}`; +export const PROJECTS_LIST = (workspaceSlug: string) => `PROJECTS_LIST_${workspaceSlug.toUpperCase()}`; export const FAVORITE_PROJECTS_LIST = (workspaceSlug: string) => - `FAVORITE_PROJECTS_LIST_${workspaceSlug}`; -export const PROJECT_DETAILS = (projectId: string) => `PROJECT_DETAILS_${projectId}`; + `FAVORITE_PROJECTS_LIST_${workspaceSlug.toUpperCase()}`; +export const PROJECT_DETAILS = (projectId: string) => `PROJECT_DETAILS_${projectId.toUpperCase()}`; -export const PROJECT_MEMBERS = (projectId: string) => `PROJECT_MEMBERS_${projectId}`; +export const PROJECT_MEMBERS = (projectId: string) => `PROJECT_MEMBERS_${projectId.toUpperCase()}`; export const PROJECT_INVITATIONS = "PROJECT_INVITATIONS"; export const PROJECT_ISSUES_LIST = (workspaceSlug: string, projectId: string) => - `PROJECT_ISSUES_LIST_${workspaceSlug}_${projectId}`; + `PROJECT_ISSUES_LIST_${workspaceSlug.toUpperCase()}_${projectId.toUpperCase()}`; export const PROJECT_ISSUES_LIST_WITH_PARAMS = (projectId: string, params?: any) => { - if (!params) return `PROJECT_ISSUES_LIST_WITH_PARAMS_${projectId}`; + if (!params) return `PROJECT_ISSUES_LIST_WITH_PARAMS_${projectId.toUpperCase()}`; const paramsKey = paramsToKey(params); - return `PROJECT_ISSUES_LIST_WITH_PARAMS_${projectId}_${paramsKey}`; + return `PROJECT_ISSUES_LIST_WITH_PARAMS_${projectId.toUpperCase()}_${paramsKey}`; }; -export const PROJECT_ISSUES_DETAILS = (issueId: string) => `PROJECT_ISSUES_DETAILS_${issueId}`; +export const PROJECT_ISSUES_DETAILS = (issueId: string) => `PROJECT_ISSUES_DETAILS_${issueId.toUpperCase()}`; export const PROJECT_ISSUES_PROPERTIES = (projectId: string) => - `PROJECT_ISSUES_PROPERTIES_${projectId}`; -export const PROJECT_ISSUES_COMMENTS = (issueId: string) => `PROJECT_ISSUES_COMMENTS_${issueId}`; -export const PROJECT_ISSUES_ACTIVITY = (issueId: string) => `PROJECT_ISSUES_ACTIVITY_${issueId}`; -export const PROJECT_ISSUE_BY_STATE = (projectId: string) => `PROJECT_ISSUE_BY_STATE_${projectId}`; -export const PROJECT_ISSUE_LABELS = (projectId: string) => `PROJECT_ISSUE_LABELS_${projectId}`; + `PROJECT_ISSUES_PROPERTIES_${projectId.toUpperCase()}`; +export const PROJECT_ISSUES_COMMENTS = (issueId: string) => `PROJECT_ISSUES_COMMENTS_${issueId.toUpperCase()}`; +export const PROJECT_ISSUES_ACTIVITY = (issueId: string) => `PROJECT_ISSUES_ACTIVITY_${issueId.toUpperCase()}`; +export const PROJECT_ISSUE_BY_STATE = (projectId: string) => `PROJECT_ISSUE_BY_STATE_${projectId.toUpperCase()}`; +export const PROJECT_ISSUE_LABELS = (projectId: string) => `PROJECT_ISSUE_LABELS_${projectId.toUpperCase()}`; export const PROJECT_GITHUB_REPOSITORY = (projectId: string) => - `PROJECT_GITHUB_REPOSITORY_${projectId}`; + `PROJECT_GITHUB_REPOSITORY_${projectId.toUpperCase()}`; -export const CYCLE_LIST = (projectId: string) => `CYCLE_LIST_${projectId}`; -export const CYCLE_ISSUES = (cycleId: string) => `CYCLE_ISSUES_${cycleId}`; +export const CYCLE_LIST = (projectId: string) => `CYCLE_LIST_${projectId.toUpperCase()}`; +export const CYCLE_ISSUES = (cycleId: string) => `CYCLE_ISSUES_${cycleId.toUpperCase()}`; export const CYCLE_ISSUES_WITH_PARAMS = (cycleId: string, params?: any) => { - if (!params) return `CYCLE_ISSUES_WITH_PARAMS_${cycleId}`; + if (!params) return `CYCLE_ISSUES_WITH_PARAMS_${cycleId.toUpperCase()}`; const paramsKey = paramsToKey(params); - return `CYCLE_ISSUES_WITH_PARAMS_${cycleId}_${paramsKey}`; + return `CYCLE_ISSUES_WITH_PARAMS_${cycleId.toUpperCase()}_${paramsKey.toUpperCase()}`; }; -export const CYCLE_DETAILS = (cycleId: string) => `CYCLE_DETAILS_${cycleId}`; +export const CYCLE_DETAILS = (cycleId: string) => `CYCLE_DETAILS_${cycleId.toUpperCase()}`; export const CYCLE_CURRENT_AND_UPCOMING_LIST = (projectId: string) => - `CYCLE_CURRENT_AND_UPCOMING_LIST_${projectId}`; -export const CYCLE_DRAFT_LIST = (projectId: string) => `CYCLE_DRAFT_LIST_${projectId}`; -export const CYCLE_COMPLETE_LIST = (projectId: string) => `CYCLE_COMPLETE_LIST_${projectId}`; + `CYCLE_CURRENT_AND_UPCOMING_LIST_${projectId.toUpperCase()}`; +export const CYCLE_DRAFT_LIST = (projectId: string) => `CYCLE_DRAFT_LIST_${projectId.toUpperCase()}`; +export const CYCLE_COMPLETE_LIST = (projectId: string) => `CYCLE_COMPLETE_LIST_${projectId.toUpperCase()}`; -export const STATE_LIST = (projectId: string) => `STATE_LIST_${projectId}`; +export const STATE_LIST = (projectId: string) => `STATE_LIST_${projectId.toUpperCase()}`; export const STATE_DETAIL = "STATE_DETAILS"; -export const USER_ISSUE = (workspaceSlug: string) => `USER_ISSUE_${workspaceSlug}`; -export const USER_ACTIVITY = (workspaceSlug: string) => `USER_ACTIVITY_${workspaceSlug}`; +export const USER_ISSUE = (workspaceSlug: string) => `USER_ISSUE_${workspaceSlug.toUpperCase()}`; +export const USER_ACTIVITY = (workspaceSlug: string) => `USER_ACTIVITY_${workspaceSlug.toUpperCase()}`; export const USER_WORKSPACE_DASHBOARD = (workspaceSlug: string) => - `USER_WORKSPACE_DASHBOARD_${workspaceSlug}`; -export const USER_PROJECT_VIEW = (projectId: string) => `USER_PROJECT_VIEW_${projectId}`; + `USER_WORKSPACE_DASHBOARD_${workspaceSlug.toUpperCase()}`; +export const USER_PROJECT_VIEW = (projectId: string) => `USER_PROJECT_VIEW_${projectId.toUpperCase()}`; -export const MODULE_LIST = (projectId: string) => `MODULE_LIST_${projectId}`; -export const MODULE_ISSUES = (moduleId: string) => `MODULE_ISSUES_${moduleId}`; +export const MODULE_LIST = (projectId: string) => `MODULE_LIST_${projectId.toUpperCase()}`; +export const MODULE_ISSUES = (moduleId: string) => `MODULE_ISSUES_${moduleId.toUpperCase()}`; export const MODULE_ISSUES_WITH_PARAMS = (moduleId: string, params?: any) => { - if (!params) return `MODULE_ISSUES_WITH_PARAMS_${moduleId}`; + if (!params) return `MODULE_ISSUES_WITH_PARAMS_${moduleId.toUpperCase()}`; const paramsKey = paramsToKey(params); - return `MODULE_ISSUES_WITH_PARAMS_${moduleId}_${paramsKey}`; + return `MODULE_ISSUES_WITH_PARAMS_${moduleId}_${paramsKey.toUpperCase()}`; }; -export const MODULE_DETAILS = (moduleId: string) => `MODULE_DETAILS_${moduleId}`; +export const MODULE_DETAILS = (moduleId: string) => `MODULE_DETAILS_${moduleId.toUpperCase()}`; -export const VIEWS_LIST = (projectId: string) => `VIEWS_LIST_${projectId}`; -export const VIEW_ISSUES = (viewId: string) => `VIEW_ISSUES_${viewId}`; -export const VIEW_DETAILS = (viewId: string) => `VIEW_DETAILS_${viewId}`; +export const VIEWS_LIST = (projectId: string) => `VIEWS_LIST_${projectId.toUpperCase()}`; +export const VIEW_ISSUES = (viewId: string) => `VIEW_ISSUES_${viewId.toUpperCase()}`; +export const VIEW_DETAILS = (viewId: string) => `VIEW_DETAILS_${viewId.toUpperCase()}`; // Issues -export const ISSUE_DETAILS = (issueId: string) => `ISSUE_DETAILS_${issueId}`; -export const SUB_ISSUES = (issueId: string) => `SUB_ISSUES_${issueId}`; +export const ISSUE_DETAILS = (issueId: string) => `ISSUE_DETAILS_${issueId.toUpperCase()}`; +export const SUB_ISSUES = (issueId: string) => `SUB_ISSUES_${issueId.toUpperCase()}`; // integrations // Pages -export const RECENT_PAGES_LIST = (projectId: string) => `RECENT_PAGES_LIST_${projectId}`; -export const ALL_PAGES_LIST = (projectId: string) => `ALL_PAGES_LIST_${projectId}`; -export const FAVORITE_PAGES_LIST = (projectId: string) => `FAVORITE_PAGES_LIST_${projectId}`; -export const MY_PAGES_LIST = (projectId: string) => `MY_PAGES_LIST_${projectId}`; -export const OTHER_PAGES_LIST = (projectId: string) => `OTHER_PAGES_LIST_${projectId}`; -export const PAGE_DETAILS = (pageId: string) => `PAGE_DETAILS_${pageId}`; -export const PAGE_BLOCKS_LIST = (pageId: string) => `PAGE_BLOCK_LIST_${pageId}`; -export const PAGE_BLOCK_DETAILS = (pageId: string) => `PAGE_BLOCK_DETAILS_${pageId}`; +export const RECENT_PAGES_LIST = (projectId: string) => `RECENT_PAGES_LIST_${projectId.toUpperCase()}`; +export const ALL_PAGES_LIST = (projectId: string) => `ALL_PAGES_LIST_${projectId.toUpperCase()}`; +export const FAVORITE_PAGES_LIST = (projectId: string) => `FAVORITE_PAGES_LIST_${projectId.toUpperCase()}`; +export const MY_PAGES_LIST = (projectId: string) => `MY_PAGES_LIST_${projectId.toUpperCase()}`; +export const OTHER_PAGES_LIST = (projectId: string) => `OTHER_PAGES_LIST_${projectId.toUpperCase()}`; +export const PAGE_DETAILS = (pageId: string) => `PAGE_DETAILS_${pageId.toUpperCase()}`; +export const PAGE_BLOCKS_LIST = (pageId: string) => `PAGE_BLOCK_LIST_${pageId.toUpperCase()}`; +export const PAGE_BLOCK_DETAILS = (pageId: string) => `PAGE_BLOCK_DETAILS_${pageId.toUpperCase()}`; From e2eeec8f79bfdc204f3796a599b61266aa815912 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 28 Mar 2023 18:48:57 +0530 Subject: [PATCH 02/13] feat: completed cycle message added (#565) --- apps/app/components/core/issues-view.tsx | 8 +++++- .../cycles/completed-cycles-list.tsx | 28 +++++++++++-------- apps/app/public/empty-state/empty-cycle.svg | 20 ++++++------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/apps/app/components/core/issues-view.tsx b/apps/app/components/core/issues-view.tsx index 52567c06a..4a561f1bb 100644 --- a/apps/app/components/core/issues-view.tsx +++ b/apps/app/components/core/issues-view.tsx @@ -30,7 +30,7 @@ import { TrashIcon, XMarkIcon, } from "@heroicons/react/24/outline"; -import { getStateGroupIcon } from "components/icons"; +import { ExclamationIcon, getStateGroupIcon } from "components/icons"; // helpers import { getStatesList } from "helpers/state.helper"; // types @@ -683,6 +683,12 @@ export const IssuesView: React.FC = ({ {groupedByIssues ? ( isNotEmpty ? ( <> + {isCompleted && ( +
+ + Completed cycles are not editable. +
+ )} {issueView === "list" ? ( = ({ /> {completedCycles ? ( completedCycles.completed_cycles.length > 0 ? ( -
- {completedCycles.completed_cycles.map((cycle) => ( - handleDeleteCycle(cycle)} - handleEditCycle={() => handleEditCycle(cycle)} - isCompleted - /> - ))} +
+
+ + Completed cycles are not editable. +
+
+ {completedCycles.completed_cycles.map((cycle) => ( + handleDeleteCycle(cycle)} + handleEditCycle={() => handleEditCycle(cycle)} + isCompleted + /> + ))} +
) : ( - + - + @@ -12,12 +12,12 @@ - + - + @@ -26,25 +26,25 @@ - + - - + + - + - - + + From c0a471e916d453a5e9dcdb45a072fd685a038a91 Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Wed, 29 Mar 2023 00:08:34 +0530 Subject: [PATCH 03/13] fix: don't allow decimal in the y axis of completed issues graph (#564) --- apps/app/components/workspace/completed-issues-graph.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app/components/workspace/completed-issues-graph.tsx b/apps/app/components/workspace/completed-issues-graph.tsx index 4eaf7685d..52905b5a3 100644 --- a/apps/app/components/workspace/completed-issues-graph.tsx +++ b/apps/app/components/workspace/completed-issues-graph.tsx @@ -60,7 +60,7 @@ export const CompletedIssuesGraph: React.FC = ({ month, issues, setMonth - + } /> Date: Wed, 29 Mar 2023 00:20:00 +0530 Subject: [PATCH 04/13] chore: minor fixes on pages (#557) * feat: block sync * chore: minor fixes on pages * fix: remove dangerously set inner html * fix: pages crud operations mutation * fix: favorites mutation for recent pages * fix: remove dangerously set inner html --- .../components/core/gpt-assistant-modal.tsx | 50 +++++++++++++------ apps/app/components/issues/form.tsx | 6 ++- .../pages/create-update-page-modal.tsx | 12 ++++- .../components/pages/delete-page-modal.tsx | 25 ++++++++++ apps/app/components/pages/pages-view.tsx | 4 +- .../components/pages/single-page-block.tsx | 45 ++++++++--------- .../pages/single-page-list-item.tsx | 5 +- .../project/single-sidebar-project.tsx | 4 +- .../app/components/rich-text-editor/index.tsx | 6 ++- .../app/components/workspace/help-section.tsx | 14 +++--- .../projects/[projectId]/pages/[pageId].tsx | 17 ++++--- .../projects/[projectId]/pages/index.tsx | 12 ++++- apps/app/services/ai.service.ts | 4 +- apps/app/types/ai.d.ts | 4 ++ apps/app/types/index.d.ts | 1 + 15 files changed, 139 insertions(+), 70 deletions(-) create mode 100644 apps/app/types/ai.d.ts diff --git a/apps/app/components/core/gpt-assistant-modal.tsx b/apps/app/components/core/gpt-assistant-modal.tsx index 0afe481a7..e9c7241c1 100644 --- a/apps/app/components/core/gpt-assistant-modal.tsx +++ b/apps/app/components/core/gpt-assistant-modal.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { useRouter } from "next/router"; +import dynamic from "next/dynamic"; // react-hook-form import { useForm } from "react-hook-form"; @@ -16,6 +17,7 @@ type Props = { handleClose: () => void; inset?: string; content: string; + htmlContent?: string; onResponse: (response: string) => void; }; @@ -24,11 +26,16 @@ type FormData = { task: string; }; +const RemirrorRichTextEditor = dynamic(() => import("components/rich-text-editor"), { + ssr: false, +}); + export const GptAssistantModal: React.FC = ({ isOpen, handleClose, inset = "top-0 left-0", content, + htmlContent, onResponse, }) => { const [response, setResponse] = useState(""); @@ -62,15 +69,6 @@ export const GptAssistantModal: React.FC = ({ const handleResponse = async (formData: FormData) => { if (!workspaceSlug || !projectId) return; - if (!content || content === "") { - setToastAlert({ - type: "error", - title: "Error!", - message: "Please enter some description to get AI assistance.", - }); - return; - } - if (formData.task === "") { setToastAlert({ type: "error", @@ -82,11 +80,11 @@ export const GptAssistantModal: React.FC = ({ await aiService .createGptTask(workspaceSlug as string, projectId as string, { - prompt: content, + prompt: content && content !== "" ? content : "", task: formData.task, }) .then((res) => { - setResponse(res.response); + setResponse(res.response_html); setFocus("task"); if (res.response === "") setInvalidResponse(true); @@ -105,12 +103,28 @@ export const GptAssistantModal: React.FC = ({ }`} >
-
- Content:

{content}

-
+ {content && content !== "" && ( +
+ Content: + {content}

} + customClassName="-mx-3 -my-3" + noBorder + borderOnFocus={false} + editable={false} + /> +
+ )} {response !== "" && (
- Response:

{response}

+ Response: + ${response}

`} + customClassName="-mx-3 -my-3" + noBorder + borderOnFocus={false} + editable={false} + />
)} {invalidResponse && ( @@ -123,7 +137,11 @@ export const GptAssistantModal: React.FC = ({ type="text" name="task" register={register} - placeholder="Tell OpenAI what action to perform on this content..." + placeholder={`${ + content && content !== "" + ? "Tell AI what action to perform on this content..." + : "Ask AI anything..." + }`} autoComplete="off" />
diff --git a/apps/app/components/issues/form.tsx b/apps/app/components/issues/form.tsx index d111ae6fb..81e01e6be 100644 --- a/apps/app/components/issues/form.tsx +++ b/apps/app/components/issues/form.tsx @@ -239,7 +239,11 @@ export const IssueForm: FC = ({ control={control} render={({ field: { value } }) => ( setValue("description", jsonValue)} onHTMLChange={(htmlValue) => setValue("description_html", htmlValue)} placeholder="Description" diff --git a/apps/app/components/pages/create-update-page-modal.tsx b/apps/app/components/pages/create-update-page-modal.tsx index 18b2c9b34..ed12f8f46 100644 --- a/apps/app/components/pages/create-update-page-modal.tsx +++ b/apps/app/components/pages/create-update-page-modal.tsx @@ -45,12 +45,20 @@ export const CreateUpdatePageModal: React.FC = ({ isOpen, handleClose, da mutate(RECENT_PAGES_LIST(projectId as string)); mutate( MY_PAGES_LIST(projectId as string), - (prevData) => [res, ...(prevData as IPage[])], + (prevData) => { + if (!prevData) return undefined; + + return [res, ...(prevData as IPage[])]; + }, false ); mutate( ALL_PAGES_LIST(projectId as string), - (prevData) => [res, ...(prevData as IPage[])], + (prevData) => { + if (!prevData) return undefined; + + return [res, ...(prevData as IPage[])]; + }, false ); onClose(); diff --git a/apps/app/components/pages/delete-page-modal.tsx b/apps/app/components/pages/delete-page-modal.tsx index 38dff3264..94468f2b8 100644 --- a/apps/app/components/pages/delete-page-modal.tsx +++ b/apps/app/components/pages/delete-page-modal.tsx @@ -2,6 +2,8 @@ import React, { useState } from "react"; import { useRouter } from "next/router"; +import { mutate } from "swr"; + // headless ui import { Dialog, Transition } from "@headlessui/react"; // services @@ -14,6 +16,13 @@ import { DangerButton, SecondaryButton } from "components/ui"; import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; // types import type { IPage } from "types"; +// fetch-keys +import { + ALL_PAGES_LIST, + FAVORITE_PAGES_LIST, + MY_PAGES_LIST, + RECENT_PAGES_LIST, +} from "constants/fetch-keys"; type TConfirmPageDeletionProps = { isOpen: boolean; @@ -45,6 +54,22 @@ export const DeletePageModal: React.FC = ({ await pagesService .deletePage(workspaceSlug as string, data.project, data.id) .then(() => { + mutate(RECENT_PAGES_LIST(projectId as string)); + mutate( + MY_PAGES_LIST(projectId as string), + (prevData) => (prevData ?? []).filter((page) => page.id !== data?.id), + false + ); + mutate( + ALL_PAGES_LIST(projectId as string), + (prevData) => (prevData ?? []).filter((page) => page.id !== data?.id), + false + ); + mutate( + FAVORITE_PAGES_LIST(projectId as string), + (prevData) => (prevData ?? []).filter((page) => page.id !== data?.id), + false + ); handleClose(); setToastAlert({ type: "success", diff --git a/apps/app/components/pages/pages-view.tsx b/apps/app/components/pages/pages-view.tsx index dc4e0d19c..e8b483016 100644 --- a/apps/app/components/pages/pages-view.tsx +++ b/apps/app/components/pages/pages-view.tsx @@ -57,7 +57,6 @@ export const PagesView: React.FC = ({ pages, viewType }) => { const handleAddToFavorites = (page: IPage) => { if (!workspaceSlug || !projectId) return; - mutate(RECENT_PAGES_LIST(projectId as string)); mutate( ALL_PAGES_LIST(projectId as string), (prevData) => @@ -89,6 +88,7 @@ export const PagesView: React.FC = ({ pages, viewType }) => { page: page.id, }) .then(() => { + mutate(RECENT_PAGES_LIST(projectId as string)); setToastAlert({ type: "success", title: "Success!", @@ -107,7 +107,6 @@ export const PagesView: React.FC = ({ pages, viewType }) => { const handleRemoveFromFavorites = (page: IPage) => { if (!workspaceSlug || !projectId) return; - mutate(RECENT_PAGES_LIST(projectId as string)); mutate( ALL_PAGES_LIST(projectId as string), (prevData) => @@ -137,6 +136,7 @@ export const PagesView: React.FC = ({ pages, viewType }) => { pagesService .removePageFromFavorites(workspaceSlug as string, projectId as string, page.id) .then(() => { + mutate(RECENT_PAGES_LIST(projectId as string)); setToastAlert({ type: "success", title: "Success!", diff --git a/apps/app/components/pages/single-page-block.tsx b/apps/app/components/pages/single-page-block.tsx index 1aa914022..8c9064ad7 100644 --- a/apps/app/components/pages/single-page-block.tsx +++ b/apps/app/components/pages/single-page-block.tsx @@ -17,11 +17,16 @@ import useToast from "hooks/use-toast"; import { CreateUpdateIssueModal } from "components/issues"; import { GptAssistantModal } from "components/core"; // ui -import { CustomMenu, Loader, TextArea } from "components/ui"; +import { CustomMenu, Input, Loader, TextArea } from "components/ui"; // icons -import { LayerDiagonalIcon, WaterDropIcon } from "components/icons"; +import { LayerDiagonalIcon } from "components/icons"; import { ArrowPathIcon } from "@heroicons/react/20/solid"; -import { CheckIcon } from "@heroicons/react/24/outline"; +import { + BoltIcon, + CheckIcon, + CursorArrowRaysIcon, + SparklesIcon, +} from "@heroicons/react/24/outline"; // helpers import { copyTextToClipboard } from "helpers/string.helper"; // types @@ -163,21 +168,8 @@ export const SinglePageBlock: React.FC = ({ block, projectDetails }) => { const handleAiAssistance = async (response: string) => { if (!workspaceSlug || !projectId) return; - setValue("description", { - type: "doc", - content: [ - { - type: "paragraph", - content: [ - { - text: response, - type: "text", - }, - ], - }, - ], - }); - setValue("description_html", `

${response}

`); + setValue("description", {}); + setValue("description_html", `${watch("description_html")}

${response}

`); handleSubmit(updatePageBlock)() .then(() => { setToastAlert({ @@ -253,7 +245,7 @@ export const SinglePageBlock: React.FC = ({ block, projectDetails }) => { }} />
-