2024-02-02 10:58:45 +00:00
|
|
|
// hooks
|
|
|
|
import { useChart } from "components/gantt-chart";
|
|
|
|
// helpers
|
|
|
|
import { cn } from "helpers/common.helper";
|
|
|
|
// types
|
|
|
|
import { IMonthBlock } from "../../views";
|
|
|
|
|
2024-02-06 06:07:41 +00:00
|
|
|
export const MonthChartView = () => {
|
2024-02-02 10:58:45 +00:00
|
|
|
// chart hook
|
|
|
|
const { currentViewData, renderView } = useChart();
|
|
|
|
|
|
|
|
const monthBlocks: IMonthBlock[] = renderView;
|
|
|
|
|
|
|
|
return (
|
2024-02-06 06:07:41 +00:00
|
|
|
<div className="relative z-[1] h-full w-full flex flex-grow divide-x divide-custom-border-100/50">
|
|
|
|
{monthBlocks?.map((block, rootIndex) => (
|
|
|
|
<div key={`month-${block?.month}-${block?.year}`} className="relative flex flex-col">
|
|
|
|
<div className="flex h-full w-full divide-x divide-custom-border-100/50">
|
|
|
|
{block?.children?.map((monthDay, index) => (
|
|
|
|
<div
|
|
|
|
key={`column-${rootIndex}-${index}`}
|
|
|
|
className="relative flex h-full flex-col overflow-hidden whitespace-nowrap"
|
|
|
|
style={{ width: `${currentViewData?.data.width}px` }}
|
|
|
|
>
|
2024-02-02 10:58:45 +00:00
|
|
|
<div
|
2024-02-06 06:07:41 +00:00
|
|
|
className={cn("relative flex h-full w-full flex-1 justify-center", {
|
|
|
|
"bg-custom-background-90": ["sat", "sun"].includes(monthDay?.dayData?.shortTitle),
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
<span className="absolute left-1/2 -translate-x-1/2 text-xs">
|
|
|
|
{block.monthData.shortTitle} {monthDay?.dayData?.shortTitle[0]} {monthDay?.day}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
))}
|
2024-02-02 10:58:45 +00:00
|
|
|
</div>
|
2024-02-06 06:07:41 +00:00
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
2024-02-02 10:58:45 +00:00
|
|
|
);
|
|
|
|
};
|