From 09d73c5e04828305cc01f4000ca46ec4e7c16853 Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Fri, 31 Mar 2023 14:46:17 +0530 Subject: [PATCH 01/22] fix: issue activity (#645) - fix: set and remove activity logs are showing problems - fix: removing due date is showing static value of 1 Jan. - fix: old labels to have black color. - fix: word 'Description' should be bold --- apps/app/components/issues/activity.tsx | 30 +++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/apps/app/components/issues/activity.tsx b/apps/app/components/issues/activity.tsx index ba116dfbb..1d8f66e09 100644 --- a/apps/app/components/issues/activity.tsx +++ b/apps/app/components/issues/activity.tsx @@ -145,9 +145,9 @@ export const IssueActivitySection: React.FC = () => { if (!issueLabels) return; const label = issueLabels.find((label) => label.id === labelId); if (typeof label !== "undefined") { - return label.color; + return label.color !== "" ? label.color : "#000000"; } - return "#64748b"; + return "#000000"; }; if (!issueActivities) { @@ -171,7 +171,7 @@ export const IssueActivitySection: React.FC = () => { return (
-
    +
      {issueActivities.map((activityItem, activityItemIdx) => { // determines what type of action is performed let action = activityDetails[activityItem.field as keyof typeof activityDetails]?.message; @@ -192,6 +192,18 @@ export const IssueActivitySection: React.FC = () => { activityItem.new_value && activityItem.new_value !== "" ? "set the due date to" : "removed the due date"; + } else if (activityItem.field === "parent") { + action = + activityItem.new_value && activityItem.new_value !== "" + ? "set the parent to" + : "removed the parent"; + } else if (activityItem.field === "priority") { + action = + activityItem.new_value && activityItem.new_value !== "" + ? "set the priority to" + : "removed the priority"; + } else if (activityItem.field === "description") { + action = "updated the"; } // for values that are after the action clause let value: any = activityItem.new_value ? activityItem.new_value : activityItem.old_value; @@ -204,8 +216,8 @@ export const IssueActivitySection: React.FC = () => { } else if (activityItem.field === "state") { value = activityItem.new_value ? addSpaceIfCamelCase(activityItem.new_value) : "None"; } else if (activityItem.field === "labels") { - let name, - id = "#64748b"; + let name; + let id = "#000000"; if (activityItem.new_value !== "") { name = activityItem.new_value; id = activityItem.new_identifier ? activityItem.new_identifier : id; @@ -231,9 +243,13 @@ export const IssueActivitySection: React.FC = () => { } else if (activityItem.field === "assignees") { value = activityItem.new_value; } else if (activityItem.field === "target_date") { - value = renderShortNumericDateFormat(activityItem.new_value as string); + const date = + activityItem.new_value && activityItem.new_value !== "" + ? activityItem.new_value + : activityItem.old_value; + value = renderShortNumericDateFormat(date as string); } else if (activityItem.field === "description") { - value = ""; + value = "description"; } if ("field" in activityItem && activityItem.field !== "updated_by") { From 4ab82b9616b5d21e95538535d086e8318b4fa660 Mon Sep 17 00:00:00 2001 From: Kunal Vishwakarma <116634168+kunalv17@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:03:25 +0530 Subject: [PATCH 02/22] fix: style and bugs (#644) * fix: style and bugs * fix: removed unnecessary classes --- apps/app/components/core/filter-list.tsx | 4 ++-- apps/app/components/icons/priority-icon.tsx | 2 +- apps/app/components/pages/delete-page-modal.tsx | 8 ++++---- apps/app/components/pages/single-page-detailed-item.tsx | 4 ++-- apps/app/components/pages/single-page-list-item.tsx | 4 ++-- apps/app/components/views/single-view-item.tsx | 2 +- .../[workspaceSlug]/projects/[projectId]/views/index.tsx | 6 +++++- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/app/components/core/filter-list.tsx b/apps/app/components/core/filter-list.tsx index afaefffdf..776a8f8a0 100644 --- a/apps/app/components/core/filter-list.tsx +++ b/apps/app/components/core/filter-list.tsx @@ -131,11 +131,11 @@ export const FilterList: React.FC = ({ filters, setFilters }) => { ? "bg-yellow-100 text-yellow-500 hover:bg-yellow-100" : priority === "low" ? "bg-green-100 text-green-500 hover:bg-green-100" - : "bg-gray-100" + : "bg-gray-100 text-gray-700 hover:bg-gray-100" }`} > {getPriorityIcon(priority)} - {priority} + {priority ? priority : "None"} diff --git a/apps/app/components/icons/priority-icon.tsx b/apps/app/components/icons/priority-icon.tsx index a6aa31249..0a888f802 100644 --- a/apps/app/components/icons/priority-icon.tsx +++ b/apps/app/components/icons/priority-icon.tsx @@ -1,5 +1,5 @@ export const getPriorityIcon = (priority: string | null, className?: string) => { - if (!className || className === "") className = "text-xs"; + if (!className || className === "") className = "text-xs flex items-center"; switch (priority) { case "urgent": diff --git a/apps/app/components/pages/delete-page-modal.tsx b/apps/app/components/pages/delete-page-modal.tsx index 94468f2b8..a92bb49b6 100644 --- a/apps/app/components/pages/delete-page-modal.tsx +++ b/apps/app/components/pages/delete-page-modal.tsx @@ -115,7 +115,7 @@ export const DeletePageModal: React.FC = ({ leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > - +
      @@ -130,9 +130,9 @@ export const DeletePageModal: React.FC = ({

      - Are you sure you want to delete Page - {`"`} - {data?.name} - {`"`} ? All of the data related to the page will be permanently removed. + Are you sure you want to delete Page- {" "} + {data?.name} + ? All of the data related to the page will be permanently removed. This action cannot be undone.

      diff --git a/apps/app/components/pages/single-page-detailed-item.tsx b/apps/app/components/pages/single-page-detailed-item.tsx index 4c9f045dc..47156ad92 100644 --- a/apps/app/components/pages/single-page-detailed-item.tsx +++ b/apps/app/components/pages/single-page-detailed-item.tsx @@ -89,13 +89,13 @@ export const SinglePageDetailedItem: React.FC = ({ )} - + Edit Page - + Delete Page diff --git a/apps/app/components/pages/single-page-list-item.tsx b/apps/app/components/pages/single-page-list-item.tsx index ecdd428b3..e4cc69147 100644 --- a/apps/app/components/pages/single-page-list-item.tsx +++ b/apps/app/components/pages/single-page-list-item.tsx @@ -102,7 +102,7 @@ export const SinglePageListItem: React.FC = ({ handleEditPage(); }} > - + Edit Page @@ -114,7 +114,7 @@ export const SinglePageListItem: React.FC = ({ handleDeletePage(); }} > - + Delete Page diff --git a/apps/app/components/views/single-view-item.tsx b/apps/app/components/views/single-view-item.tsx index 8b47d65c7..62e7eb840 100644 --- a/apps/app/components/views/single-view-item.tsx +++ b/apps/app/components/views/single-view-item.tsx @@ -115,7 +115,7 @@ export const SingleViewItem: React.FC = ({ setSelectedView(view); }} > - + Delete diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/views/index.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/views/index.tsx index 084a149ce..1ba31d5fa 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/views/index.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/views/index.tsx @@ -16,6 +16,9 @@ import AppLayout from "layouts/app-layout"; // ui import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs"; +//icons +import { PlusIcon } from "components/icons"; + // image import emptyView from "public/empty-state/empty-view.svg"; // fetching keys @@ -64,7 +67,8 @@ const ProjectViews: NextPage = (props) => { } right={
      - setIsCreateViewModalOpen(true)}> + setIsCreateViewModalOpen(true)}> + Create View
      From 13b2a6fd53133ead58789de399802086f1e6499c Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:03:35 +0530 Subject: [PATCH 03/22] fix: persist data on tab switch in workspace (#646) * fix: persist data on tab switch in workspace * fix: build fail --- apps/app/components/onboarding/workspace.tsx | 9 +++++- .../workspace/create-workspace-form.tsx | 32 ++++++++++++------- apps/app/pages/create-workspace.tsx | 11 ++++++- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/apps/app/components/onboarding/workspace.tsx b/apps/app/components/onboarding/workspace.tsx index 35453fc55..5ad6aedfb 100644 --- a/apps/app/components/onboarding/workspace.tsx +++ b/apps/app/components/onboarding/workspace.tsx @@ -25,6 +25,11 @@ type Props = { export const Workspace: React.FC = ({ setStep, setWorkspace }) => { const [isJoiningWorkspaces, setIsJoiningWorkspaces] = useState(false); const [invitationsRespond, setInvitationsRespond] = useState([]); + const [defaultValues, setDefaultValues] = useState({ + name: "", + slug: "", + company_size: null, + }); const { data: invitations, mutate } = useSWR(USER_WORKSPACE_INVITATIONS, () => workspaceService.userWorkspaceInvitations() @@ -99,11 +104,13 @@ export const Workspace: React.FC = ({ setStep, setWorkspace }) => { setWorkspace(res); setStep(3); }} + defaultValues={defaultValues} + setDefaultValues={setDefaultValues} />
      -
      +
      {invitations && invitations.length > 0 ? ( invitations.map((invitation) => (
      diff --git a/apps/app/components/workspace/create-workspace-form.tsx b/apps/app/components/workspace/create-workspace-form.tsx index c1555faa5..3f63dbf92 100644 --- a/apps/app/components/workspace/create-workspace-form.tsx +++ b/apps/app/components/workspace/create-workspace-form.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { Dispatch, SetStateAction, useEffect, useState } from "react"; import { mutate } from "swr"; @@ -19,15 +19,19 @@ import { COMPANY_SIZE } from "constants/workspace"; type Props = { onSubmit: (res: IWorkspace) => void; + defaultValues: { + name: string; + slug: string; + company_size: number | null; + }; + setDefaultValues: Dispatch>; }; -const defaultValues = { - name: "", - slug: "", - company_size: null, -}; - -export const CreateWorkspaceForm: React.FC = ({ onSubmit }) => { +export const CreateWorkspaceForm: React.FC = ({ + onSubmit, + defaultValues, + setDefaultValues, +}) => { const [slugError, setSlugError] = useState(false); const { setToastAlert } = useToast(); @@ -37,7 +41,7 @@ export const CreateWorkspaceForm: React.FC = ({ onSubmit }) => { handleSubmit, control, setValue, - reset, + getValues, formState: { errors, isSubmitting }, } = useForm({ defaultValues }); @@ -72,9 +76,13 @@ export const CreateWorkspaceForm: React.FC = ({ onSubmit }) => { }); }; - useEffect(() => { - reset(defaultValues); - }, [reset]); + useEffect( + () => () => { + // when the component unmounts set the default values to whatever user typed in + setDefaultValues(getValues()); + }, + [getValues, setDefaultValues] + ); return (
      { const router = useRouter(); + const defaultValues = { + name: "", + slug: "", + company_size: null, + }; return ( @@ -24,7 +29,11 @@ const CreateWorkspace: NextPage = () => {
      Plane Logo
      - router.push(`/${res.slug}`)} /> + {}} + onSubmit={(res) => router.push(`/${res.slug}`)} + />
      From 09e17858fe2dad45bac6d24913a373d6374c10b3 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:03:48 +0530 Subject: [PATCH 04/22] chore: remove edit and push issue from page block (#647) --- apps/app/components/pages/single-page-block.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/app/components/pages/single-page-block.tsx b/apps/app/components/pages/single-page-block.tsx index 315217895..f138c39f8 100644 --- a/apps/app/components/pages/single-page-block.tsx +++ b/apps/app/components/pages/single-page-block.tsx @@ -291,9 +291,9 @@ export const SinglePageBlock: React.FC = ({ block, projectDetails }) => { Push into issues - + {/* Edit and push into issues - + */} )} Delete block From 480e2c4d7f3c7da36f24b255b6004a716f420dd6 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:03:58 +0530 Subject: [PATCH 05/22] refactor: cycles toggle favorite (#648) --- .../components/cycles/single-cycle-card.tsx | 190 +++++++++--------- 1 file changed, 94 insertions(+), 96 deletions(-) diff --git a/apps/app/components/cycles/single-cycle-card.tsx b/apps/app/components/cycles/single-cycle-card.tsx index d6b1200a0..a5d2d3745 100644 --- a/apps/app/components/cycles/single-cycle-card.tsx +++ b/apps/app/components/cycles/single-cycle-card.tsx @@ -90,59 +90,58 @@ export const SingleCycleCard: React.FC = ({ const startDate = new Date(cycle.start_date ?? ""); const handleAddToFavorites = () => { - if (!workspaceSlug && !projectId && !cycle) return; + if (!workspaceSlug || !projectId || !cycle) return; + + const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date); + + switch (cycleStatus) { + case "current": + case "upcoming": + mutate( + CYCLE_CURRENT_AND_UPCOMING_LIST(projectId as string), + (prevData) => ({ + current_cycle: (prevData?.current_cycle ?? []).map((c) => ({ + ...c, + is_favorite: c.id === cycle.id ? true : c.is_favorite, + })), + upcoming_cycle: (prevData?.upcoming_cycle ?? []).map((c) => ({ + ...c, + is_favorite: c.id === cycle.id ? true : c.is_favorite, + })), + }), + false + ); + break; + case "completed": + mutate( + CYCLE_COMPLETE_LIST(projectId as string), + (prevData) => ({ + completed_cycles: (prevData?.completed_cycles ?? []).map((c) => ({ + ...c, + is_favorite: c.id === cycle.id ? true : c.is_favorite, + })), + }), + false + ); + break; + case "draft": + mutate( + CYCLE_DRAFT_LIST(projectId as string), + (prevData) => ({ + draft_cycles: (prevData?.draft_cycles ?? []).map((c) => ({ + ...c, + is_favorite: c.id === cycle.id ? true : c.is_favorite, + })), + }), + false + ); + break; + } cyclesService .addCycleToFavorites(workspaceSlug as string, projectId as string, { cycle: cycle.id, }) - .then(() => { - const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date); - - if (cycleStatus === "current" || cycleStatus === "upcoming") - mutate( - CYCLE_CURRENT_AND_UPCOMING_LIST(projectId as string), - (prevData) => ({ - current_cycle: (prevData?.current_cycle ?? []).map((c) => ({ - ...c, - is_favorite: c.id === cycle.id ? true : c.is_favorite, - })), - upcoming_cycle: (prevData?.upcoming_cycle ?? []).map((c) => ({ - ...c, - is_favorite: c.id === cycle.id ? true : c.is_favorite, - })), - }), - false - ); - else if (cycleStatus === "completed") - mutate( - CYCLE_COMPLETE_LIST(projectId as string), - (prevData) => ({ - completed_cycles: (prevData?.completed_cycles ?? []).map((c) => ({ - ...c, - is_favorite: c.id === cycle.id ? true : c.is_favorite, - })), - }), - false - ); - else - mutate( - CYCLE_DRAFT_LIST(projectId as string), - (prevData) => ({ - draft_cycles: (prevData?.draft_cycles ?? []).map((c) => ({ - ...c, - is_favorite: c.id === cycle.id ? true : c.is_favorite, - })), - }), - false - ); - - setToastAlert({ - type: "success", - title: "Success!", - message: "Successfully added the cycle to favorites.", - }); - }) .catch(() => { setToastAlert({ type: "error", @@ -153,57 +152,56 @@ export const SingleCycleCard: React.FC = ({ }; const handleRemoveFromFavorites = () => { - if (!workspaceSlug || !cycle) return; + if (!workspaceSlug || !projectId || !cycle) return; + + const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date); + + switch (cycleStatus) { + case "current": + case "upcoming": + mutate( + CYCLE_CURRENT_AND_UPCOMING_LIST(projectId as string), + (prevData) => ({ + current_cycle: (prevData?.current_cycle ?? []).map((c) => ({ + ...c, + is_favorite: c.id === cycle.id ? false : c.is_favorite, + })), + upcoming_cycle: (prevData?.upcoming_cycle ?? []).map((c) => ({ + ...c, + is_favorite: c.id === cycle.id ? false : c.is_favorite, + })), + }), + false + ); + break; + case "completed": + mutate( + CYCLE_COMPLETE_LIST(projectId as string), + (prevData) => ({ + completed_cycles: (prevData?.completed_cycles ?? []).map((c) => ({ + ...c, + is_favorite: c.id === cycle.id ? false : c.is_favorite, + })), + }), + false + ); + break; + case "draft": + mutate( + CYCLE_DRAFT_LIST(projectId as string), + (prevData) => ({ + draft_cycles: (prevData?.draft_cycles ?? []).map((c) => ({ + ...c, + is_favorite: c.id === cycle.id ? false : c.is_favorite, + })), + }), + false + ); + break; + } cyclesService .removeCycleFromFavorites(workspaceSlug as string, projectId as string, cycle.id) - .then(() => { - const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date); - - if (cycleStatus === "current" || cycleStatus === "upcoming") - mutate( - CYCLE_CURRENT_AND_UPCOMING_LIST(projectId as string), - (prevData) => ({ - current_cycle: (prevData?.current_cycle ?? []).map((c) => ({ - ...c, - is_favorite: c.id === cycle.id ? false : c.is_favorite, - })), - upcoming_cycle: (prevData?.upcoming_cycle ?? []).map((c) => ({ - ...c, - is_favorite: c.id === cycle.id ? false : c.is_favorite, - })), - }), - false - ); - else if (cycleStatus === "completed") - mutate( - CYCLE_COMPLETE_LIST(projectId as string), - (prevData) => ({ - completed_cycles: (prevData?.completed_cycles ?? []).map((c) => ({ - ...c, - is_favorite: c.id === cycle.id ? false : c.is_favorite, - })), - }), - false - ); - else - mutate( - CYCLE_DRAFT_LIST(projectId as string), - (prevData) => ({ - draft_cycles: (prevData?.draft_cycles ?? []).map((c) => ({ - ...c, - is_favorite: c.id === cycle.id ? false : c.is_favorite, - })), - }), - false - ); - - setToastAlert({ - type: "success", - title: "Success!", - message: "Successfully removed the cycle from favorites.", - }); - }) .catch(() => { setToastAlert({ type: "error", From e3005b7776a4776bd162befe7a4be363289f1740 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:04:17 +0530 Subject: [PATCH 06/22] fix: project identifier check in project settings (#649) --- .../projects/[projectId]/settings/index.tsx | 73 +++++++++---------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx index 21778bad3..072e70bad 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx @@ -68,16 +68,6 @@ const GeneralSettings: NextPage = ({ isMember, isOwner, isViewer, isGu defaultValues, }); - const checkIdentifier = (value: string) => { - if (!workspaceSlug) return; - - projectService - .checkProjectIdentifierAvailability(workspaceSlug as string, value) - .then((response) => { - if (response.exists) setError("identifier", { message: "Identifier already exists" }); - }); - }; - useEffect(() => { if (projectDetails) reset({ @@ -88,6 +78,33 @@ const GeneralSettings: NextPage = ({ isMember, isOwner, isViewer, isGu }); }, [projectDetails, reset]); + const updateProject = async (payload: Partial) => { + if (!workspaceSlug || !projectDetails) return; + + await projectService + .updateProject(workspaceSlug as string, projectDetails.id, payload) + .then((res) => { + mutate( + PROJECT_DETAILS(projectDetails.id), + (prevData) => ({ ...prevData, ...res }), + false + ); + mutate(PROJECTS_LIST(workspaceSlug as string)); + setToastAlert({ + type: "success", + title: "Success!", + message: "Project updated successfully", + }); + }) + .catch(() => { + setToastAlert({ + type: "error", + title: "Error!", + message: "Project could not be updated. Please try again.", + }); + }); + }; + const onSubmit = async (formData: IProject) => { if (!workspaceSlug || !projectDetails) return; @@ -101,34 +118,14 @@ const GeneralSettings: NextPage = ({ isMember, isOwner, isViewer, isGu icon: formData.icon, }; - await projectService - .checkProjectIdentifierAvailability(workspaceSlug as string, payload.identifier ?? "") - .then(async (res) => { - if (res.exists) setError("identifier", { message: "Identifier already exists" }); - else - await projectService - .updateProject(workspaceSlug as string, projectDetails.id, payload) - .then((res) => { - mutate( - PROJECT_DETAILS(projectDetails.id), - (prevData) => ({ ...prevData, ...res }), - false - ); - mutate(PROJECTS_LIST(workspaceSlug as string)); - setToastAlert({ - type: "success", - title: "Success!", - message: "Project updated successfully", - }); - }) - .catch(() => { - setToastAlert({ - type: "error", - title: "Error!", - message: "Project could not be updated. Please try again.", - }); - }); - }); + if (projectDetails.identifier !== formData.identifier) + await projectService + .checkProjectIdentifierAvailability(workspaceSlug as string, payload.identifier ?? "") + .then(async (res) => { + if (res.exists) setError("identifier", { message: "Identifier already exists" }); + else await updateProject(payload); + }); + else await updateProject(payload); }; return ( From e5507651c3e4645d240d143d318a6fa4a14fcdb8 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:04:36 +0530 Subject: [PATCH 07/22] fix: issue sidebar module , cycle and label dropdown fix (#650) --- .../issues/sidebar-select/cycle.tsx | 21 ++++++++++++------- .../issues/sidebar-select/module.tsx | 9 ++++++-- apps/app/components/issues/sidebar.tsx | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/apps/app/components/issues/sidebar-select/cycle.tsx b/apps/app/components/issues/sidebar-select/cycle.tsx index 4dcf16f77..9c72064e2 100644 --- a/apps/app/components/issues/sidebar-select/cycle.tsx +++ b/apps/app/components/issues/sidebar-select/cycle.tsx @@ -9,6 +9,8 @@ import issuesService from "services/issues.service"; import cyclesService from "services/cycles.service"; // ui import { Spinner, CustomSelect, Tooltip } from "components/ui"; +// helper +import { truncateText } from "helpers/string.helper"; // icons import { CyclesIcon } from "components/icons"; // types @@ -65,13 +67,15 @@ export const SidebarCycleSelect: React.FC = ({
      - {issueCycle ? issueCycle.cycle_detail.name : "None"} - + + + {issueCycle ? truncateText(issueCycle.cycle_detail.name, 15) : "None"} + + } value={issueCycle?.cycle_detail.id} onChange={(value: any) => { @@ -81,6 +85,7 @@ export const SidebarCycleSelect: React.FC = ({ }} width="w-full" position="right" + maxHeight="rg" disabled={isNotAllowed} > {incompleteCycles ? ( @@ -89,7 +94,7 @@ export const SidebarCycleSelect: React.FC = ({ {incompleteCycles.map((option) => ( - {option.name} + {truncateText(option.name, 15)} ))} diff --git a/apps/app/components/issues/sidebar-select/module.tsx b/apps/app/components/issues/sidebar-select/module.tsx index d860d0583..501b59df7 100644 --- a/apps/app/components/issues/sidebar-select/module.tsx +++ b/apps/app/components/issues/sidebar-select/module.tsx @@ -8,6 +8,8 @@ import useSWR, { mutate } from "swr"; import modulesService from "services/modules.service"; // ui import { Spinner, CustomSelect, Tooltip } from "components/ui"; +// helper +import { truncateText } from "helpers/string.helper"; // icons import { RectangleGroupIcon } from "@heroicons/react/24/outline"; // types @@ -64,13 +66,15 @@ export const SidebarModuleSelect: React.FC = ({
      m.id === issueModule?.module)?.name ?? "None"}`}> - {modules?.find((m) => m.id === issueModule?.module)?.name ?? "None"} + {truncateText(`${modules?.find((m) => m.id === issueModule?.module)?.name ?? "None"}`, 15)} + } value={issueModule?.module_detail?.id} onChange={(value: any) => { @@ -80,6 +84,7 @@ export const SidebarModuleSelect: React.FC = ({ }} width="w-full" position="right" + maxHeight="rg" disabled={isNotAllowed} > {modules ? ( @@ -88,7 +93,7 @@ export const SidebarModuleSelect: React.FC = ({ {modules.map((option) => ( - {option.name} + {truncateText(option.name, 15)} ))} diff --git a/apps/app/components/issues/sidebar.tsx b/apps/app/components/issues/sidebar.tsx index 79ad4cc44..d39b4158a 100644 --- a/apps/app/components/issues/sidebar.tsx +++ b/apps/app/components/issues/sidebar.tsx @@ -598,7 +598,7 @@ export const IssueDetailsSidebar: React.FC = ({ )}
      -
      +

      Links

      {!isNotAllowed && ( From a6f306209d30cb4da65a80dfb5dd2c40a36461af Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:04:51 +0530 Subject: [PATCH 08/22] fix: issue modal title textfield reset (#651) --- apps/app/components/issues/form.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/app/components/issues/form.tsx b/apps/app/components/issues/form.tsx index 35cff8472..800630c15 100644 --- a/apps/app/components/issues/form.tsx +++ b/apps/app/components/issues/form.tsx @@ -94,6 +94,7 @@ export const IssueForm: FC = ({ reset, watch, control, + getValues, setValue, setFocus, } = useForm({ @@ -272,7 +273,11 @@ export const IssueForm: FC = ({ /> setGptAssistantModal(false)} + handleClose={() => { + setGptAssistantModal(false); + // this is done so that the title do not reset after gpt popover closed + reset(getValues()); + }} inset="top-2 left-0" content="" htmlContent={watch("description_html")} From f6500914bed008a40f171cc44bac3467db3628c3 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:05:02 +0530 Subject: [PATCH 09/22] style: transfer issue modal empty state added (#652) --- .../cycles/transfer-issues-modal.tsx | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/app/components/cycles/transfer-issues-modal.tsx b/apps/app/components/cycles/transfer-issues-modal.tsx index 5227000d4..30441666b 100644 --- a/apps/app/components/cycles/transfer-issues-modal.tsx +++ b/apps/app/components/cycles/transfer-issues-modal.tsx @@ -12,7 +12,7 @@ import cyclesService from "services/cycles.service"; import useToast from "hooks/use-toast"; //icons import { MagnifyingGlassIcon, XMarkIcon } from "@heroicons/react/24/outline"; -import { ContrastIcon, CyclesIcon } from "components/icons"; +import { ContrastIcon, CyclesIcon, ExclamationIcon } from "components/icons"; // fetch-key import { CYCLE_INCOMPLETE_LIST } from "constants/fetch-keys"; // types @@ -31,7 +31,6 @@ export const TransferIssuesModal: React.FC = ({ isOpen, handleClose }) => const { setToastAlert } = useToast(); - const transferIssue = async (payload: any) => { await cyclesService .transferIssues(workspaceSlug as string, projectId as string, cycleId as string, payload) @@ -39,16 +38,14 @@ export const TransferIssuesModal: React.FC = ({ isOpen, handleClose }) => setToastAlert({ type: "success", title: "Issues transfered successfully", - message: - "Issues have been transferred successfully", + message: "Issues have been transferred successfully", }); }) .catch((err) => { setToastAlert({ type: "error", title: "Error!", - message: - "Issues cannot be transfer. Please try again.", + message: "Issues cannot be transfer. Please try again.", }); }); }; @@ -100,15 +97,15 @@ export const TransferIssuesModal: React.FC = ({ isOpen, handleClose }) => leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > - +
      -
      +

      Transfer Issues

      -
      +
      = ({ isOpen, handleClose }) => value={query} />
      -
      +
      {filteredOptions ? ( filteredOptions.length > 0 ? ( filteredOptions.map((option: ICycle) => ( @@ -136,7 +133,13 @@ export const TransferIssuesModal: React.FC = ({ isOpen, handleClose }) => )) ) : ( -

      No matching results

      +
      + + + You don’t have any current cycle. Please create one to transfer the + issues. + +
      ) ) : (

      Loading...

      From f074f9f003ca579ed8833b27c97fd24efa1e9a92 Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Fri, 31 Mar 2023 17:33:51 +0530 Subject: [PATCH 10/22] fix: graphs issue (#655) * fix: prevent y axis to have decimal * fix: add padding and labels to line chart --- apps/app/components/core/sidebar/progress-chart.tsx | 1 + apps/app/components/workspace/completed-issues-graph.tsx | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/app/components/core/sidebar/progress-chart.tsx b/apps/app/components/core/sidebar/progress-chart.tsx index b79b5fa89..bb3f7e059 100644 --- a/apps/app/components/core/sidebar/progress-chart.tsx +++ b/apps/app/components/core/sidebar/progress-chart.tsx @@ -80,6 +80,7 @@ const ProgressChart: React.FC = ({ issues, start, end }) => { tick={{ fontSize: "12px", fill: "#1f2937" }} tickSize={10} minTickGap={10} + allowDecimals={false} /> } /> = ({ month, issues, setMonth for (let i = 1; i <= weeks; i++) { data.push({ - week_in_month: i, + week_in_month: `Week ${i}`, completed_count: issues?.find((item) => item.week_in_month === i)?.completed_count ?? 0, }); } @@ -58,8 +58,8 @@ export const CompletedIssuesGraph: React.FC = ({ month, issues, setMonth
      - - + + } /> Date: Fri, 31 Mar 2023 17:52:20 +0530 Subject: [PATCH 11/22] fix: cycle status bug fix (#656) --- apps/app/helpers/date-time.helper.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/app/helpers/date-time.helper.ts b/apps/app/helpers/date-time.helper.ts index 820487d47..24ef2a7bf 100644 --- a/apps/app/helpers/date-time.helper.ts +++ b/apps/app/helpers/date-time.helper.ts @@ -92,16 +92,17 @@ export const timeAgo = (time: any) => { export const getDateRangeStatus = (startDate: string | null, endDate: string | null) => { if (!startDate || !endDate) return "draft"; - const now = new Date(); + const today = renderDateFormat(new Date()); + const now = new Date(today); const start = new Date(startDate); const end = new Date(endDate); - if (end < now) { - return "completed"; - } else if (start <= now && end >= now) { + if (start <= now && end >= now) { return "current"; - } else { + } else if (start > now) { return "upcoming"; + } else { + return "completed"; } }; @@ -170,4 +171,5 @@ export const renderShortTime = (date: string | Date) => { return hours + ":" + minutes; }; -export const isDateRangeValid = (startDate: string, endDate: string)=> new Date(startDate) < new Date(endDate); \ No newline at end of file +export const isDateRangeValid = (startDate: string, endDate: string) => + new Date(startDate) < new Date(endDate); From 844ae4869ac3bd67579208be85a11fb2c151ae8c Mon Sep 17 00:00:00 2001 From: Kunal Vishwakarma <116634168+kunalv17@users.noreply.github.com> Date: Fri, 31 Mar 2023 17:54:05 +0530 Subject: [PATCH 12/22] fix: view list link (#653) * fix: viewlist link * fix/removed side effects * fix: deadzones in the link --- .../project/confirm-project-member-remove.tsx | 8 +- .../components/states/delete-state-modal.tsx | 6 +- .../components/views/delete-view-modal.tsx | 8 +- .../app/components/views/single-view-item.tsx | 111 ++++++++++-------- .../confirm-workspace-member-remove.tsx | 8 +- 5 files changed, 76 insertions(+), 65 deletions(-) diff --git a/apps/app/components/project/confirm-project-member-remove.tsx b/apps/app/components/project/confirm-project-member-remove.tsx index 4ecb30218..646400cde 100644 --- a/apps/app/components/project/confirm-project-member-remove.tsx +++ b/apps/app/components/project/confirm-project-member-remove.tsx @@ -53,7 +53,7 @@ const ConfirmProjectMemberRemove: React.FC = ({ isOpen, onClose, data, ha leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > - +
      @@ -68,9 +68,9 @@ const ConfirmProjectMemberRemove: React.FC = ({ isOpen, onClose, data, ha

      - Are you sure you want to remove member - {`"`} - {data?.email} - {`"`} ? They will no longer have access to this project. This action + Are you sure you want to remove member- {" "} + {data?.email} + ? They will no longer have access to this project. This action cannot be undone.

      diff --git a/apps/app/components/states/delete-state-modal.tsx b/apps/app/components/states/delete-state-modal.tsx index 2496a28da..a3b09d0ec 100644 --- a/apps/app/components/states/delete-state-modal.tsx +++ b/apps/app/components/states/delete-state-modal.tsx @@ -104,7 +104,7 @@ export const DeleteStateModal: React.FC = ({ isOpen, onClose, data }) => leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > - +
      @@ -119,9 +119,9 @@ export const DeleteStateModal: React.FC = ({ isOpen, onClose, data }) =>

      - Are you sure you want to delete state - {`"`} + Are you sure you want to delete state- {" "} {data?.name} - {`"`} ? All of the data related to the state will be permanently removed. + ? All of the data related to the state will be permanently removed. This action cannot be undone.

      diff --git a/apps/app/components/views/delete-view-modal.tsx b/apps/app/components/views/delete-view-modal.tsx index c93ea1f92..7563cdf40 100644 --- a/apps/app/components/views/delete-view-modal.tsx +++ b/apps/app/components/views/delete-view-modal.tsx @@ -96,7 +96,7 @@ export const DeleteViewModal: React.FC = ({ isOpen, data, onClose, onSucc leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > - +
      @@ -111,9 +111,9 @@ export const DeleteViewModal: React.FC = ({ isOpen, data, onClose, onSucc

      - Are you sure you want to delete view - {`"`} - {data?.name} - {`?"`} All of the data related to the view will be permanently removed. + Are you sure you want to delete view- {" "} + {data?.name} + ? All of the data related to the view will be permanently removed. This action cannot be undone.

      diff --git a/apps/app/components/views/single-view-item.tsx b/apps/app/components/views/single-view-item.tsx index 62e7eb840..5b8bab19e 100644 --- a/apps/app/components/views/single-view-item.tsx +++ b/apps/app/components/views/single-view-item.tsx @@ -20,16 +20,11 @@ import { VIEWS_LIST } from "constants/fetch-keys"; import useToast from "hooks/use-toast"; type Props = { - view: IView, - setSelectedView: React.Dispatch>, + view: IView; + setSelectedView: React.Dispatch>; }; - -export const SingleViewItem: React.FC = ({ - view, - setSelectedView, -}) => { - +export const SingleViewItem: React.FC = ({ view, setSelectedView }) => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; @@ -86,47 +81,63 @@ export const SingleViewItem: React.FC = ({ }; return ( -
      -
      -
      -
      - - - {view.name} - -
      -
      - { - view.is_favorite ? ( - - ) : ( - - ) - } - - { - setSelectedView(view); - }} - > - - - Delete - - - + <> + +
      +
      +
      +
      + + {view.name} +
      +
      + {view.is_favorite ? ( + + ) : ( + + )} + + { + e.preventDefault(); + e.stopPropagation(); + setSelectedView(view); + }} + > + + + Delete + + + +
      +
      + {view?.description && ( +

      + {view.description} +

      + )}
      - {view?.description &&

      - {view.description} -

      } -
      -
      - ) -} + + + ); +}; diff --git a/apps/app/components/workspace/confirm-workspace-member-remove.tsx b/apps/app/components/workspace/confirm-workspace-member-remove.tsx index 0dee47008..c70c5c98d 100644 --- a/apps/app/components/workspace/confirm-workspace-member-remove.tsx +++ b/apps/app/components/workspace/confirm-workspace-member-remove.tsx @@ -53,7 +53,7 @@ const ConfirmWorkspaceMemberRemove: React.FC = ({ isOpen, onClose, data, leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > - +
      @@ -68,9 +68,9 @@ const ConfirmWorkspaceMemberRemove: React.FC = ({ isOpen, onClose, data,

      - Are you sure you want to remove member - {`"`} - {data?.email} - {`"`} ? They will no longer have access to this workspace. This action + Are you sure you want to remove member- {" "} + {data?.email} + ? They will no longer have access to this workspace. This action cannot be undone.

      From 448d8c63f3e385d18cc0c4669c02f1ba1b00ff65 Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Fri, 31 Mar 2023 18:03:42 +0530 Subject: [PATCH 13/22] fix: old labels must have black color in project settings (#657) --- apps/app/components/labels/labels-list-modal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app/components/labels/labels-list-modal.tsx b/apps/app/components/labels/labels-list-modal.tsx index 7c0d17742..55ea3edc8 100644 --- a/apps/app/components/labels/labels-list-modal.tsx +++ b/apps/app/components/labels/labels-list-modal.tsx @@ -146,7 +146,7 @@ export const LabelsListModal: React.FC = ({ isOpen, handleClose, parent } {label.name} From fae15348871fd529fd6caab832d2d8c3cdc4ae08 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Fri, 31 Mar 2023 18:29:24 +0530 Subject: [PATCH 14/22] fix: issues list flicker (#659) * fix: issues list flicker * fix: useeffect dependencies --- apps/app/components/core/issues-view.tsx | 44 ++++++++++-------------- apps/app/hooks/use-issues-view.tsx | 4 +-- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/apps/app/components/core/issues-view.tsx b/apps/app/components/core/issues-view.tsx index be1e92c99..364821a2d 100644 --- a/apps/app/components/core/issues-view.tsx +++ b/apps/app/components/core/issues-view.tsx @@ -29,22 +29,16 @@ import { RectangleStackIcon, TrashIcon, } from "@heroicons/react/24/outline"; -import { ExclamationIcon, getStateGroupIcon, TransferIcon } from "components/icons"; +import { ExclamationIcon, TransferIcon } from "components/icons"; // helpers import { getStatesList } from "helpers/state.helper"; // types -import { - CycleIssueResponse, - IIssue, - IIssueFilterOptions, - ModuleIssueResponse, - UserAuth, -} from "types"; +import { IIssue, IIssueFilterOptions, UserAuth } from "types"; // fetch-keys import { - CYCLE_ISSUES, + CYCLE_DETAILS, CYCLE_ISSUES_WITH_PARAMS, - MODULE_ISSUES, + MODULE_DETAILS, MODULE_ISSUES_WITH_PARAMS, PROJECT_ISSUES_LIST_WITH_PARAMS, STATE_LIST, @@ -266,8 +260,14 @@ export const IssuesView: React.FC = ({ sort_order: draggedItem.sort_order, }) .then(() => { - if (cycleId) mutate(CYCLE_ISSUES(cycleId as string)); - if (moduleId) mutate(MODULE_ISSUES(moduleId as string)); + if (cycleId) { + mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params)); + mutate(CYCLE_DETAILS(cycleId as string)); + } + if (moduleId) { + mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); + mutate(MODULE_DETAILS(moduleId as string)); + } mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params)); }); } @@ -322,13 +322,9 @@ export const IssuesView: React.FC = ({ const removeIssueFromCycle = useCallback( (bridgeId: string) => { - if (!workspaceSlug || !projectId) return; + if (!workspaceSlug || !projectId || !cycleId) return; - mutate( - CYCLE_ISSUES(cycleId as string), - (prevData) => prevData?.filter((p) => p.id !== bridgeId), - false - ); + mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params)); issuesService .removeIssueFromCycle( @@ -344,18 +340,14 @@ export const IssuesView: React.FC = ({ console.log(e); }); }, - [workspaceSlug, projectId, cycleId] + [workspaceSlug, projectId, cycleId, params] ); const removeIssueFromModule = useCallback( (bridgeId: string) => { - if (!workspaceSlug || !projectId) return; + if (!workspaceSlug || !projectId || !moduleId) return; - mutate( - MODULE_ISSUES(moduleId as string), - (prevData) => prevData?.filter((p) => p.id !== bridgeId), - false - ); + mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); modulesService .removeIssueFromModule( @@ -371,7 +363,7 @@ export const IssuesView: React.FC = ({ console.log(e); }); }, - [workspaceSlug, projectId, moduleId] + [workspaceSlug, projectId, moduleId, params] ); const handleTrashBox = useCallback( diff --git a/apps/app/hooks/use-issues-view.tsx b/apps/app/hooks/use-issues-view.tsx index 92e2d695c..377f078e1 100644 --- a/apps/app/hooks/use-issues-view.tsx +++ b/apps/app/hooks/use-issues-view.tsx @@ -118,14 +118,14 @@ const useIssuesView = () => { [key: string]: IIssue[]; } | undefined = useMemo(() => { - const issuesToGroup = cycleIssues ?? moduleIssues ?? projectIssues; + const issuesToGroup = cycleId ? cycleIssues : moduleId ? moduleIssues : projectIssues; if (Array.isArray(issuesToGroup)) return { allIssues: issuesToGroup }; if (groupByProperty === "state") return issuesToGroup ? Object.assign(emptyStatesObject, issuesToGroup) : undefined; return issuesToGroup; - }, [projectIssues, cycleIssues, moduleIssues, groupByProperty]); + }, [projectIssues, cycleIssues, moduleIssues, groupByProperty, cycleId, moduleId]); const isEmpty = Object.values(groupedByIssues ?? {}).every((group) => group.length === 0) || From d596e41d4dc1810cc1bb59da85435199606b220c Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 31 Mar 2023 18:30:39 +0530 Subject: [PATCH 15/22] fix: project setting control fix (#658) * fix: project setting control fix * fix: project member endpoint fix --- .../projects/[projectId]/settings/control.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/control.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/control.tsx index 5151a2a9f..7491e09f0 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/control.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/control.tsx @@ -12,7 +12,6 @@ import { requiredAdmin } from "lib/auth"; import AppLayout from "layouts/app-layout"; // services import projectService from "services/project.service"; -import workspaceService from "services/workspace.service"; // hooks import useToast from "hooks/use-toast"; // ui @@ -22,7 +21,7 @@ import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs"; import { IProject, IWorkspace } from "types"; import type { NextPage, GetServerSidePropsContext } from "next"; // fetch-keys -import { PROJECTS_LIST, PROJECT_DETAILS, WORKSPACE_MEMBERS } from "constants/fetch-keys"; +import { PROJECTS_LIST, PROJECT_DETAILS, PROJECT_MEMBERS } from "constants/fetch-keys"; type TControlSettingsProps = { isMember: boolean; @@ -53,8 +52,10 @@ const ControlSettings: NextPage = (props) => { ); const { data: people } = useSWR( - workspaceSlug ? WORKSPACE_MEMBERS : null, - workspaceSlug ? () => workspaceService.workspaceMembers(workspaceSlug as string) : null + workspaceSlug && projectId ? PROJECT_MEMBERS(projectId as string) : null, + workspaceSlug && projectId + ? () => projectService.projectMembers(workspaceSlug as string, projectId as string) + : null ); const { @@ -101,7 +102,6 @@ const ControlSettings: NextPage = (props) => { console.log(err); }); }; - return ( = (props) => { > {people?.map((person) => ( @@ -200,7 +200,7 @@ const ControlSettings: NextPage = (props) => { > {people?.map((person) => ( From abe34ad7b1747359b4f8bd204ab1c0611c52443a Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Fri, 31 Mar 2023 18:31:01 +0530 Subject: [PATCH 16/22] fix: add scroll into view when editing label in settings page (#660) --- .../labels/create-update-label-inline.tsx | 19 ++++++++++--------- .../projects/[projectId]/settings/labels.tsx | 19 ++++++++++++++++--- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/apps/app/components/labels/create-update-label-inline.tsx b/apps/app/components/labels/create-update-label-inline.tsx index a58da94ac..24db3ab38 100644 --- a/apps/app/components/labels/create-update-label-inline.tsx +++ b/apps/app/components/labels/create-update-label-inline.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import React, { forwardRef, useEffect } from "react"; import { useRouter } from "next/router"; @@ -31,12 +31,12 @@ const defaultValues: Partial = { color: "#ff0000", }; -export const CreateUpdateLabelInline: React.FC = ({ - labelForm, - setLabelForm, - isUpdating, - labelToUpdate, -}) => { +type Ref = HTMLDivElement; + +export const CreateUpdateLabelInline = forwardRef(function CreateUpdateLabelInline( + { labelForm, setLabelForm, isUpdating, labelToUpdate }, + ref +) { const router = useRouter(); const { workspaceSlug, projectId } = router.query; @@ -109,9 +109,10 @@ export const CreateUpdateLabelInline: React.FC = ({ return (
      @@ -187,4 +188,4 @@ export const CreateUpdateLabelInline: React.FC = ({ )}
      ); -}; +}); diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx index 7044162b3..534409ec4 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/labels.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState, useRef } from "react"; import { useRouter } from "next/router"; @@ -46,6 +46,8 @@ const LabelsSettings: NextPage = (props) => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; + const scollToRef = useRef(null); + const { data: projectDetails } = useSWR( workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null, workspaceSlug && projectId @@ -128,6 +130,7 @@ const LabelsSettings: NextPage = (props) => { setLabelForm={setLabelForm} isUpdating={isUpdating} labelToUpdate={labelToUpdate} + ref={scollToRef} /> )} <> @@ -142,7 +145,12 @@ const LabelsSettings: NextPage = (props) => { key={label.id} label={label} addLabelToGroup={() => addLabelToGroup(label)} - editLabel={editLabel} + editLabel={(label) => { + editLabel(label); + scollToRef.current?.scrollIntoView({ + behavior: "smooth", + }); + }} handleLabelDelete={handleLabelDelete} /> ); @@ -153,7 +161,12 @@ const LabelsSettings: NextPage = (props) => { label={label} labelChildren={children} addLabelToGroup={addLabelToGroup} - editLabel={editLabel} + editLabel={(label) => { + editLabel(label); + scollToRef.current?.scrollIntoView({ + behavior: "smooth", + }); + }} handleLabelDelete={handleLabelDelete} /> ); From 6055f5c4ee5fb3898179b82e3303e9c0ef1c30b6 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 31 Mar 2023 18:31:21 +0530 Subject: [PATCH 17/22] fix: cycle list page mutation fix (#661) * fix: cycle list page mutation fix * fix: cycle mutation fix --- apps/app/components/cycles/modal.tsx | 21 ++++++++++++++++++++- apps/app/helpers/date-time.helper.ts | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/apps/app/components/cycles/modal.tsx b/apps/app/components/cycles/modal.tsx index d73d667eb..19311cd08 100644 --- a/apps/app/components/cycles/modal.tsx +++ b/apps/app/components/cycles/modal.tsx @@ -77,7 +77,7 @@ export const CreateUpdateCycleModal: React.FC = ({ await cycleService .updateCycle(workspaceSlug as string, projectId as string, cycleId, payload) .then((res) => { - switch (getDateRangeStatus(res.start_date, res.end_date)) { + switch (getDateRangeStatus(data?.start_date, data?.end_date)) { case "completed": mutate(CYCLE_COMPLETE_LIST(projectId as string)); break; @@ -90,6 +90,25 @@ export const CreateUpdateCycleModal: React.FC = ({ default: mutate(CYCLE_DRAFT_LIST(projectId as string)); } + if ( + getDateRangeStatus(data?.start_date, data?.end_date) != + getDateRangeStatus(res.start_date, res.end_date) + ) { + switch (getDateRangeStatus(res.start_date, res.end_date)) { + case "completed": + mutate(CYCLE_COMPLETE_LIST(projectId as string)); + break; + case "current": + mutate(CYCLE_CURRENT_AND_UPCOMING_LIST(projectId as string)); + break; + case "upcoming": + mutate(CYCLE_CURRENT_AND_UPCOMING_LIST(projectId as string)); + break; + default: + mutate(CYCLE_DRAFT_LIST(projectId as string)); + } + } + handleClose(); setToastAlert({ diff --git a/apps/app/helpers/date-time.helper.ts b/apps/app/helpers/date-time.helper.ts index 24ef2a7bf..397e87c9d 100644 --- a/apps/app/helpers/date-time.helper.ts +++ b/apps/app/helpers/date-time.helper.ts @@ -89,7 +89,7 @@ export const timeAgo = (time: any) => { return time; }; -export const getDateRangeStatus = (startDate: string | null, endDate: string | null) => { +export const getDateRangeStatus = (startDate: string | null | undefined, endDate: string | null | undefined) => { if (!startDate || !endDate) return "draft"; const today = renderDateFormat(new Date()); From 567966459bc18a53ceb5ce8c73a9dc80a22342af Mon Sep 17 00:00:00 2001 From: Kunal Vishwakarma <116634168+kunalv17@users.noreply.github.com> Date: Fri, 31 Mar 2023 18:31:44 +0530 Subject: [PATCH 18/22] style: added icons to ellipses in project settings label (#662) --- .../components/labels/single-label-group.tsx | 41 +++++++++++++++---- apps/app/components/labels/single-label.tsx | 19 +++++++-- .../projects/[projectId]/settings/members.tsx | 7 +++- 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/apps/app/components/labels/single-label-group.tsx b/apps/app/components/labels/single-label-group.tsx index f4320e97e..d41b8508e 100644 --- a/apps/app/components/labels/single-label-group.tsx +++ b/apps/app/components/labels/single-label-group.tsx @@ -11,7 +11,14 @@ import issuesService from "services/issues.service"; // ui import { CustomMenu } from "components/ui"; // icons -import { ChevronDownIcon, RectangleGroupIcon } from "@heroicons/react/24/outline"; +import { + ChevronDownIcon, + RectangleGroupIcon, + XMarkIcon, + PlusIcon, + PencilIcon, + TrashIcon, +} from "@heroicons/react/24/outline"; // types import { IIssueLabels } from "types"; // fetch-keys @@ -72,11 +79,22 @@ export const SingleLabelGroup: React.FC = ({
      addLabelToGroup(label)}> - Add more labels + + + Add more labels + + + editLabel(label)}> + + + Edit label + - editLabel(label)}>Edit handleLabelDelete(label.id)}> - Delete + + + Delete label + @@ -117,13 +135,22 @@ export const SingleLabelGroup: React.FC = ({
      removeFromGroup(child)}> - Remove from group + + + Remove from group + editLabel(child)}> - Edit + + + Edit label + handleLabelDelete(child.id)}> - Delete + + + Delete label +
      diff --git a/apps/app/components/labels/single-label.tsx b/apps/app/components/labels/single-label.tsx index 0bef9ee35..201d97d58 100644 --- a/apps/app/components/labels/single-label.tsx +++ b/apps/app/components/labels/single-label.tsx @@ -4,6 +4,8 @@ import React from "react"; import { CustomMenu } from "components/ui"; // types import { IIssueLabels } from "types"; +//icons +import { RectangleGroupIcon, LinkIcon, PencilIcon, TrashIcon } from "@heroicons/react/24/outline"; type Props = { label: IIssueLabels; @@ -31,11 +33,22 @@ export const SingleLabel: React.FC = ({
      addLabelToGroup(label)}> - Convert to group + + + Convert to group + + + editLabel(label)}> + + + Edit label + - editLabel(label)}>Edit handleLabelDelete(label.id)}> - Delete + + + Delete label +
      diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx index 0bbb56b83..c090b9b6c 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/members.tsx @@ -21,7 +21,7 @@ import SendProjectInvitationModal from "components/project/send-project-invitati import { CustomMenu, CustomSelect, Loader } from "components/ui"; import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs"; // icons -import { PlusIcon } from "@heroicons/react/24/outline"; +import { PlusIcon, XMarkIcon } from "@heroicons/react/24/outline"; // types import type { NextPage, GetServerSidePropsContext } from "next"; import { UserAuth } from "types"; @@ -261,7 +261,10 @@ const MembersSettings: NextPage = ({ isMember, isOwner, isViewer, isGu else setSelectedInviteRemoveMember(member.id); }} > - Remove member + + + Remove member +
      From c940641ba197be07558d8ebc009ac51a0791d4a9 Mon Sep 17 00:00:00 2001 From: Kunal Vishwakarma <116634168+kunalv17@users.noreply.github.com> Date: Fri, 31 Mar 2023 19:27:07 +0530 Subject: [PATCH 19/22] Fix: view list bugs (#654) * fix: viewlist link * fix/removed side effects * fix: deadzones in the link From 9f34f41982ee638a2053eb3b9ed3b0ed385b525f Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 31 Mar 2023 21:20:23 +0530 Subject: [PATCH 20/22] feat: list and kanban view group by header icon (#665) --- .../core/board-view/board-header.tsx | 38 +++++++++++++++-- .../components/core/list-view/single-list.tsx | 42 +++++++++++++++---- 2 files changed, 69 insertions(+), 11 deletions(-) diff --git a/apps/app/components/core/board-view/board-header.tsx b/apps/app/components/core/board-view/board-header.tsx index 6b8986093..b9aab7bb4 100644 --- a/apps/app/components/core/board-view/board-header.tsx +++ b/apps/app/components/core/board-view/board-header.tsx @@ -9,9 +9,11 @@ import issuesService from "services/issues.service"; import projectService from "services/project.service"; // hooks import useIssuesView from "hooks/use-issues-view"; +// component +import { Avatar } from "components/ui"; // icons import { ArrowsPointingInIcon, ArrowsPointingOutIcon, PlusIcon } from "@heroicons/react/24/outline"; -import { getStateGroupIcon } from "components/icons"; +import { getPriorityIcon, getStateGroupIcon } from "components/icons"; // helpers import { addSpaceIfCamelCase } from "helpers/string.helper"; // types @@ -89,9 +91,39 @@ export const BoardHeader: React.FC = ({ return title; }; + const getGroupIcon = () => { + let icon; + + switch (selectedGroup) { + case "state": + icon = currentState && getStateGroupIcon(currentState.group, "18", "18", bgColor); + break; + case "priority": + icon = getPriorityIcon(groupTitle, "h-[18px] w-[18px] flex items-center"); + break; + case "labels": + const labelColor = + issueLabels?.find((label) => label.id === groupTitle)?.color ?? "#000000"; + icon = ( + + ); + break; + case "created_by": + const member = members?.find((member) => member.member.id === groupTitle)?.member; + icon = ; + + break; + } + + return icon; + }; + return (
      @@ -101,7 +133,7 @@ export const BoardHeader: React.FC = ({ !isCollapsed ? "mb-2 flex-col gap-y-2 py-2" : "" }`} > - {currentState && getStateGroupIcon(currentState.group, "18", "18", bgColor)} + {getGroupIcon()}

      = ({ return title; }; + const getGroupIcon = () => { + let icon; + + switch (selectedGroup) { + case "state": + icon = currentState && getStateGroupIcon(currentState.group, "18", "18", bgColor); + break; + case "priority": + icon = getPriorityIcon(groupTitle, "h-[18px] w-[18px] flex items-center"); + break; + case "labels": + const labelColor = + issueLabels?.find((label) => label.id === groupTitle)?.color ?? "#000000"; + icon = ( + + ); + break; + case "created_by": + const member = members?.find((member) => member.member.id === groupTitle)?.member; + icon = ; + + break; + } + + return icon; + }; + return ( {({ open }) => ( @@ -110,12 +140,8 @@ export const SingleList: React.FC = ({ >
      - {selectedGroup !== null && selectedGroup === "state" ? ( - - {currentState && getStateGroupIcon(currentState.group, "16", "16", bgColor)} - - ) : ( - "" + {selectedGroup !== null && ( + {getGroupIcon()} )} {selectedGroup !== null ? (

      From c0bf7783b1e83a4b587a605f1b45e988cf79a423 Mon Sep 17 00:00:00 2001 From: Saheb Giri <47132373+iamsahebgiri@users.noreply.github.com> Date: Fri, 31 Mar 2023 23:00:28 +0530 Subject: [PATCH 21/22] style: designed user activity. (#666) --- apps/app/components/core/feeds.tsx | 277 ++++++++++++++++++ apps/app/components/core/index.ts | 1 + .../[workspaceSlug]/me/profile/activity.tsx | 21 +- 3 files changed, 282 insertions(+), 17 deletions(-) create mode 100644 apps/app/components/core/feeds.tsx diff --git a/apps/app/components/core/feeds.tsx b/apps/app/components/core/feeds.tsx new file mode 100644 index 000000000..9cd1e28d9 --- /dev/null +++ b/apps/app/components/core/feeds.tsx @@ -0,0 +1,277 @@ +import React from "react"; +import Image from "next/image"; + +// icons +import { + ArrowTopRightOnSquareIcon, + CalendarDaysIcon, + ChartBarIcon, + ChatBubbleBottomCenterTextIcon, + ChatBubbleLeftEllipsisIcon, + RectangleGroupIcon, + Squares2X2Icon, + UserIcon, +} from "@heroicons/react/24/outline"; +import { BlockedIcon, BlockerIcon, CyclesIcon, TagIcon, UserGroupIcon } from "components/icons"; +// helpers +import { renderShortNumericDateFormat, timeAgo } from "helpers/date-time.helper"; +import { addSpaceIfCamelCase } from "helpers/string.helper"; +// types +import RemirrorRichTextEditor from "components/rich-text-editor"; +import Link from "next/link"; + +const activityDetails: { + [key: string]: { + message?: string; + icon: JSX.Element; + }; +} = { + assignee: { + message: "removed the assignee", + icon: