From 9397cb9cbc90f4101482b3cf55dbaf67b4e87b4e Mon Sep 17 00:00:00 2001 From: dakshesh14 Date: Tue, 26 Sep 2023 12:43:55 +0530 Subject: [PATCH 1/8] fix: 'Last Drafted Issue' making sidebar look weird on collapsed --- .../workspace/sidebar-quick-action.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/web/components/workspace/sidebar-quick-action.tsx b/web/components/workspace/sidebar-quick-action.tsx index 8923abc141e..1c614f6940f 100644 --- a/web/components/workspace/sidebar-quick-action.tsx +++ b/web/components/workspace/sidebar-quick-action.tsx @@ -44,7 +44,9 @@ export const WorkspaceSidebarQuickAction = () => { > -
+
- ) - : !disableUserActions && - !isInlineCreateIssueFormOpen && ( - - - Add Issue - - } - position="left" - verticalPosition="top" - optionsClassName="left-5 !w-36" - noBorder - > - setIsInlineCreateIssueFormOpen(true)}> - Create new - - {openIssuesListModal && ( - - Add an existing issue - - )} - - )} -
) : ( )}
+ +
+ setIsInlineCreateIssueFormOpen(false)} + prePopulatedData={{ + ...(cycleId && { cycle: cycleId.toString() }), + ...(moduleId && { module: moduleId.toString() }), + }} + /> + + {type === "issue" + ? !disableUserActions && + !isInlineCreateIssueFormOpen && ( + + ) + : !disableUserActions && + !isInlineCreateIssueFormOpen && ( + + + Add Issue + + } + position="left" + verticalPosition="top" + optionsClassName="left-5 !w-36" + noBorder + > + setIsInlineCreateIssueFormOpen(true)}> + Create new + + {openIssuesListModal && ( + + Add an existing issue + + )} + + )} +
); }; diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx b/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx index f2962938483..65007db3c89 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/cycles/[cycleId].tsx @@ -189,7 +189,7 @@ const SingleCycle: React.FC = () => { {cycleStatus === "completed" && ( setTransferIssuesModal(true)} /> )} -
+
Date: Tue, 26 Sep 2023 16:23:53 +0530 Subject: [PATCH 4/8] fix: wrong placement of quick-add in calender layout --- .../core/views/calendar-view/calendar.tsx | 5 +++- .../inline-create-issue-form.tsx | 23 ++++++++++++++----- .../core/views/calendar-view/single-date.tsx | 1 + 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/web/components/core/views/calendar-view/calendar.tsx b/web/components/core/views/calendar-view/calendar.tsx index 030f8b7475d..8fbe3530534 100644 --- a/web/components/core/views/calendar-view/calendar.tsx +++ b/web/components/core/views/calendar-view/calendar.tsx @@ -183,7 +183,10 @@ export const CalendarView: React.FC = ({ {calendarIssues ? (
-
+
void; onSuccess?: (data: IIssue) => Promise | void; prePopulatedData?: Partial; + dependencies: any[]; }; -const useCheckIfThereIsSpaceOnRight = (ref: React.RefObject) => { +const useCheckIfThereIsSpaceOnRight = (ref: React.RefObject, deps: any[]) => { const [isThereSpaceOnRight, setIsThereSpaceOnRight] = useState(true); + const router = useRouter(); + const { moduleId, cycleId, viewId } = router.query; + + const container = document.getElementById(`calendar-view-${cycleId ?? moduleId ?? viewId}`); + useEffect(() => { if (!ref.current) return; const { right } = ref.current.getBoundingClientRect(); - const width = right + 250; + const width = right; + + const innerWidth = container?.getBoundingClientRect().width ?? window.innerWidth; - if (width > window.innerWidth) setIsThereSpaceOnRight(false); + if (width > innerWidth) setIsThereSpaceOnRight(false); else setIsThereSpaceOnRight(true); - }, [ref]); + }, [ref, deps, container]); return isThereSpaceOnRight; }; @@ -63,11 +74,11 @@ const InlineInput = () => { }; export const CalendarInlineCreateIssueForm: React.FC = (props) => { - const { isOpen } = props; + const { isOpen, dependencies } = props; const ref = useRef(null); - const isSpaceOnRight = useCheckIfThereIsSpaceOnRight(ref); + const isSpaceOnRight = useCheckIfThereIsSpaceOnRight(ref, dependencies); return ( <> diff --git a/web/components/core/views/calendar-view/single-date.tsx b/web/components/core/views/calendar-view/single-date.tsx index 1781512045c..02ea56678f9 100644 --- a/web/components/core/views/calendar-view/single-date.tsx +++ b/web/components/core/views/calendar-view/single-date.tsx @@ -83,6 +83,7 @@ export const SingleCalendarDate: React.FC = (props) => { setIsCreateIssueFormOpen(false)} prePopulatedData={{ target_date: date.date, From 233b2c0d69837ca84d036ccaec70dd230962d0f2 Mon Sep 17 00:00:00 2001 From: dakshesh14 Date: Tue, 26 Sep 2023 16:33:22 +0530 Subject: [PATCH 5/8] fix: spacing for issue card in spreadsheet view --- .../core/views/spreadsheet-view/spreadsheet-view.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/components/core/views/spreadsheet-view/spreadsheet-view.tsx b/web/components/core/views/spreadsheet-view/spreadsheet-view.tsx index 8de90e358b3..d11fe85d624 100644 --- a/web/components/core/views/spreadsheet-view/spreadsheet-view.tsx +++ b/web/components/core/views/spreadsheet-view/spreadsheet-view.tsx @@ -68,7 +68,11 @@ export const SpreadsheetView: React.FC = ({ workspaceSlug={workspaceSlug?.toString() ?? ""} readOnly={disableUserActions} /> -
+
From 7be313f7eba5e748c6657eeb0b18635aabea4c24 Mon Sep 17 00:00:00 2001 From: dakshesh14 Date: Tue, 26 Sep 2023 18:20:13 +0530 Subject: [PATCH 6/8] style: gantt layout quick-add padding style: removed 'State group' from draft issue --- web/components/core/filters/issues-view-filter.tsx | 9 +++++++-- .../views/gantt-chart-view/inline-create-issue-form.tsx | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web/components/core/filters/issues-view-filter.tsx b/web/components/core/filters/issues-view-filter.tsx index f5b0f477a54..72c2fc83bd4 100644 --- a/web/components/core/filters/issues-view-filter.tsx +++ b/web/components/core/filters/issues-view-filter.tsx @@ -67,7 +67,7 @@ export const IssuesFilterView: React.FC = () => { const router = useRouter(); const { workspaceSlug, projectId, viewId } = router.query; const isArchivedIssues = router.pathname.includes("archived-issues"); - const isDraftIssues = router.pathname.includes("draft-issues"); + const isDraftIssues = router.pathname?.split("/")?.[4] === "draft-issues"; const { displayFilters, @@ -93,7 +93,9 @@ export const IssuesFilterView: React.FC = () => { {replaceUnderscoreIfSnakeCase(option.type)} Layout + + {replaceUnderscoreIfSnakeCase(option.type)} Layout + } position="bottom" > @@ -228,6 +230,9 @@ export const IssuesFilterView: React.FC = () => { return null; if (option.key === "project") return null; + if (isDraftIssues && option.key === "state_detail.group") + return null; + return ( { {...register("name", { required: "Issue title is required.", })} - className="w-full px-2 py-1.5 rounded-md bg-transparent text-sm font-medium leading-5 text-custom-text-200 outline-none" + className="w-full px-2 rounded-md bg-transparent text-sm font-medium leading-5 text-custom-text-200 outline-none" /> ); From abbf06636150c213fd0652c7880f92f823ea60c1 Mon Sep 17 00:00:00 2001 From: dakshesh14 Date: Tue, 26 Sep 2023 23:40:43 +0530 Subject: [PATCH 7/8] style: decrese shadow, quick-add position on calender layout, and 'add issue' sticky --- .../board-view/inline-create-issue-form.tsx | 2 +- .../core/views/calendar-view/calendar.tsx | 2 +- .../inline-create-issue-form.tsx | 6 +- .../core/views/calendar-view/single-date.tsx | 32 ++-- .../list-view/inline-create-issue-form.tsx | 2 +- .../spreadsheet-view/spreadsheet-view.tsx | 147 +++++++++++++----- web/components/gantt-chart/chart/index.tsx | 48 ++++++ web/components/gantt-chart/sidebar.tsx | 47 +----- 8 files changed, 182 insertions(+), 104 deletions(-) diff --git a/web/components/core/views/board-view/inline-create-issue-form.tsx b/web/components/core/views/board-view/inline-create-issue-form.tsx index f4810164d32..651a0c0c1bc 100644 --- a/web/components/core/views/board-view/inline-create-issue-form.tsx +++ b/web/components/core/views/board-view/inline-create-issue-form.tsx @@ -48,7 +48,7 @@ const InlineInput = () => { export const BoardInlineCreateIssueForm: React.FC = (props) => ( <> diff --git a/web/components/core/views/calendar-view/calendar.tsx b/web/components/core/views/calendar-view/calendar.tsx index 8fbe3530534..f339f7cf291 100644 --- a/web/components/core/views/calendar-view/calendar.tsx +++ b/web/components/core/views/calendar-view/calendar.tsx @@ -184,7 +184,7 @@ export const CalendarView: React.FC = ({
= (props) => { <>
diff --git a/web/components/core/views/calendar-view/single-date.tsx b/web/components/core/views/calendar-view/single-date.tsx index 02ea56678f9..3e38155f1b0 100644 --- a/web/components/core/views/calendar-view/single-date.tsx +++ b/web/components/core/views/calendar-view/single-date.tsx @@ -39,6 +39,8 @@ export const SingleCalendarDate: React.FC = (props) => { const [showAllIssues, setShowAllIssues] = useState(false); const [isCreateIssueFormOpen, setIsCreateIssueFormOpen] = useState(false); + const [formPosition, setFormPosition] = useState({ x: 0, y: 0 }); + const totalIssues = date.issues.length; return ( @@ -81,16 +83,23 @@ export const SingleCalendarDate: React.FC = (props) => { ))} - setIsCreateIssueFormOpen(false)} - prePopulatedData={{ - target_date: date.date, - ...(cycleId && { cycle: cycleId.toString() }), - ...(moduleId && { module: moduleId.toString() }), +
+ > + setIsCreateIssueFormOpen(false)} + prePopulatedData={{ + target_date: date.date, + ...(cycleId && { cycle: cycleId.toString() }), + ...(moduleId && { module: moduleId.toString() }), + }} + /> +
{totalIssues > 4 && ( + ) + : !disableUserActions && + !isInlineCreateIssueFormOpen && ( + + + Add Issue + + } + position="left" + verticalPosition="top" + optionsClassName="left-5 !w-36" + noBorder + > + setIsInlineCreateIssueFormOpen(true)}> + Create new + + {openIssuesListModal && ( + + Add an existing issue + + )} + + )}
- )} +
); diff --git a/web/components/gantt-chart/chart/index.tsx b/web/components/gantt-chart/chart/index.tsx index aa79ae19c8e..a8f541b0b0f 100644 --- a/web/components/gantt-chart/chart/index.tsx +++ b/web/components/gantt-chart/chart/index.tsx @@ -1,4 +1,6 @@ import { FC, useEffect, useState } from "react"; +// next +import { useRouter } from "next/router"; // icons import { ArrowsPointingInIcon, ArrowsPointingOutIcon } from "@heroicons/react/20/solid"; // components @@ -11,6 +13,8 @@ import { GanttSidebar } from "../sidebar"; import { MonthChartView } from "./month"; // import { QuarterChartView } from "./quarter"; // import { YearChartView } from "./year"; +// icons +import { PlusIcon } from "lucide-react"; // views import { // generateHourChart, @@ -25,6 +29,7 @@ import { getNumberOfDaysBetweenTwoDatesInYear, getMonthChartItemPositionWidthInMonth, } from "../views"; +import { GanttInlineCreateIssueForm } from "components/core/views/gantt-chart-view/inline-create-issue-form"; // types import { ChartDataType, IBlockUpdateData, IGanttBlock, TGanttViews } from "../types"; // data @@ -64,12 +69,17 @@ export const ChartViewRoot: FC = ({ const [itemsContainerWidth, setItemsContainerWidth] = useState(0); const [fullScreenMode, setFullScreenMode] = useState(false); + const [isCreateIssueFormOpen, setIsCreateIssueFormOpen] = useState(false); + // blocks state management starts const [chartBlocks, setChartBlocks] = useState(null); const { currentView, currentViewData, renderView, dispatch, allViews, updateScrollLeft } = useChart(); + const router = useRouter(); + const { cycleId, moduleId } = router.query; + const renderBlockStructure = (view: any, blocks: IGanttBlock[] | null) => blocks && blocks.length > 0 ? blocks.map((block: any) => ({ @@ -304,6 +314,44 @@ export const ChartViewRoot: FC = ({ SidebarBlockRender={SidebarBlockRender} enableReorder={enableReorder} /> + {chartBlocks && ( +
+ setIsCreateIssueFormOpen(false)} + onSuccess={() => { + const ganttSidebar = document.getElementById(`gantt-sidebar-${cycleId}`); + + const timeoutId = setTimeout(() => { + if (ganttSidebar) + ganttSidebar.scrollBy({ + top: ganttSidebar.scrollHeight, + left: 0, + behavior: "smooth", + }); + clearTimeout(timeoutId); + }, 10); + }} + prePopulatedData={{ + start_date: new Date(Date.now()).toISOString().split("T")[0], + target_date: new Date(Date.now() + 86400000).toISOString().split("T")[0], + ...(cycleId && { cycle: cycleId.toString() }), + ...(moduleId && { module: moduleId.toString() }), + }} + /> + + {!isCreateIssueFormOpen && ( + + )} +
+ )}
= (props) => { const { title, blockUpdateHandler, blocks, SidebarBlockRender, enableReorder } = props; const router = useRouter(); - const { cycleId, moduleId } = router.query; + const { cycleId } = router.query; const { activeBlock, dispatch } = useChart(); - const [isCreateIssueFormOpen, setIsCreateIssueFormOpen] = useState(false); - // update the active block on hover const updateActiveBlock = (block: IGanttBlock | null) => { dispatch({ @@ -93,7 +86,7 @@ export const GanttSidebar: React.FC = (props) => { {(droppableProvided) => (
@@ -159,42 +152,6 @@ export const GanttSidebar: React.FC = (props) => {
)} -
- setIsCreateIssueFormOpen(false)} - onSuccess={() => { - const ganttSidebar = document.getElementById(`gantt-sidebar-${cycleId}`); - - const timeoutId = setTimeout(() => { - if (ganttSidebar) - ganttSidebar.scrollBy({ - top: ganttSidebar.scrollHeight, - left: 0, - behavior: "smooth", - }); - clearTimeout(timeoutId); - }, 10); - }} - prePopulatedData={{ - start_date: new Date(Date.now()).toISOString().split("T")[0], - target_date: new Date(Date.now() + 86400000).toISOString().split("T")[0], - ...(cycleId && { cycle: cycleId.toString() }), - ...(moduleId && { module: moduleId.toString() }), - }} - /> - - {!isCreateIssueFormOpen && ( - - )} -
); }; From 2ed6fffb58f4bef6718d99e262080744a97cbc63 Mon Sep 17 00:00:00 2001 From: dakshesh14 Date: Tue, 26 Sep 2023 23:46:02 +0530 Subject: [PATCH 8/8] style: button color --- .../core/views/spreadsheet-view/spreadsheet-view.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/components/core/views/spreadsheet-view/spreadsheet-view.tsx b/web/components/core/views/spreadsheet-view/spreadsheet-view.tsx index c9ca7879f67..66dc97f2c8a 100644 --- a/web/components/core/views/spreadsheet-view/spreadsheet-view.tsx +++ b/web/components/core/views/spreadsheet-view/spreadsheet-view.tsx @@ -301,7 +301,7 @@ export const SpreadsheetView: React.FC = ({ ? !disableUserActions && !isInlineCreateIssueFormOpen && (