test(dock schedule fail): failed attempt ad doing a dock schedule but leaving in here
This commit is contained in:
44
frontend/src/routes/(logistics)/-components/Shipments.tsx
Normal file
44
frontend/src/routes/(logistics)/-components/Shipments.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
// ShipmentItem.tsx
|
||||
import { useDraggable } from "@dnd-kit/core";
|
||||
|
||||
interface ShipmentItemProps {
|
||||
shipment: any;
|
||||
index?: number;
|
||||
perm?: boolean;
|
||||
}
|
||||
|
||||
export function ShipmentItem({
|
||||
shipment,
|
||||
index = 0,
|
||||
perm = true,
|
||||
}: ShipmentItemProps) {
|
||||
const { setNodeRef, listeners, attributes, transform } = useDraggable({
|
||||
id: shipment.orderNumber,
|
||||
data: shipment,
|
||||
});
|
||||
|
||||
const offsetX = index * 10;
|
||||
|
||||
const style: React.CSSProperties = {
|
||||
transform: transform
|
||||
? `translate(${transform.x}px, ${transform.y}px)`
|
||||
: `translateX(${offsetX}px)`,
|
||||
transition: transform ? "none" : "transform 0.2s ease",
|
||||
zIndex: 10 + index,
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
cursor: "grab",
|
||||
};
|
||||
return (
|
||||
<div
|
||||
ref={setNodeRef}
|
||||
{...listeners}
|
||||
{...attributes}
|
||||
style={style}
|
||||
className="w-[160px] p-2 text-xs rounded shadow select-none "
|
||||
>
|
||||
{shipment.orderNumber}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user