From 0af55e7bbbc8ffd583bc1f460ec019e548e11081 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 10 May 2024 15:21:05 +0530 Subject: [PATCH] [WEB-1250] chore: module list enhancement (#4425) * chore: move module sub-header to app header * chore: gantt header improvement, remove title * chore: progress indicator size reduced * chore: replace members with lead and updated start and end date ui --- web/components/gantt-chart/chart/header.tsx | 4 +- web/components/gantt-chart/chart/root.tsx | 1 - web/components/headers/modules-list.tsx | 2 + web/components/modules/module-card-item.tsx | 40 ++++++++------- .../modules/module-list-item-action.tsx | 50 +++++++++---------- web/components/modules/module-list-item.tsx | 6 +-- .../projects/[projectId]/modules/index.tsx | 17 +++---- 7 files changed, 59 insertions(+), 61 deletions(-) diff --git a/web/components/gantt-chart/chart/header.tsx b/web/components/gantt-chart/chart/header.tsx index e2722b22a..fe4d0c885 100644 --- a/web/components/gantt-chart/chart/header.tsx +++ b/web/components/gantt-chart/chart/header.tsx @@ -15,18 +15,16 @@ type Props = { handleChartView: (view: TGanttViews) => void; handleToday: () => void; loaderTitle: string; - title: string; toggleFullScreenMode: () => void; }; export const GanttChartHeader: React.FC = observer((props) => { - const { blocks, fullScreenMode, handleChartView, handleToday, loaderTitle, title, toggleFullScreenMode } = props; + const { blocks, fullScreenMode, handleChartView, handleToday, loaderTitle, toggleFullScreenMode } = props; // chart hook const { currentView } = useGanttChart(); return (
-
{title}
{blocks ? `${blocks.length} ${loaderTitle}` : "Loading..."}
diff --git a/web/components/gantt-chart/chart/root.tsx b/web/components/gantt-chart/chart/root.tsx index a4ea8cbf2..395e0771c 100644 --- a/web/components/gantt-chart/chart/root.tsx +++ b/web/components/gantt-chart/chart/root.tsx @@ -172,7 +172,6 @@ export const ChartViewRoot: FC = observer((props) => { handleChartView={(key) => updateCurrentViewRenderPayload(null, key)} handleToday={handleToday} loaderTitle={loaderTitle} - title={title} /> {
+ {canUserCreateModule && (
@@ -217,11 +219,13 @@ export const ModuleCardItem: React.FC = observer((props) => {
{isDateValid ? ( - <> - - {renderFormattedDate(startDate) ?? "_ _"} - {renderFormattedDate(endDate) ?? "_ _"} - - +
+ + {renderFormattedDate(startDate)} + + + {renderFormattedDate(endDate)} +
) : ( No due date )} @@ -229,7 +233,7 @@ export const ModuleCardItem: React.FC = observer((props) => {
-
+
{isEditingAllowed && ( { diff --git a/web/components/modules/module-list-item-action.tsx b/web/components/modules/module-list-item-action.tsx index b34dc7555..fa7d71577 100644 --- a/web/components/modules/module-list-item-action.tsx +++ b/web/components/modules/module-list-item-action.tsx @@ -2,11 +2,11 @@ import React, { FC } from "react"; import { observer } from "mobx-react"; import { useRouter } from "next/router"; // icons -import { User2 } from "lucide-react"; +import { CalendarCheck2, CalendarClock, MoveRight, User2 } from "lucide-react"; // types import { IModule } from "@plane/types"; // ui -import { Avatar, AvatarGroup, Tooltip, setPromiseToast } from "@plane/ui"; +import { Tooltip, setPromiseToast } from "@plane/ui"; // components import { FavoriteStar } from "@/components/core"; import { ModuleQuickActions } from "@/components/modules"; @@ -18,7 +18,7 @@ import { EUserProjectRoles } from "@/constants/project"; import { getDate, renderFormattedDate } from "@/helpers/date-time.helper"; // hooks import { useEventTracker, useMember, useModule, useUser } from "@/hooks/store"; -import { usePlatformOS } from "@/hooks/use-platform-os"; +import { ButtonAvatars } from "../dropdowns/member/avatar"; type Props = { moduleId: string; @@ -38,7 +38,6 @@ export const ModuleListItemAction: FC = observer((props) => { const { addModuleToFavorites, removeModuleFromFavorites } = useModule(); const { getUserDetails } = useMember(); const { captureEvent } = useEventTracker(); - const { isMobile } = usePlatformOS(); // derived values const endDate = getDate(moduleDetails.target_date); @@ -109,11 +108,23 @@ export const ModuleListItemAction: FC = observer((props) => { }); }; + const moduleLeadDetails = moduleDetails.lead_id ? getUserDetails(moduleDetails.lead_id) : undefined; + return ( <> + {renderDate && ( +
+ + {renderFormattedDate(startDate)} + + + {renderFormattedDate(endDate)} +
+ )} + {moduleStatus && ( = observer((props) => { )} - {renderDate && ( - - {renderFormattedDate(startDate) ?? "_ _"} - {renderFormattedDate(endDate) ?? "_ _"} + {moduleLeadDetails ? ( + + + ) : ( + + + + + )} - -
- {moduleDetails.member_ids.length > 0 ? ( - - {moduleDetails.member_ids.map((member_id) => { - const member = getUserDetails(member_id); - return ; - })} - - ) : ( - - - - )} -
-
- {isEditingAllowed && !moduleDetails.archived_at && ( { diff --git a/web/components/modules/module-list-item.tsx b/web/components/modules/module-list-item.tsx index 9ad7d2225..b74592112 100644 --- a/web/components/modules/module-list-item.tsx +++ b/web/components/modules/module-list-item.tsx @@ -77,7 +77,7 @@ export const ModuleListItem: React.FC = observer((props) => { ) : progress === 100 ? ( ) : ( - {`${progress}%`} + {`${progress}%`} )} } @@ -89,9 +89,7 @@ export const ModuleListItem: React.FC = observer((props) => { } - actionableItems={ - - } + actionableItems={} isMobile={isMobile} parentRef={parentRef} /> diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/modules/index.tsx b/web/pages/[workspaceSlug]/projects/[projectId]/modules/index.tsx index 85be0c140..08e621d0f 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/modules/index.tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/modules/index.tsx @@ -1,20 +1,23 @@ import { ReactElement, useCallback } from "react"; import { observer } from "mobx-react"; import { useRouter } from "next/router"; +// types import { TModuleFilters } from "@plane/types"; -// layouts // components import { PageHead } from "@/components/core"; import { EmptyState } from "@/components/empty-state"; import { ModulesListHeader } from "@/components/headers"; -import { ModuleViewHeader, ModuleAppliedFiltersList, ModulesListView } from "@/components/modules"; -// types -// hooks +import { ModuleAppliedFiltersList, ModulesListView } from "@/components/modules"; import ModulesListMobileHeader from "@/components/modules/moduels-list-mobile-header"; +// constants import { EmptyStateType } from "@/constants/empty-state"; +// helpers import { calculateTotalFilters } from "@/helpers/filter.helper"; +// hooks import { useModuleFilter, useProject } from "@/hooks/store"; +// layouts import { AppLayout } from "@/layouts/app-layout"; +// types import { NextPageWithLayout } from "@/lib/types"; const ProjectModulesPage: NextPageWithLayout = observer(() => { @@ -58,12 +61,6 @@ const ProjectModulesPage: NextPageWithLayout = observer(() => { <>
-
-
- Module name -
- -
{(calculateTotalFilters(currentProjectFilters ?? {}) !== 0 || currentProjectDisplayFilters?.favorites) && (