From 90007a8359cf50923d55734bb8d4325307c75461 Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 7 Mar 2026 20:16:29 +0000 Subject: feat: soryu-co/soryu - makima: Add right-click context menu to orders page --- makima/frontend/src/routes/orders.tsx | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'makima/frontend/src/routes') diff --git a/makima/frontend/src/routes/orders.tsx b/makima/frontend/src/routes/orders.tsx index aa14e68..5744bdd 100644 --- a/makima/frontend/src/routes/orders.tsx +++ b/makima/frontend/src/routes/orders.tsx @@ -6,7 +6,8 @@ import { OrderDetail } from "../components/orders/OrderDetail"; import { useOrders, useOrder } from "../hooks/useOrders"; import { useDirectives } from "../hooks/useDirectives"; import { useAuth } from "../contexts/AuthContext"; -import type { OrderStatus, OrderType, OrderPriority } from "../lib/api"; +import { updateOrder, deleteOrder } from "../lib/api"; +import type { Order, OrderStatus, OrderType, OrderPriority } from "../lib/api"; export default function OrdersPage() { const { isAuthenticated, isAuthConfigured, isLoading: authLoading } = useAuth(); @@ -92,6 +93,30 @@ export default function OrdersPage() { await refreshList(); }; + const handleContextChangeStatus = async (order: Order, status: OrderStatus) => { + try { + await updateOrder(order.id, { status }); + await refreshList(); + } catch (e) { + console.error("Failed to change status:", e); + } + }; + + const handleContextDelete = async (order: Order) => { + if (!window.confirm("Delete this order?")) return; + try { + await deleteOrder(order.id); + if (order.id === selectedId) navigate("/orders"); + await refreshList(); + } catch (e) { + console.error("Failed to delete:", e); + } + }; + + const handleContextGoToDirective = (order: Order) => { + if (order.directiveId) navigate("/directives/" + order.directiveId); + }; + const priorityOptions: { value: OrderPriority; label: string }[] = [ { value: "critical", label: "Critical" }, { value: "high", label: "High" }, @@ -123,6 +148,9 @@ export default function OrdersPage() { onStatusFilter={setStatusFilter} typeFilter={typeFilter} onTypeFilter={setTypeFilter} + onChangeStatus={handleContextChangeStatus} + onDelete={handleContextDelete} + onGoToDirective={handleContextGoToDirective} /> -- cgit v1.2.3