Skip to content

Commit f77f4b8

Browse files
authored
fix: gantt sidebar links (#3940)
1 parent 5c4c3f5 commit f77f4b8

File tree

3 files changed

+22
-26
lines changed

3 files changed

+22
-26
lines changed

web/components/cycles/gantt-chart/blocks.tsx

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Link from "next/link";
12
import { observer } from "mobx-react";
23
import { useRouter } from "next/router";
34
// hooks
@@ -33,12 +34,12 @@ export const CycleGanttBlock: React.FC<Props> = observer((props) => {
3334
cycleStatus === "current"
3435
? "#09a953"
3536
: cycleStatus === "upcoming"
36-
? "#f7ae59"
37-
: cycleStatus === "completed"
38-
? "#3f76ff"
39-
: cycleStatus === "draft"
40-
? "rgb(var(--color-text-200))"
41-
: "",
37+
? "#f7ae59"
38+
: cycleStatus === "completed"
39+
? "#3f76ff"
40+
: cycleStatus === "draft"
41+
? "rgb(var(--color-text-200))"
42+
: "",
4243
}}
4344
onClick={() => router.push(`/${workspaceSlug}/projects/${cycleDetails?.project_id}/cycles/${cycleDetails?.id}`)}
4445
>
@@ -63,8 +64,6 @@ export const CycleGanttBlock: React.FC<Props> = observer((props) => {
6364

6465
export const CycleGanttSidebarBlock: React.FC<Props> = observer((props) => {
6566
const { cycleId } = props;
66-
// router
67-
const router = useRouter();
6867
// store hooks
6968
const {
7069
router: { workspaceSlug },
@@ -76,25 +75,25 @@ export const CycleGanttSidebarBlock: React.FC<Props> = observer((props) => {
7675
const cycleStatus = cycleDetails?.status.toLocaleLowerCase();
7776

7877
return (
79-
<div
78+
<Link
8079
className="relative flex h-full w-full items-center gap-2"
81-
onClick={() => router.push(`/${workspaceSlug}/projects/${cycleDetails?.project_id}/cycles/${cycleDetails?.id}`)}
80+
href={`/${workspaceSlug}/projects/${cycleDetails?.project_id}/cycles/${cycleDetails?.id}`}
8281
>
8382
<ContrastIcon
8483
className="h-5 w-5 flex-shrink-0"
8584
color={`${
8685
cycleStatus === "current"
8786
? "#09a953"
8887
: cycleStatus === "upcoming"
89-
? "#f7ae59"
90-
: cycleStatus === "completed"
91-
? "#3f76ff"
92-
: cycleStatus === "draft"
93-
? "rgb(var(--color-text-200))"
94-
: ""
88+
? "#f7ae59"
89+
: cycleStatus === "completed"
90+
? "#3f76ff"
91+
: cycleStatus === "draft"
92+
? "rgb(var(--color-text-200))"
93+
: ""
9594
}`}
9695
/>
9796
<h6 className="flex-grow truncate text-sm font-medium">{cycleDetails?.name}</h6>
98-
</div>
97+
</Link>
9998
);
10099
});

web/components/gantt-chart/chart/views/month.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const MonthChartView: FC<any> = observer(() => {
1919
{monthBlocks?.map((block, rootIndex) => (
2020
<div key={`month-${block?.month}-${block?.year}`} className="relative flex flex-col">
2121
<div
22-
className="w-full sticky top-0 z-[5] bg-custom-background-100"
22+
className="w-full sticky top-0 z-[5] bg-custom-background-100 flex-shrink-0"
2323
style={{
2424
height: `${HEADER_HEIGHT}px`,
2525
}}
@@ -55,7 +55,7 @@ export const MonthChartView: FC<any> = observer(() => {
5555
))}
5656
</div>
5757
</div>
58-
<div className="h-full w-full flex divide-x divide-custom-border-100/50">
58+
<div className="h-full w-full flex-grow flex divide-x divide-custom-border-100/50">
5959
{block?.children?.map((monthDay, index) => (
6060
<div
6161
key={`column-${rootIndex}-${index}`}

web/components/modules/gantt-chart/blocks.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Link from "next/link";
12
import { observer } from "mobx-react";
23
import { useRouter } from "next/router";
34
// hooks
@@ -54,8 +55,6 @@ export const ModuleGanttBlock: React.FC<Props> = observer((props) => {
5455

5556
export const ModuleGanttSidebarBlock: React.FC<Props> = observer((props) => {
5657
const { moduleId } = props;
57-
// router
58-
const router = useRouter();
5958
// store hooks
6059
const {
6160
router: { workspaceSlug },
@@ -65,14 +64,12 @@ export const ModuleGanttSidebarBlock: React.FC<Props> = observer((props) => {
6564
const moduleDetails = getModuleById(moduleId);
6665

6766
return (
68-
<div
67+
<Link
6968
className="relative flex h-full w-full items-center gap-2"
70-
onClick={() =>
71-
router.push(`/${workspaceSlug}/projects/${moduleDetails?.project_id}/modules/${moduleDetails?.id}`)
72-
}
69+
href={`/${workspaceSlug}/projects/${moduleDetails?.project_id}/modules/${moduleDetails?.id}`}
7370
>
7471
<ModuleStatusIcon status={moduleDetails?.status ?? "backlog"} height="16px" width="16px" />
7572
<h6 className="flex-grow truncate text-sm font-medium">{moduleDetails?.name}</h6>
76-
</div>
73+
</Link>
7774
);
7875
});

0 commit comments

Comments
 (0)