fix: gantt sidebar links (#3940)

This commit is contained in:
Aaryan Khandelwal 2024-03-12 19:07:12 +05:30 committed by GitHub
parent 5c4c3f5c04
commit f77f4b8221
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 26 deletions

View File

@ -1,3 +1,4 @@
import Link from "next/link";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
// hooks // hooks
@ -63,8 +64,6 @@ export const CycleGanttBlock: React.FC<Props> = observer((props) => {
export const CycleGanttSidebarBlock: React.FC<Props> = observer((props) => { export const CycleGanttSidebarBlock: React.FC<Props> = observer((props) => {
const { cycleId } = props; const { cycleId } = props;
// router
const router = useRouter();
// store hooks // store hooks
const { const {
router: { workspaceSlug }, router: { workspaceSlug },
@ -76,9 +75,9 @@ export const CycleGanttSidebarBlock: React.FC<Props> = observer((props) => {
const cycleStatus = cycleDetails?.status.toLocaleLowerCase(); const cycleStatus = cycleDetails?.status.toLocaleLowerCase();
return ( return (
<div <Link
className="relative flex h-full w-full items-center gap-2" className="relative flex h-full w-full items-center gap-2"
onClick={() => router.push(`/${workspaceSlug}/projects/${cycleDetails?.project_id}/cycles/${cycleDetails?.id}`)} href={`/${workspaceSlug}/projects/${cycleDetails?.project_id}/cycles/${cycleDetails?.id}`}
> >
<ContrastIcon <ContrastIcon
className="h-5 w-5 flex-shrink-0" className="h-5 w-5 flex-shrink-0"
@ -95,6 +94,6 @@ export const CycleGanttSidebarBlock: React.FC<Props> = observer((props) => {
}`} }`}
/> />
<h6 className="flex-grow truncate text-sm font-medium">{cycleDetails?.name}</h6> <h6 className="flex-grow truncate text-sm font-medium">{cycleDetails?.name}</h6>
</div> </Link>
); );
}); });

View File

@ -19,7 +19,7 @@ export const MonthChartView: FC<any> = observer(() => {
{monthBlocks?.map((block, rootIndex) => ( {monthBlocks?.map((block, rootIndex) => (
<div key={`month-${block?.month}-${block?.year}`} className="relative flex flex-col"> <div key={`month-${block?.month}-${block?.year}`} className="relative flex flex-col">
<div <div
className="w-full sticky top-0 z-[5] bg-custom-background-100" className="w-full sticky top-0 z-[5] bg-custom-background-100 flex-shrink-0"
style={{ style={{
height: `${HEADER_HEIGHT}px`, height: `${HEADER_HEIGHT}px`,
}} }}
@ -55,7 +55,7 @@ export const MonthChartView: FC<any> = observer(() => {
))} ))}
</div> </div>
</div> </div>
<div className="h-full w-full flex divide-x divide-custom-border-100/50"> <div className="h-full w-full flex-grow flex divide-x divide-custom-border-100/50">
{block?.children?.map((monthDay, index) => ( {block?.children?.map((monthDay, index) => (
<div <div
key={`column-${rootIndex}-${index}`} key={`column-${rootIndex}-${index}`}

View File

@ -1,3 +1,4 @@
import Link from "next/link";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
// hooks // hooks
@ -54,8 +55,6 @@ export const ModuleGanttBlock: React.FC<Props> = observer((props) => {
export const ModuleGanttSidebarBlock: React.FC<Props> = observer((props) => { export const ModuleGanttSidebarBlock: React.FC<Props> = observer((props) => {
const { moduleId } = props; const { moduleId } = props;
// router
const router = useRouter();
// store hooks // store hooks
const { const {
router: { workspaceSlug }, router: { workspaceSlug },
@ -65,14 +64,12 @@ export const ModuleGanttSidebarBlock: React.FC<Props> = observer((props) => {
const moduleDetails = getModuleById(moduleId); const moduleDetails = getModuleById(moduleId);
return ( return (
<div <Link
className="relative flex h-full w-full items-center gap-2" className="relative flex h-full w-full items-center gap-2"
onClick={() => href={`/${workspaceSlug}/projects/${moduleDetails?.project_id}/modules/${moduleDetails?.id}`}
router.push(`/${workspaceSlug}/projects/${moduleDetails?.project_id}/modules/${moduleDetails?.id}`)
}
> >
<ModuleStatusIcon status={moduleDetails?.status ?? "backlog"} height="16px" width="16px" /> <ModuleStatusIcon status={moduleDetails?.status ?? "backlog"} height="16px" width="16px" />
<h6 className="flex-grow truncate text-sm font-medium">{moduleDetails?.name}</h6> <h6 className="flex-grow truncate text-sm font-medium">{moduleDetails?.name}</h6>
</div> </Link>
); );
}); });