Clarify live strategy status badges
This commit is contained in:
parent
121b0b3eb4
commit
3640cd745e
@ -573,8 +573,14 @@ export default function PortfolioSection() {
|
||||
const showReconnectBroker = isConnected && (showSessionExpired || brokerAuthExpired);
|
||||
|
||||
const normalizedStrategyStatus =
|
||||
strategyStatus === "RUNNING" ? "RUNNING" : "STOPPED";
|
||||
const isStrategyRunning = normalizedStrategyStatus === "RUNNING";
|
||||
strategyStatus === "RUNNING"
|
||||
? "RUNNING"
|
||||
: strategyStatus === "WAITING"
|
||||
? "WAITING"
|
||||
: "STOPPED";
|
||||
const isStrategyActive =
|
||||
normalizedStrategyStatus === "RUNNING" ||
|
||||
normalizedStrategyStatus === "WAITING";
|
||||
|
||||
const heartbeatAgeSec = engineStatus?.last_heartbeat_ts
|
||||
? (Date.now() - new Date(engineStatus.last_heartbeat_ts).getTime()) / 1000
|
||||
@ -601,6 +607,26 @@ export default function PortfolioSection() {
|
||||
: liveness === "DEAD"
|
||||
? "border-red-500/50 bg-red-500/15 text-red-300"
|
||||
: "border-slate-400/40 bg-slate-400/15 text-slate-200";
|
||||
const livenessBadgeLabel =
|
||||
liveness === "ACTIVE"
|
||||
? "Engine active"
|
||||
: liveness === "STALLED"
|
||||
? "Engine stalled"
|
||||
: liveness === "DEAD"
|
||||
? "Engine dead"
|
||||
: "Engine stopped";
|
||||
const strategyBadgeClass =
|
||||
normalizedStrategyStatus === "RUNNING"
|
||||
? "border-emerald-500/50 bg-emerald-500/10 text-emerald-400"
|
||||
: normalizedStrategyStatus === "WAITING"
|
||||
? "border-amber-400/50 bg-amber-400/10 text-amber-300"
|
||||
: "border-red-500/40 bg-red-500/10 text-red-400";
|
||||
const strategyBadgeLabel =
|
||||
normalizedStrategyStatus === "RUNNING"
|
||||
? "Strategy running"
|
||||
: normalizedStrategyStatus === "WAITING"
|
||||
? "Strategy waiting"
|
||||
: "Strategy stopped";
|
||||
|
||||
const marketState = marketStatus?.status ?? "UNKNOWN";
|
||||
const executionAllowed =
|
||||
@ -1044,17 +1070,10 @@ export default function PortfolioSection() {
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Badge variant="outline" className={livenessBadgeClass}>
|
||||
{liveness}
|
||||
{livenessBadgeLabel}
|
||||
</Badge>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={
|
||||
normalizedStrategyStatus === "RUNNING"
|
||||
? "border-emerald-500/50 bg-emerald-500/10 text-emerald-400"
|
||||
: "border-red-500/40 bg-red-500/10 text-red-400"
|
||||
}
|
||||
>
|
||||
{normalizedStrategyStatus}
|
||||
<Badge variant="outline" className={strategyBadgeClass}>
|
||||
{strategyBadgeLabel}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
@ -1124,7 +1143,7 @@ export default function PortfolioSection() {
|
||||
<MotionButton
|
||||
{...ctaMotionProps}
|
||||
onClick={handleStart}
|
||||
disabled={isStarting || !executionAllowed || isStrategyRunning}
|
||||
disabled={isStarting || !executionAllowed || isStrategyActive}
|
||||
className="shimmer"
|
||||
>
|
||||
{isStarting ? "Starting..." : "Start Strategy"}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user