From cf8c902473cf3a5f1fdffd7d0a4a605072186a5d Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Tue, 20 Jun 2023 16:32:02 +0530 Subject: [PATCH] chore: update cycle and module stats logic (#1323) * refactor: cycles stats * chore: show assignee avatar in stats * chore: cycles and modules sidebar stats refactor * fix: build errors --- .../command-palette/change-issue-assignee.tsx | 2 +- .../command-palette/change-issue-priority.tsx | 2 +- .../command-palette/change-issue-state.tsx | 2 +- .../core/board-view/single-issue.tsx | 3 - .../core/sidebar/progress-chart.tsx | 52 ++--- .../core/sidebar/sidebar-progress-stats.tsx | 216 ++++++++---------- .../core/sidebar/single-progress-stats.tsx | 7 +- .../cycles/active-cycle-details.tsx | 130 +++++------ .../components/cycles/active-cycle-stats.tsx | 150 +++++------- apps/app/components/cycles/sidebar.tsx | 50 ++-- apps/app/components/modules/sidebar.tsx | 20 +- apps/app/components/ui/avatar.tsx | 2 +- .../projects/[projectId]/cycles/index.tsx | 20 +- .../[projectId]/modules/[moduleId].tsx | 9 +- apps/app/types/cycles.d.ts | 28 +++ apps/app/types/modules.d.ts | 5 + 16 files changed, 297 insertions(+), 401 deletions(-) diff --git a/apps/app/components/command-palette/change-issue-assignee.tsx b/apps/app/components/command-palette/change-issue-assignee.tsx index 56351335e..1021623db 100644 --- a/apps/app/components/command-palette/change-issue-assignee.tsx +++ b/apps/app/components/command-palette/change-issue-assignee.tsx @@ -80,7 +80,7 @@ export const ChangeIssueAssignee: React.FC = ({ setIsPaletteOpen, issue, console.error(e); }); }, - [workspaceSlug, issueId, projectId] + [workspaceSlug, issueId, projectId, user] ); const handleIssueAssignees = (assignee: string) => { diff --git a/apps/app/components/command-palette/change-issue-priority.tsx b/apps/app/components/command-palette/change-issue-priority.tsx index 2db03268d..07ba210a6 100644 --- a/apps/app/components/command-palette/change-issue-priority.tsx +++ b/apps/app/components/command-palette/change-issue-priority.tsx @@ -51,7 +51,7 @@ export const ChangeIssuePriority: React.FC = ({ setIsPaletteOpen, issue, console.error(e); }); }, - [workspaceSlug, issueId, projectId] + [workspaceSlug, issueId, projectId, user] ); const handleIssueState = (priority: string | null) => { diff --git a/apps/app/components/command-palette/change-issue-state.tsx b/apps/app/components/command-palette/change-issue-state.tsx index 0378df878..00c9745be 100644 --- a/apps/app/components/command-palette/change-issue-state.tsx +++ b/apps/app/components/command-palette/change-issue-state.tsx @@ -63,7 +63,7 @@ export const ChangeIssueState: React.FC = ({ setIsPaletteOpen, issue, use console.error(e); }); }, - [workspaceSlug, issueId, projectId, mutateIssueDetails] + [workspaceSlug, issueId, projectId, mutateIssueDetails, user] ); const handleIssueState = (stateId: string) => { diff --git a/apps/app/components/core/board-view/single-issue.tsx b/apps/app/components/core/board-view/single-issue.tsx index 072a5113a..003be9e94 100644 --- a/apps/app/components/core/board-view/single-issue.tsx +++ b/apps/app/components/core/board-view/single-issue.tsx @@ -181,9 +181,6 @@ export const SingleBoardIssue: React.FC = ({ mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); mutate(MODULE_DETAILS(moduleId as string)); } else mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params)); - }) - .catch((error) => { - console.log(error); }); }, [ diff --git a/apps/app/components/core/sidebar/progress-chart.tsx b/apps/app/components/core/sidebar/progress-chart.tsx index 93e11f762..e6349bfe5 100644 --- a/apps/app/components/core/sidebar/progress-chart.tsx +++ b/apps/app/components/core/sidebar/progress-chart.tsx @@ -3,16 +3,15 @@ import React from "react"; // ui import { LineGraph } from "components/ui"; // helpers -import { getDatesInRange, renderShortNumericDateFormat } from "helpers/date-time.helper"; +import { renderShortNumericDateFormat } from "helpers/date-time.helper"; //types -import { IIssue } from "types"; +import { TCompletionChartDistribution } from "types"; type Props = { - issues: IIssue[]; - start: string; - end: string; - width?: number; - height?: number; + distribution: TCompletionChartDistribution; + startDate: string | Date; + endDate: string | Date; + totalIssues: number; }; const styleById = { @@ -41,32 +40,11 @@ const DashedLine = ({ series, lineGenerator, xScale, yScale }: any) => /> )); -const ProgressChart: React.FC = ({ issues, start, end }) => { - const startDate = new Date(start); - const endDate = new Date(end); - - const getChartData = () => { - const dateRangeArray = getDatesInRange(startDate, endDate); - let count = 0; - - const dateWiseData = dateRangeArray.map((d) => { - const current = d.toISOString().split("T")[0]; - const total = issues.length; - const currentData = issues.filter( - (i) => i.completed_at && i.completed_at.toString().split("T")[0] === current - ); - count = currentData ? currentData.length + count : count; - - return { - currentDate: renderShortNumericDateFormat(current), - currentDateData: currentData, - pending: new Date(current) < new Date() ? total - count : null, - }; - }); - return dateWiseData; - }; - - const chartData = getChartData(); +const ProgressChart: React.FC = ({ distribution, startDate, endDate, totalIssues }) => { + const chartData = Object.keys(distribution).map((key) => ({ + currentDate: renderShortNumericDateFormat(key), + pending: distribution[key], + })); return (
@@ -74,7 +52,7 @@ const ProgressChart: React.FC = ({ issues, start, end }) => { animate curve="monotoneX" height="160px" - width="360px" + width="100%" enableGridY={false} lineWidth={1} margin={{ top: 30, right: 30, bottom: 30, left: 30 }} @@ -97,7 +75,7 @@ const ProgressChart: React.FC = ({ issues, start, end }) => { data: [ { x: chartData[0].currentDate, - y: issues.length, + y: totalIssues, }, { x: chartData[chartData.length - 1].currentDate, @@ -113,10 +91,10 @@ const ProgressChart: React.FC = ({ issues, start, end }) => { enablePoints={false} enableArea colors={(datum) => datum.color ?? "#3F76FF"} - customYAxisTickValues={[0, issues.length]} + customYAxisTickValues={[0, totalIssues]} gridXValues={chartData.map((item, index) => (index % 2 === 0 ? item.currentDate : ""))} theme={{ - background: "rgb(var(--color-bg-sidebar))", + background: "transparent", axis: { domain: { line: { diff --git a/apps/app/components/core/sidebar/sidebar-progress-stats.tsx b/apps/app/components/core/sidebar/sidebar-progress-stats.tsx index 140a49aab..b90f4e3ee 100644 --- a/apps/app/components/core/sidebar/sidebar-progress-stats.tsx +++ b/apps/app/components/core/sidebar/sidebar-progress-stats.tsx @@ -1,15 +1,7 @@ import React from "react"; -import Image from "next/image"; -import { useRouter } from "next/router"; - -import useSWR from "swr"; - // headless ui import { Tab } from "@headlessui/react"; -// services -import issuesServices from "services/issues.service"; -import projectService from "services/project.service"; // hooks import useLocalStorage from "hooks/use-local-storage"; import useIssuesView from "hooks/use-issues-view"; @@ -17,61 +9,43 @@ import useIssuesView from "hooks/use-issues-view"; import { SingleProgressStats } from "components/core"; // ui import { Avatar } from "components/ui"; -// icons -import User from "public/user.png"; // types -import { IIssue, IIssueLabels, IModule, UserAuth } from "types"; -// fetch-keys -import { PROJECT_ISSUE_LABELS, PROJECT_MEMBERS } from "constants/fetch-keys"; +import { + IModule, + TAssigneesDistribution, + TCompletionChartDistribution, + TLabelsDistribution, +} from "types"; +// constants +import { STATE_GROUP_COLORS } from "constants/state"; // types type Props = { - groupedIssues: any; - issues: IIssue[]; + distribution: { + assignees: TAssigneesDistribution[]; + completion_chart: TCompletionChartDistribution; + labels: TLabelsDistribution[]; + }; + groupedIssues: { + [key: string]: number; + }; + totalIssues: number; module?: IModule; - userAuth?: UserAuth; roundedTab?: boolean; noBackground?: boolean; }; -const stateGroupColours: { - [key: string]: string; -} = { - backlog: "#3f76ff", - unstarted: "#ff9e9e", - started: "#d687ff", - cancelled: "#ff5353", - completed: "#096e8d", -}; - export const SidebarProgressStats: React.FC = ({ + distribution, groupedIssues, - issues, + totalIssues, module, - userAuth, roundedTab, noBackground, }) => { - const router = useRouter(); - const { workspaceSlug, projectId } = router.query; - const { filters, setFilters } = useIssuesView(); const { storedValue: tab, setValue: setTab } = useLocalStorage("tab", "Assignees"); - const { data: issueLabels } = useSWR( - workspaceSlug && projectId ? PROJECT_ISSUE_LABELS(projectId as string) : null, - workspaceSlug && projectId - ? () => issuesServices.getIssueLabels(workspaceSlug as string, projectId as string) - : null - ); - - const { data: members } = useSWR( - workspaceSlug && projectId ? PROJECT_MEMBERS(workspaceSlug as string) : null, - workspaceSlug && projectId - ? () => projectService.projectMembers(workspaceSlug as string, projectId as string) - : null - ); - const currentValue = (tab: string | null) => { switch (tab) { case "Assignees": @@ -85,6 +59,7 @@ export const SidebarProgressStats: React.FC = ({ return 0; } }; + return ( = ({ - - {members?.map((member, index) => { - const totalArray = issues?.filter((i) => i?.assignees?.includes(member.member.id)); - const completeArray = totalArray?.filter((i) => i.state_detail.group === "completed"); - - if (totalArray.length > 0) { - return ( - - - {member.member.first_name} - - } - completed={completeArray.length} - total={totalArray.length} - onClick={() => { - if (filters?.assignees?.includes(member.member.id)) - setFilters({ - assignees: filters?.assignees?.filter((a) => a !== member.member.id), - }); - else - setFilters({ assignees: [...(filters?.assignees ?? []), member.member.id] }); - }} - selected={filters?.assignees?.includes(member.member.id)} - /> - ); - } - })} - {issues?.filter((i) => i?.assignees?.length === 0).length > 0 ? ( - -
- User -
- No assignee - - } - completed={ - issues?.filter( - (i) => i?.state_detail.group === "completed" && i.assignees?.length === 0 - ).length - } - total={issues?.filter((i) => i?.assignees?.length === 0).length} - /> - ) : ( - "" - )} -
- {issueLabels?.map((label, index) => { - const totalArray = issues?.filter((i) => i?.labels?.includes(label.id)); - const completeArray = totalArray?.filter((i) => i?.state_detail.group === "completed"); - - if (totalArray.length > 0) { + {distribution.assignees.map((assignee, index) => { + if (assignee.assignee_id) return ( - - {label?.name} + {assignee.first_name}
} - completed={completeArray.length} - total={totalArray.length} + completed={assignee.completed_issues} + total={assignee.total_issues} onClick={() => { - if (filters.labels?.includes(label.id)) + if (filters?.assignees?.includes(assignee.assignee_id ?? "")) setFilters({ - labels: filters?.labels?.filter((l) => l !== label.id), + assignees: filters?.assignees?.filter((a) => a !== assignee.assignee_id), + }); + else + setFilters({ + assignees: [...(filters?.assignees ?? []), assignee.assignee_id ?? ""], }); - else setFilters({ labels: [...(filters?.labels ?? []), label.id] }); }} - selected={filters?.labels?.includes(label.id)} + selected={filters?.assignees?.includes(assignee.assignee_id ?? "")} + /> + ); + else + return ( + +
+ User +
+ No assignee + + } + completed={assignee.completed_issues} + total={assignee.total_issues} /> ); - } })} - + + {distribution.labels.map((label, index) => ( + + + {label.label_name ?? "No labels"} + + } + completed={label.completed_issues} + total={label.total_issues} + onClick={() => { + if (filters.labels?.includes(label.label_id ?? "")) + setFilters({ + labels: filters?.labels?.filter((l) => l !== label.label_id), + }); + else setFilters({ labels: [...(filters?.labels ?? []), label.label_id ?? ""] }); + }} + selected={filters?.labels?.includes(label.label_id ?? "")} + /> + ))} + + {Object.keys(groupedIssues).map((group, index) => ( = ({ {group} } completed={groupedIssues[group]} - total={issues.length} + total={totalIssues} /> ))} diff --git a/apps/app/components/core/sidebar/single-progress-stats.tsx b/apps/app/components/core/sidebar/single-progress-stats.tsx index d8236de9b..7c7f65446 100644 --- a/apps/app/components/core/sidebar/single-progress-stats.tsx +++ b/apps/app/components/core/sidebar/single-progress-stats.tsx @@ -23,10 +23,10 @@ export const SingleProgressStats: React.FC = ({ } ${selected ? "bg-brand-surface-1" : ""}`} onClick={onClick} > -
{title}
+
{title}
- + @@ -36,8 +36,7 @@ export const SingleProgressStats: React.FC = ({ %
- of - {total} + of {total}
); diff --git a/apps/app/components/cycles/active-cycle-details.tsx b/apps/app/components/cycles/active-cycle-details.tsx index 21f37e5a6..5a0c1cb58 100644 --- a/apps/app/components/cycles/active-cycle-details.tsx +++ b/apps/app/components/cycles/active-cycle-details.tsx @@ -10,7 +10,7 @@ import cyclesService from "services/cycles.service"; // hooks import useToast from "hooks/use-toast"; // ui -import { LinearProgressIndicator, Tooltip } from "components/ui"; +import { LinearProgressIndicator, Loader, Tooltip } from "components/ui"; import { AssigneesList } from "components/ui/avatar"; import { SingleProgressStats } from "components/core"; // components @@ -43,10 +43,6 @@ import { ICycle, IIssue } from "types"; // fetch-keys import { CURRENT_CYCLE_LIST, CYCLES_LIST, CYCLE_ISSUES_WITH_PARAMS } from "constants/fetch-keys"; -type TSingleStatProps = { - cycle: ICycle; -}; - const stateGroups = [ { key: "backlog_issues", @@ -75,12 +71,43 @@ const stateGroups = [ }, ]; -export const ActiveCycleDetails: React.FC = ({ cycle }) => { +export const ActiveCycleDetails: React.FC = () => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; const { setToastAlert } = useToast(); + const { data: currentCycle } = useSWR( + workspaceSlug && projectId ? CURRENT_CYCLE_LIST(projectId as string) : null, + workspaceSlug && projectId + ? () => + cyclesService.getCyclesWithParams(workspaceSlug as string, projectId as string, "current") + : null + ); + const cycle = currentCycle ? currentCycle[0] : null; + + const { data: issues } = useSWR( + workspaceSlug && projectId && cycle?.id + ? CYCLE_ISSUES_WITH_PARAMS(cycle?.id, { priority: "urgent,high" }) + : null, + workspaceSlug && projectId && cycle?.id + ? () => + cyclesService.getCycleIssuesWithParams( + workspaceSlug as string, + projectId as string, + cycle.id, + { priority: "urgent,high" } + ) + : null + ) as { data: IIssue[] | undefined }; + + if (!cycle) + return ( +
+

No active cycle is present.

+
+ ); + const endDate = new Date(cycle.end_date ?? ""); const startDate = new Date(cycle.start_date ?? ""); @@ -164,21 +191,6 @@ export const ActiveCycleDetails: React.FC = ({ cycle }) => { }); }; - const { data: issues } = useSWR( - workspaceSlug && projectId && cycle.id - ? CYCLE_ISSUES_WITH_PARAMS(cycle.id, { priority: "high" }) - : null, - workspaceSlug && projectId && cycle.id - ? () => - cyclesService.getCycleIssuesWithParams( - workspaceSlug as string, - projectId as string, - cycle.id, - { priority: "high" } - ) - : null - ) as { data: IIssue[] }; - const progressIndicatorData = stateGroups.map((group, index) => ({ id: index, name: group.title, @@ -193,7 +205,7 @@ export const ActiveCycleDetails: React.FC = ({ cycle }) => {
- +
@@ -373,19 +385,17 @@ export const ActiveCycleDetails: React.FC = ({ cycle }) => {
- +
-
High Priority Issues
- -
- {issues - ?.filter((issue) => issue.priority === "urgent" || issue.priority === "high") - .map((issue) => ( +
High Priority Issues
+
+ {issues ? ( + issues.map((issue) => (
= ({ cycle }) => {
{getPriorityIcon(issue.priority, "text-sm")} @@ -455,7 +459,7 @@ export const ActiveCycleDetails: React.FC = ({ cycle }) => { Array.isArray(issue.assignees) ? (
@@ -466,7 +470,14 @@ export const ActiveCycleDetails: React.FC = ({ cycle }) => {
- ))} + )) + ) : ( + + + + + + )}
@@ -478,33 +489,17 @@ export const ActiveCycleDetails: React.FC = ({ cycle }) => { width: issues && `${ - (issues?.filter( - (issue) => - issue?.state_detail?.group === "completed" && - (issue?.priority === "urgent" || issue?.priority === "high") - )?.length / - issues?.filter( - (issue) => issue?.priority === "urgent" || issue?.priority === "high" - )?.length) * + (issues.filter((issue) => issue?.state_detail?.group === "completed") + ?.length / + issues.length) * 100 ?? 0 }%`, }} />
- { - issues?.filter( - (issue) => - issue?.state_detail?.group === "completed" && - (issue?.priority === "urgent" || issue?.priority === "high") - )?.length - }{" "} - of{" "} - { - issues?.filter( - (issue) => issue?.priority === "urgent" || issue?.priority === "high" - )?.length - } + {issues?.filter((issue) => issue?.state_detail?.group === "completed")?.length} of{" "} + {issues?.length}
@@ -512,11 +507,11 @@ export const ActiveCycleDetails: React.FC = ({ cycle }) => {
- + Ideal
- + Current
@@ -532,11 +527,10 @@ export const ActiveCycleDetails: React.FC = ({ cycle }) => {
diff --git a/apps/app/components/cycles/active-cycle-stats.tsx b/apps/app/components/cycles/active-cycle-stats.tsx index bc04a4bd9..a01293d43 100644 --- a/apps/app/components/cycles/active-cycle-stats.tsx +++ b/apps/app/components/cycles/active-cycle-stats.tsx @@ -1,14 +1,7 @@ import React from "react"; -import { useRouter } from "next/router"; - -import useSWR from "swr"; - // headless ui import { Tab } from "@headlessui/react"; -// services -import issuesServices from "services/issues.service"; -import projectService from "services/project.service"; // hooks import useLocalStorage from "hooks/use-local-storage"; // components @@ -16,34 +9,15 @@ import { SingleProgressStats } from "components/core"; // ui import { Avatar } from "components/ui"; // types -import { IIssue, IIssueLabels } from "types"; -// fetch-keys -import { PROJECT_ISSUE_LABELS, PROJECT_MEMBERS } from "constants/fetch-keys"; +import { ICycle } from "types"; // types type Props = { - issues: IIssue[]; + cycle: ICycle; }; -export const ActiveCycleProgressStats: React.FC = ({ issues }) => { - const router = useRouter(); - const { workspaceSlug, projectId } = router.query; - +export const ActiveCycleProgressStats: React.FC = ({ cycle }) => { const { storedValue: tab, setValue: setTab } = useLocalStorage("activeCycleTab", "Assignees"); - const { data: issueLabels } = useSWR( - workspaceSlug && projectId ? PROJECT_ISSUE_LABELS(projectId as string) : null, - workspaceSlug && projectId - ? () => issuesServices.getIssueLabels(workspaceSlug as string, projectId as string) - : null - ); - - const { data: members } = useSWR( - workspaceSlug && projectId ? PROJECT_MEMBERS(workspaceSlug as string) : null, - workspaceSlug && projectId - ? () => projectService.projectMembers(workspaceSlug as string, projectId as string) - : null - ); - const currentValue = (tab: string | null) => { switch (tab) { case "Assignees": @@ -55,6 +29,7 @@ export const ActiveCycleProgressStats: React.FC = ({ issues }) => { return 0; } }; + return ( = ({ issues }) => { as="div" className="flex flex-col w-full mt-2 gap-1 overflow-y-scroll items-center text-brand-secondary" > - {members?.map((member, index) => { - const totalArray = issues?.filter((i) => i?.assignees?.includes(member.member.id)); - const completeArray = totalArray?.filter((i) => i.state_detail.group === "completed"); - - if (totalArray.length > 0) { + {cycle.distribution.assignees.map((assignee, index) => { + if (assignee.assignee_id) return ( - - {member.member.first_name} + + {assignee.first_name}
} - completed={completeArray.length} - total={totalArray.length} + completed={assignee.completed_issues} + total={assignee.total_issues} + /> + ); + else + return ( + +
+ User +
+ No assignee + + } + completed={assignee.completed_issues} + total={assignee.total_issues} /> ); - } })} - {issues?.filter((i) => i?.assignees?.length === 0).length > 0 ? ( - -
- User -
- No assignee - - } - completed={ - issues?.filter( - (i) => i?.state_detail.group === "completed" && i.assignees?.length === 0 - ).length - } - total={issues?.filter((i) => i?.assignees?.length === 0).length} - /> - ) : ( - "" - )}
- {issueLabels?.map((label, index) => { - const totalArray = issues?.filter((i) => i?.labels?.includes(label.id)); - const completeArray = totalArray?.filter((i) => i?.state_detail.group === "completed"); - - if (totalArray.length > 0) { - return ( - - - {label?.name} - - } - completed={completeArray.length} - total={totalArray.length} - /> - ); - } - })} + {cycle.distribution.labels.map((label, index) => ( + + + {label.label_name ?? "No labels"} + + } + completed={label.completed_issues} + total={label.total_issues} + /> + ))} diff --git a/apps/app/components/cycles/sidebar.tsx b/apps/app/components/cycles/sidebar.tsx index 2cb5b9fcb..d61bd1943 100644 --- a/apps/app/components/cycles/sidebar.tsx +++ b/apps/app/components/cycles/sidebar.tsx @@ -2,11 +2,22 @@ import React, { useEffect, useState } from "react"; import { useRouter } from "next/router"; -import useSWR, { mutate } from "swr"; +import { mutate } from "swr"; // react-hook-form import { useForm } from "react-hook-form"; +// headless ui import { Disclosure, Popover, Transition } from "@headlessui/react"; +// services +import cyclesService from "services/cycles.service"; +// hooks +import useToast from "hooks/use-toast"; +// components +import { SidebarProgressStats } from "components/core"; +import ProgressChart from "components/core/sidebar/progress-chart"; +import { DeleteCycleModal } from "components/cycles"; +// ui +import { CustomMenu, CustomRangeDatePicker, Loader, ProgressBar } from "components/ui"; // icons import { CalendarDaysIcon, @@ -18,17 +29,6 @@ import { DocumentIcon, LinkIcon, } from "@heroicons/react/24/outline"; -// ui -import { CustomMenu, CustomRangeDatePicker, Loader, ProgressBar } from "components/ui"; -// hooks -import useToast from "hooks/use-toast"; -// services -import cyclesService from "services/cycles.service"; -// components -import { SidebarProgressStats } from "components/core"; -import ProgressChart from "components/core/sidebar/progress-chart"; -import { DeleteCycleModal } from "components/cycles"; -// icons import { ExclamationIcon } from "components/icons"; // helpers import { capitalizeFirstLetter, copyTextToClipboard } from "helpers/string.helper"; @@ -38,9 +38,9 @@ import { renderShortDate, } from "helpers/date-time.helper"; // types -import { ICurrentUserResponse, ICycle, IIssue } from "types"; +import { ICurrentUserResponse, ICycle } from "types"; // fetch-keys -import { CYCLE_DETAILS, CYCLE_ISSUES } from "constants/fetch-keys"; +import { CYCLE_DETAILS } from "constants/fetch-keys"; type Props = { cycle: ICycle | undefined; @@ -69,18 +69,6 @@ export const CycleDetailsSidebar: React.FC = ({ end_date: new Date().toString(), }; - const { data: issues } = useSWR( - workspaceSlug && projectId && cycleId ? CYCLE_ISSUES(cycleId as string) : null, - workspaceSlug && projectId && cycleId - ? () => - cyclesService.getCycleIssues( - workspaceSlug as string, - projectId as string, - cycleId as string - ) - : null - ); - const { setValue, reset, watch } = useForm({ defaultValues, }); @@ -553,9 +541,10 @@ export const CycleDetailsSidebar: React.FC = ({
@@ -604,7 +593,7 @@ export const CycleDetailsSidebar: React.FC = ({ {cycle.total_issues > 0 ? (
= ({ completed: cycle.completed_issues, cancelled: cycle.cancelled_issues, }} + totalIssues={cycle.total_issues} />
) : ( diff --git a/apps/app/components/modules/sidebar.tsx b/apps/app/components/modules/sidebar.tsx index f453e4c68..de8714968 100644 --- a/apps/app/components/modules/sidebar.tsx +++ b/apps/app/components/modules/sidebar.tsx @@ -52,20 +52,13 @@ const defaultValues: Partial = { }; type Props = { - issues: IIssue[]; module?: IModule; isOpen: boolean; moduleIssues?: IIssue[]; user: ICurrentUserResponse | undefined; }; -export const ModuleDetailsSidebar: React.FC = ({ - issues, - module, - isOpen, - moduleIssues, - user, -}) => { +export const ModuleDetailsSidebar: React.FC = ({ module, isOpen, moduleIssues, user }) => { const [moduleDeleteModal, setModuleDeleteModal] = useState(false); const [moduleLinkModal, setModuleLinkModal] = useState(false); @@ -464,9 +457,10 @@ export const ModuleDetailsSidebar: React.FC = ({
@@ -517,7 +511,7 @@ export const ModuleDetailsSidebar: React.FC = ({ <>
= ({ completed: module.completed_issues, cancelled: module.cancelled_issues, }} - userAuth={memberRole} + totalIssues={module.total_issues} module={module} />
diff --git a/apps/app/components/ui/avatar.tsx b/apps/app/components/ui/avatar.tsx index 06534c121..c91541aaa 100644 --- a/apps/app/components/ui/avatar.tsx +++ b/apps/app/components/ui/avatar.tsx @@ -13,7 +13,7 @@ import { IUser, IUserLite } from "types"; import { WORKSPACE_MEMBERS } from "constants/fetch-keys"; type AvatarProps = { - user?: Partial | Partial | IUser | IUserLite | undefined | null; + user?: Partial | Partial | null; index?: number; height?: string; width?: string; diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx index 2bd2aa1b9..502578927 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/cycles/index.tsx @@ -32,7 +32,7 @@ import { ListBulletIcon, PlusIcon, Squares2X2Icon } from "@heroicons/react/24/ou import { SelectCycleType } from "types"; import type { NextPage } from "next"; // fetch-keys -import { CURRENT_CYCLE_LIST, PROJECT_DETAILS } from "constants/fetch-keys"; +import { PROJECT_DETAILS } from "constants/fetch-keys"; const tabsList = ["All", "Active", "Upcoming", "Completed", "Drafts"]; @@ -72,14 +72,6 @@ const ProjectCycles: NextPage = () => { : null ); - const { data: currentCycle } = useSWR( - workspaceSlug && projectId ? CURRENT_CYCLE_LIST(projectId as string) : null, - workspaceSlug && projectId - ? () => - cycleService.getCyclesWithParams(workspaceSlug as string, projectId as string, "current") - : null - ); - useEffect(() => { if (createUpdateCycleModal) return; const timer = setTimeout(() => { @@ -201,15 +193,7 @@ const ProjectCycles: NextPage = () => { {cyclesView !== "gantt_chart" && ( - {currentCycle?.[0] ? ( - - ) : ( -
-

- No active cycle is present. -

-
- )} +
)} diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/modules/[moduleId].tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/modules/[moduleId].tsx index 657f48fe2..d63af5865 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/modules/[moduleId].tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/modules/[moduleId].tsx @@ -5,13 +5,7 @@ import { useRouter } from "next/router"; import useSWR, { mutate } from "swr"; // icons -import { - ArrowLeftIcon, - ListBulletIcon, - PlusIcon, - RectangleGroupIcon, - RectangleStackIcon, -} from "@heroicons/react/24/outline"; +import { ArrowLeftIcon, RectangleGroupIcon } from "@heroicons/react/24/outline"; // services import modulesService from "services/modules.service"; import issuesService from "services/issues.service"; @@ -191,7 +185,6 @@ const SingleModule: React.FC = () => {