diff options
| author | soryu <soryu@soryu.co> | 2026-03-08 04:21:06 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-03-08 04:21:06 +0000 |
| commit | 1dc01df7fd5ecfb85e8f776d8d6894dc5c52a6d3 (patch) | |
| tree | b9128fdc605ca1a2a1bb872c372383fe4a18523c /makima/frontend/src/components/orders/OrderList.tsx | |
| parent | 5739f1064059c9e33730a1238944f7f140b5b7b1 (diff) | |
| parent | 90007a8359cf50923d55734bb8d4325307c75461 (diff) | |
| download | soryu-1dc01df7fd5ecfb85e8f776d8d6894dc5c52a6d3.tar.gz soryu-1dc01df7fd5ecfb85e8f776d8d6894dc5c52a6d3.zip | |
Merge remote-tracking branch 'origin/makima/soryu-co-soryu---makima--add-right-click-context-m-f42926a8' into makima/directive-soryu-co-soryu---makima-19fd3e1d-v1772943648
Diffstat (limited to 'makima/frontend/src/components/orders/OrderList.tsx')
| -rw-r--r-- | makima/frontend/src/components/orders/OrderList.tsx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/makima/frontend/src/components/orders/OrderList.tsx b/makima/frontend/src/components/orders/OrderList.tsx index 0ebd18d..ec3dcf6 100644 --- a/makima/frontend/src/components/orders/OrderList.tsx +++ b/makima/frontend/src/components/orders/OrderList.tsx @@ -1,5 +1,6 @@ import { useState, useMemo } from "react"; import type { Order, OrderStatus, OrderPriority, OrderType } from "../../lib/api"; +import { OrderContextMenu } from "./OrderContextMenu"; const STATUS_BADGE: Record<OrderStatus, { color: string; label: string }> = { open: { color: "text-[#75aafc] border-[rgba(117,170,252,0.4)]", label: "OPEN" }, @@ -34,6 +35,9 @@ interface OrderListProps { onStatusFilter: (s: OrderStatus | undefined) => void; typeFilter: OrderType | undefined; onTypeFilter: (t: OrderType | undefined) => void; + onChangeStatus?: (order: Order, status: OrderStatus) => void; + onDelete?: (order: Order) => void; + onGoToDirective?: (order: Order) => void; } const STATUS_OPTIONS: (OrderStatus | "all")[] = ["all", "open", "in_progress", "under_review", "done", "archived"]; @@ -48,8 +52,24 @@ export function OrderList({ onStatusFilter, typeFilter, onTypeFilter, + onChangeStatus, + onDelete, + onGoToDirective, }: OrderListProps) { const [search, setSearch] = useState(""); + const [contextMenuPosition, setContextMenuPosition] = useState<{ x: number; y: number } | null>(null); + const [contextMenuOrder, setContextMenuOrder] = useState<Order | null>(null); + + const handleContextMenu = (e: React.MouseEvent, order: Order) => { + e.preventDefault(); + setContextMenuPosition({ x: e.clientX, y: e.clientY }); + setContextMenuOrder(order); + }; + + const closeContextMenu = () => { + setContextMenuPosition(null); + setContextMenuOrder(null); + }; const filtered = useMemo(() => { if (!search.trim()) return orders; @@ -148,6 +168,7 @@ export function OrderList({ key={o.id} type="button" onClick={() => onSelect(o.id)} + onContextMenu={(e) => handleContextMenu(e, o)} className={`w-full text-left px-3 py-2.5 border-b border-[rgba(117,170,252,0.1)] hover:bg-[rgba(117,170,252,0.05)] transition-colors ${ selectedId === o.id ? "bg-[rgba(117,170,252,0.1)]" : "" }`} @@ -190,6 +211,19 @@ export function OrderList({ }) )} </div> + + {/* Context Menu */} + {contextMenuPosition && contextMenuOrder && ( + <OrderContextMenu + x={contextMenuPosition.x} + y={contextMenuPosition.y} + order={contextMenuOrder} + onClose={closeContextMenu} + onChangeStatus={(status) => onChangeStatus?.(contextMenuOrder, status)} + onDelete={() => onDelete?.(contextMenuOrder)} + onGoToDirective={() => onGoToDirective?.(contextMenuOrder)} + /> + )} </div> ); } |
