summaryrefslogtreecommitdiff
path: root/makima/frontend/src/components
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-16 15:09:25 +0000
committerGitHub <noreply@github.com>2026-02-16 15:09:25 +0000
commitb6a29bb563499b2fd6280c742bd2106d66393112 (patch)
tree6f8d13fe989613b687b12e37277b661ff4d607c8 /makima/frontend/src/components
parent0676468e3e69ff36f1e509d775f191dd41f6080b (diff)
downloadsoryu-b6a29bb563499b2fd6280c742bd2106d66393112.tar.gz
soryu-b6a29bb563499b2fd6280c742bd2106d66393112.zip
Add pick-up-orders feature for directives (#64)
* WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Add frontend pick-up-orders button and API integration * feat: soryu-co/soryu - makima: Add pick-up-orders backend endpoint and repository functions
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 */}