From 67fd0222c7bf3c23455a876db08b1ed0e87fe8af Mon Sep 17 00:00:00 2001 From: Behrad Date: Thu, 15 Oct 2026 12:55:35 +0330 Subject: [PATCH] improve gantt chart --- pm/docker-compose.yml | 7 +++--- pm/frontend/src/components/GanttChart.tsx | 28 ++++------------------- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/pm/docker-compose.yml b/pm/docker-compose.yml index b0af23a..ab54168 100644 --- a/pm/docker-compose.yml +++ b/pm/docker-compose.yml @@ -25,7 +25,7 @@ services: dockerfile: Dockerfile container_name: pm-api environment: - PM_DATABASE_URL: postgresql+asyncpg://postgres:postgres@procurement-postgres:5432/procurement + PM_DATABASE_URL: postgresql+asyncpg://pm:${PM_DB_PASSWORD:-pm_secret_2026}@pm-postgres:5432/pm PM_SESSION_SECRET: ${PM_SESSION_SECRET:-12278fc281bd0e22950e76364e1a18cea61fbc6a24604fdd79690a817ec36ac8} PM_ADMIN_USER: ${PM_ADMIN_USER:-admin} PM_ADMIN_PASSWORD: ${PM_ADMIN_PASSWORD:-pm123456} @@ -48,7 +48,7 @@ services: condition: service_healthy networks: - default - - erp_default + - traefik_network restart: unless-stopped pm-frontend: @@ -85,5 +85,4 @@ networks: erp_default: external: true traefik_network: - external: true - + external: true \ No newline at end of file diff --git a/pm/frontend/src/components/GanttChart.tsx b/pm/frontend/src/components/GanttChart.tsx index 82ff1bf..24d1143 100644 --- a/pm/frontend/src/components/GanttChart.tsx +++ b/pm/frontend/src/components/GanttChart.tsx @@ -9,7 +9,6 @@ import { ChevronUp, Clock, Flame, - Hand, Layers, Link2, Pencil, @@ -167,7 +166,6 @@ export function GanttChart({ const touchDistanceRef = useRef(null); const hasAutoScrolledToday = useRef(false); - const [isPanMode, setIsPanMode] = useState(false); const [isSpacePressed, setIsSpacePressed] = useState(false); const [isPanning, setIsPanning] = useState(false); @@ -201,9 +199,6 @@ export function GanttChart({ if (e.code === "Space" && !e.repeat) { e.preventDefault(); setIsSpacePressed(true); - } else if ((e.key === "h" || e.key === "H") && !e.ctrlKey && !e.metaKey && !e.altKey) { - e.preventDefault(); - setIsPanMode((prev) => !prev); } }; @@ -491,11 +486,9 @@ export function GanttChart({ }; const handleWheel = (e: React.WheelEvent) => { - if (e.ctrlKey || e.metaKey) { - e.preventDefault(); + e.preventDefault(); + if (e.deltaY !== 0) { setColWidth((prev) => Math.min(Math.max(prev + (e.deltaY < 0 ? 3 : -3), 2), 54)); - } else if (e.shiftKey && e.deltaY && !e.deltaX && scrollRef.current) { - scrollRef.current.scrollLeft += e.deltaY; } }; @@ -511,7 +504,7 @@ export function GanttChart({ hasMoved: false, }; - if (e.button === 1 || isPanMode || isSpacePressed) { + if (e.button === 1 || isSpacePressed) { e.preventDefault(); } }; @@ -692,16 +685,6 @@ export function GanttChart({ {toFa(execTasks.length)} وظیفه - @@ -713,7 +696,7 @@ export function GanttChart({ className={`w-full overflow-x-auto select-none [&::-webkit-scrollbar]:hidden ${ isPanning ? "cursor-grabbing" - : isPanMode || isSpacePressed + : isSpacePressed ? "cursor-grab" : "cursor-default" }`} @@ -826,7 +809,6 @@ export function GanttChart({ style={{ left: `${coords.left}px`, width: `${coords.width}px` }} onClick={(e) => { if ( - isPanMode || isSpacePressed || wasPanningRef.current || mousePanRef.current.hasMoved || @@ -841,7 +823,7 @@ export function GanttChart({ className={`absolute h-8 rounded-xl border shadow-xs flex items-center overflow-hidden transition-all active:scale-95 ${barMeta.bg} ${barMeta.border} ${ isPanning ? "cursor-grabbing" - : isPanMode || isSpacePressed + : isSpacePressed ? "cursor-grab" : "cursor-pointer" } ${isSelected ? `ring-2 ring-offset-2 ${barMeta.ring}` : ""}`}