summaryrefslogtreecommitdiff
path: root/makima/frontend/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'makima/frontend/src/components')
-rw-r--r--makima/frontend/src/components/directives/DirectiveDetail.tsx35
1 files changed, 35 insertions, 0 deletions
diff --git a/makima/frontend/src/components/directives/DirectiveDetail.tsx b/makima/frontend/src/components/directives/DirectiveDetail.tsx
index e278939..9305e20 100644
--- a/makima/frontend/src/components/directives/DirectiveDetail.tsx
+++ b/makima/frontend/src/components/directives/DirectiveDetail.tsx
@@ -26,6 +26,7 @@ interface DirectiveDetailProps {
onDelete: () => void;
onRefresh: () => void;
onCleanupTasks: () => void;
+ onPickUpOrders: () => Promise<{ message: string; orderCount: number; taskId: string | null } | null>;
}
export function DirectiveDetail({
@@ -41,10 +42,13 @@ export function DirectiveDetail({
onDelete,
onRefresh,
onCleanupTasks,
+ onPickUpOrders,
}: DirectiveDetailProps) {
const [editingGoal, setEditingGoal] = useState(false);
const [goalText, setGoalText] = useState(directive.goal);
const [visibleTaskIds, setVisibleTaskIds] = useState<Set<string> | null>(null);
+ const [pickingUpOrders, setPickingUpOrders] = useState(false);
+ const [pickUpResult, setPickUpResult] = useState<string | null>(null);
// Sync goalText and reset editing state when directive changes
useEffect(() => {
@@ -121,6 +125,23 @@ export function DirectiveDetail({
prevHadRunningRef.current = hasRunningTasks;
}, [hasRunningTasks]);
+ const handlePickUpOrders = async () => {
+ setPickingUpOrders(true);
+ setPickUpResult(null);
+ try {
+ const result = await onPickUpOrders();
+ if (result) {
+ setPickUpResult(result.message);
+ setTimeout(() => setPickUpResult(null), 5000);
+ }
+ } catch (e) {
+ setPickUpResult(e instanceof Error ? e.message : "Failed to pick up orders");
+ setTimeout(() => setPickUpResult(null), 5000);
+ } finally {
+ setPickingUpOrders(false);
+ }
+ };
+
const handleGoalSave = () => {
if (goalText.trim() && goalText !== directive.goal) {
onUpdateGoal(goalText.trim());
@@ -314,12 +335,26 @@ export function DirectiveDetail({
)}
<button
type="button"
+ onClick={handlePickUpOrders}
+ disabled={pickingUpOrders}
+ className="text-[10px] font-mono text-[#c084fc] hover:text-[#d8b4fe] border border-[rgba(192,132,252,0.3)] rounded px-2 py-1 disabled:opacity-50"
+ >
+ {pickingUpOrders ? "Picking up..." : "Pick Up Orders"}
+ </button>
+ <button
+ type="button"
onClick={onDelete}
className={`text-[10px] font-mono text-red-400 hover:text-red-300 border border-red-800 rounded px-2 py-1 ${hasTerminalTasks ? "" : "ml-auto"}`}
>
Delete
</button>
</div>
+
+ {pickUpResult && (
+ <div className="mt-2 px-2 py-1.5 bg-[#1a1030] border border-[rgba(192,132,252,0.2)] rounded">
+ <span className="text-[10px] font-mono text-[#c084fc]">{pickUpResult}</span>
+ </div>
+ )}
</div>
{/* Goal */}