-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Gantt chart layout (#3585)
* chore: gantt sidebar and main content scroll sync * chore: add arrow navigation position logic * refactor: scroll position update logic * refactor: gantt chart components * refactor: gantt sidebar * fix: vertical scroll issue * fix: move to the hidden block button flickering * refactor: gantt sidebar components * chore: move timeline header outside * fix gantt scroll issue * fix: sticky position issues * fix: infinite timeline scroll logic * chore: removed unnecessary import statements --------- Co-authored-by: rahulramesha <[email protected]>
- Loading branch information
1 parent
3eb819c
commit 963d26c
Showing
36 changed files
with
1,035 additions
and
829 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from "./blocks-display"; | ||
export * from "./blocks-list"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Expand, Shrink } from "lucide-react"; | ||
// hooks | ||
import { useChart } from "../hooks"; | ||
// helpers | ||
import { cn } from "helpers/common.helper"; | ||
// types | ||
import { IGanttBlock, TGanttViews } from "../types"; | ||
|
||
type Props = { | ||
blocks: IGanttBlock[] | null; | ||
fullScreenMode: boolean; | ||
handleChartView: (view: TGanttViews) => void; | ||
handleToday: () => void; | ||
loaderTitle: string; | ||
title: string; | ||
toggleFullScreenMode: () => void; | ||
}; | ||
|
||
export const GanttChartHeader: React.FC<Props> = (props) => { | ||
const { blocks, fullScreenMode, handleChartView, handleToday, loaderTitle, title, toggleFullScreenMode } = props; | ||
// chart hook | ||
const { currentView, allViews } = useChart(); | ||
|
||
return ( | ||
<div className="relative flex w-full flex-shrink-0 flex-wrap items-center gap-2 whitespace-nowrap px-2.5 py-2 z-10"> | ||
<div className="flex items-center gap-2 text-lg font-medium">{title}</div> | ||
<div className="ml-auto"> | ||
<div className="ml-auto text-sm font-medium">{blocks ? `${blocks.length} ${loaderTitle}` : "Loading..."}</div> | ||
</div> | ||
|
||
<div className="flex flex-wrap items-center gap-2"> | ||
{allViews?.map((chartView: any) => ( | ||
<div | ||
key={chartView?.key} | ||
className={cn("cursor-pointer rounded-sm p-1 px-2 text-xs", { | ||
"bg-custom-background-80": currentView === chartView?.key, | ||
"hover:bg-custom-background-90": currentView !== chartView?.key, | ||
})} | ||
onClick={() => handleChartView(chartView?.key)} | ||
> | ||
{chartView?.title} | ||
</div> | ||
))} | ||
</div> | ||
|
||
<button type="button" className="rounded-sm p-1 px-2 text-xs hover:bg-custom-background-80" onClick={handleToday}> | ||
Today | ||
</button> | ||
|
||
<button | ||
type="button" | ||
className="flex items-center justify-center rounded-sm border border-custom-border-200 p-1 transition-all hover:bg-custom-background-80" | ||
onClick={toggleFullScreenMode} | ||
> | ||
{fullScreenMode ? <Shrink className="h-4 w-4" /> : <Expand className="h-4 w-4" />} | ||
</button> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from "./views"; | ||
export * from "./header"; | ||
export * from "./main-content"; | ||
export * from "./root"; |
Oops, something went wrong.