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 showReconnectBroker = isConnected && (showSessionExpired || brokerAuthExpired);
|
||||||
|
|
||||||
const normalizedStrategyStatus =
|
const normalizedStrategyStatus =
|
||||||
strategyStatus === "RUNNING" ? "RUNNING" : "STOPPED";
|
strategyStatus === "RUNNING"
|
||||||
const isStrategyRunning = normalizedStrategyStatus === "RUNNING";
|
? "RUNNING"
|
||||||
|
: strategyStatus === "WAITING"
|
||||||
|
? "WAITING"
|
||||||
|
: "STOPPED";
|
||||||
|
const isStrategyActive =
|
||||||
|
normalizedStrategyStatus === "RUNNING" ||
|
||||||
|
normalizedStrategyStatus === "WAITING";
|
||||||
|
|
||||||
const heartbeatAgeSec = engineStatus?.last_heartbeat_ts
|
const heartbeatAgeSec = engineStatus?.last_heartbeat_ts
|
||||||
? (Date.now() - new Date(engineStatus.last_heartbeat_ts).getTime()) / 1000
|
? (Date.now() - new Date(engineStatus.last_heartbeat_ts).getTime()) / 1000
|
||||||
@ -601,6 +607,26 @@ export default function PortfolioSection() {
|
|||||||
: liveness === "DEAD"
|
: liveness === "DEAD"
|
||||||
? "border-red-500/50 bg-red-500/15 text-red-300"
|
? "border-red-500/50 bg-red-500/15 text-red-300"
|
||||||
: "border-slate-400/40 bg-slate-400/15 text-slate-200";
|
: "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 marketState = marketStatus?.status ?? "UNKNOWN";
|
||||||
const executionAllowed =
|
const executionAllowed =
|
||||||
@ -1044,17 +1070,10 @@ export default function PortfolioSection() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Badge variant="outline" className={livenessBadgeClass}>
|
<Badge variant="outline" className={livenessBadgeClass}>
|
||||||
{liveness}
|
{livenessBadgeLabel}
|
||||||
</Badge>
|
</Badge>
|
||||||
<Badge
|
<Badge variant="outline" className={strategyBadgeClass}>
|
||||||
variant="outline"
|
{strategyBadgeLabel}
|
||||||
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>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1124,7 +1143,7 @@ export default function PortfolioSection() {
|
|||||||
<MotionButton
|
<MotionButton
|
||||||
{...ctaMotionProps}
|
{...ctaMotionProps}
|
||||||
onClick={handleStart}
|
onClick={handleStart}
|
||||||
disabled={isStarting || !executionAllowed || isStrategyRunning}
|
disabled={isStarting || !executionAllowed || isStrategyActive}
|
||||||
className="shimmer"
|
className="shimmer"
|
||||||
>
|
>
|
||||||
{isStarting ? "Starting..." : "Start Strategy"}
|
{isStarting ? "Starting..." : "Start Strategy"}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user