improve gantt chart
This commit is contained in:
@@ -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:
|
||||
@@ -86,4 +86,3 @@ networks:
|
||||
external: true
|
||||
traefik_network:
|
||||
external: true
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
ChevronUp,
|
||||
Clock,
|
||||
Flame,
|
||||
Hand,
|
||||
Layers,
|
||||
Link2,
|
||||
Pencil,
|
||||
@@ -167,7 +166,6 @@ export function GanttChart({
|
||||
const touchDistanceRef = useRef<number | null>(null);
|
||||
const hasAutoScrolledToday = useRef<boolean>(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();
|
||||
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({
|
||||
<span className="text-[11px] text-slate-400 font-medium">
|
||||
{toFa(execTasks.length)} وظیفه
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsPanMode((v) => !v)}
|
||||
className={`flex h-7 items-center gap-1 rounded-lg px-2 text-[11px] font-semibold border ${
|
||||
isPanMode ? "bg-sky-600 border-sky-600 text-white" : "border-slate-200 text-slate-600"
|
||||
}`}
|
||||
>
|
||||
<Hand size={11} />
|
||||
<span>پیمایش</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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}` : ""}`}
|
||||
|
||||
Reference in New Issue
Block a user