feat(simple): add next-action guidance
This commit is contained in:
parent
d7516c440a
commit
0f4515013b
@ -385,6 +385,37 @@ function formatTimelineStepLabel(step: SimpleRuntimeSnapshot['stage']) {
|
||||
}
|
||||
}
|
||||
|
||||
function describeNextAction(
|
||||
entry: ManualEntryPayload,
|
||||
runtimeSnapshot: SimpleRuntimeSnapshot | null,
|
||||
): string {
|
||||
const side = normalizeSetupSide(entry.simple_side);
|
||||
const symbol = String(entry.symbol || '').trim().toUpperCase() || 'This symbol';
|
||||
|
||||
if (!runtimeSnapshot) {
|
||||
return side === 'buy'
|
||||
? `${symbol} is saved and waiting for the configured buy trigger.`
|
||||
: `${symbol} is saved and waiting for an eligible holding to manage.`;
|
||||
}
|
||||
|
||||
switch (runtimeSnapshot.stage) {
|
||||
case 'armed':
|
||||
return side === 'buy'
|
||||
? `${symbol} is waiting for the configured drop trigger before sending an entry order.`
|
||||
: `${symbol} is waiting for the configured profit exit trigger.`;
|
||||
case 'entry_submitted':
|
||||
return `${symbol} entry order has been submitted and is waiting for exchange fill confirmation.`;
|
||||
case 'filled':
|
||||
return `${symbol} entry is filled. The setup is now monitoring for the configured profit exit.`;
|
||||
case 'exit_submitted':
|
||||
return `${symbol} exit order has been submitted and is waiting for exchange fill confirmation.`;
|
||||
case 'closed':
|
||||
return `${symbol} setup is complete. The linked position has been closed.`;
|
||||
default:
|
||||
return `${symbol} runtime state is syncing.`;
|
||||
}
|
||||
}
|
||||
|
||||
function formatSetupUpdatedAt(entry: ManualEntryPayload): string | null {
|
||||
const raw = String(entry.sell_time || entry.buy_time || '').trim();
|
||||
if (!raw) return null;
|
||||
@ -1059,6 +1090,7 @@ export function SimpleView() {
|
||||
const side = normalizeSetupSide(entry.simple_side);
|
||||
const isEditing = editingSetupId === entryId;
|
||||
const runtimeSnapshot = deriveRuntimeSnapshot(entry, runtimeOrders, simpleHoldings);
|
||||
const nextActionText = describeNextAction(entry, runtimeSnapshot);
|
||||
const updatedAt = formatSetupUpdatedAt(entry);
|
||||
return (
|
||||
<div key={entryId} className="rounded-[1.5rem] border border-[var(--border)] bg-[var(--card-elevated)] p-5">
|
||||
@ -1175,6 +1207,11 @@ export function SimpleView() {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="mt-4 rounded-2xl border border-[var(--border)] bg-[var(--background)] px-4 py-3 text-sm text-[var(--muted-foreground)]">
|
||||
<span className="font-semibold text-[var(--foreground)]">Next action:</span>{' '}
|
||||
{nextActionText}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user