From d6dbfdc73127f5fb01664e3dd038797e7f9e6a89 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Wed, 12 Apr 2023 18:07:50 +0530 Subject: [PATCH] feat: page improvement (#797) * feat: remove label icon added * feat: block menu dropdown state added * feat: page info icon added and style: overflow title and label fix --- apps/app/components/pages/pages-view.tsx | 14 +++++++- .../components/pages/single-page-block.tsx | 25 ++++++++++++-- .../pages/single-page-detailed-item.tsx | 19 +++++++++-- .../pages/single-page-list-item.tsx | 34 ++++++++++++++----- .../projects/[projectId]/pages/[pageId].tsx | 8 ++++- 5 files changed, 84 insertions(+), 16 deletions(-) diff --git a/apps/app/components/pages/pages-view.tsx b/apps/app/components/pages/pages-view.tsx index f09ee6540..c6d600307 100644 --- a/apps/app/components/pages/pages-view.tsx +++ b/apps/app/components/pages/pages-view.tsx @@ -1,9 +1,11 @@ import { useState } from "react"; +import useSWR, { mutate } from "swr"; import { useRouter } from "next/router"; // services import pagesService from "services/pages.service"; +import projectService from "services/project.service"; // hooks import useToast from "hooks/use-toast"; // components @@ -23,9 +25,9 @@ import { ALL_PAGES_LIST, FAVORITE_PAGES_LIST, MY_PAGES_LIST, + PROJECT_MEMBERS, RECENT_PAGES_LIST, } from "constants/fetch-keys"; -import { mutate } from "swr"; type Props = { pages: IPage[] | undefined; @@ -44,6 +46,13 @@ export const PagesView: React.FC = ({ pages, viewType }) => { const { setToastAlert } = useToast(); + const { data: people } = useSWR( + workspaceSlug && projectId ? PROJECT_MEMBERS(projectId as string) : null, + workspaceSlug && projectId + ? () => projectService.projectMembers(workspaceSlug as string, projectId as string) + : null + ); + const handleEditPage = (page: IPage) => { setSelectedPageToUpdate(page); setCreateUpdatePageModal(true); @@ -198,6 +207,7 @@ export const PagesView: React.FC = ({ pages, viewType }) => { handleEditPage(page)} handleDeletePage={() => handleDeletePage(page)} handleAddToFavorites={() => handleAddToFavorites(page)} @@ -212,6 +222,7 @@ export const PagesView: React.FC = ({ pages, viewType }) => { handleEditPage(page)} handleDeletePage={() => handleDeletePage(page)} handleAddToFavorites={() => handleAddToFavorites(page)} @@ -226,6 +237,7 @@ export const PagesView: React.FC = ({ pages, viewType }) => { handleEditPage(page)} handleDeletePage={() => handleDeletePage(page)} handleAddToFavorites={() => handleAddToFavorites(page)} diff --git a/apps/app/components/pages/single-page-block.tsx b/apps/app/components/pages/single-page-block.tsx index 0d647a8fa..04f37f334 100644 --- a/apps/app/components/pages/single-page-block.tsx +++ b/apps/app/components/pages/single-page-block.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useState, useRef } from "react"; import { useRouter } from "next/router"; import Link from "next/link"; @@ -16,6 +16,7 @@ import issuesService from "services/issues.service"; import aiService from "services/ai.service"; // hooks import useToast from "hooks/use-toast"; +import useOutsideClickDetector from "hooks/use-outside-click-detector"; // components import { GptAssistantModal } from "components/core"; import { CreateUpdateBlockInline } from "components/pages"; @@ -61,6 +62,9 @@ export const SinglePageBlock: React.FC = ({ block, projectDetails, index const [gptAssistantModal, setGptAssistantModal] = useState(false); + const [isMenuActive, setIsMenuActive] = useState(false); + const actionSectionRef = useRef(null); + const router = useRouter(); const { workspaceSlug, projectId, pageId } = router.query; @@ -274,6 +278,7 @@ export const SinglePageBlock: React.FC = ({ block, projectDetails, index reset({ ...block }); }, [reset, block]); + useOutsideClickDetector(actionSectionRef, () => setIsMenuActive(false)); return ( {(provided, snapshot) => ( @@ -308,7 +313,12 @@ export const SinglePageBlock: React.FC = ({ block, projectDetails, index -
+