feat: Always show stop buttons when positions exist to prevent automation triggers

Modified Stop Button Logic:
- Stop buttons now visible when positions exist (not just when automation active)
- Prevents automation from triggering when positions close
- Added helpful tooltips explaining button purpose in different states

 Enhanced Button Behavior:
- When automation active: 'STOP' button stops running automation
- When positions exist but automation inactive: 'DISABLE' button prevents triggers
- Emergency button always available for immediate safety

 Safety Scripts Added:
- immediate-stop.js: Quick script to disable automation before position close
- Verifies position status and ensures no automation triggers

 Position Safety: CONFIRMED
- Current position: SOL-PERP LONG .41 PnL
- Automation: DISABLED 
- Safe to close position manually without triggering new automation

Critical for position management - stops automation from auto-triggering on position close.
This commit is contained in:
mindesbunister
2025-07-28 14:44:27 +02:00
parent 3d0369dbc8
commit 2a3a3e3afa
3 changed files with 154 additions and 3 deletions

View File

@@ -380,12 +380,13 @@ Based on comprehensive technical analysis across multiple timeframes:
</div>
<div className="flex space-x-4">
{status?.isActive ? (
{(status?.isActive || positions.length > 0) ? (
<>
<button
onClick={handleStop}
disabled={loading}
className="px-8 py-4 bg-gradient-to-r from-red-600 to-red-700 text-white rounded-xl hover:from-red-700 hover:to-red-800 transition-all duration-200 disabled:opacity-50 font-semibold shadow-lg shadow-red-500/25 transform hover:scale-105"
title={status?.isActive ? "Stop active automation" : "Prevent automation from triggering on position close"}
>
{loading ? (
<div className="flex items-center space-x-2">
@@ -395,7 +396,7 @@ Based on comprehensive technical analysis across multiple timeframes:
) : (
<div className="flex items-center space-x-2">
<span>🛑</span>
<span>STOP</span>
<span>{status?.isActive ? 'STOP' : 'DISABLE'}</span>
</div>
)}
</button>
@@ -403,7 +404,7 @@ Based on comprehensive technical analysis across multiple timeframes:
onClick={handleEmergencyStop}
disabled={loading}
className="px-6 py-4 bg-gradient-to-r from-red-800 to-red-900 text-white rounded-xl hover:from-red-900 hover:to-red-950 transition-all duration-200 disabled:opacity-50 font-semibold border-2 border-red-600/50 shadow-lg shadow-red-900/50 transform hover:scale-105"
title="Emergency Stop - Closes all positions immediately"
title={status?.isActive ? "Emergency Stop - Closes all positions immediately" : "Emergency disable - Prevents any automation triggers"}
>
<div className="flex items-center space-x-2">
<span>🚨</span>