From 9e9ff6fa7fa7cfceaa2f0f0a72377186d6f85675 Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Fri, 10 Apr 2026 10:19:28 +0000 Subject: [PATCH] fix: handle undefined timeframe in strategy preview --- src/frontend/src/lib/components/StrategyPreview.svelte | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/lib/components/StrategyPreview.svelte b/src/frontend/src/lib/components/StrategyPreview.svelte index 5988427..a0cec69 100644 --- a/src/frontend/src/lib/components/StrategyPreview.svelte +++ b/src/frontend/src/lib/components/StrategyPreview.svelte @@ -10,13 +10,14 @@ let { config, editable = false, onUpdate }: Props = $props(); function getConditionDescription(condition: StrategyConfig['conditions'][0]): string { + const timeframe = condition.timeframe ? ` within ${condition.timeframe}` : ''; switch (condition.type) { case 'price_drop': - return `${condition.token} drops by ${condition.threshold}% within ${condition.timeframe}`; + return `${condition.token} drops by ${condition.threshold}%${timeframe}`; case 'price_rise': - return `${condition.token} rises by ${condition.threshold}% within ${condition.timeframe}`; + return `${condition.token} rises by ${condition.threshold}%${timeframe}`; case 'volume_spike': - return `${condition.token} volume spikes by ${condition.threshold}% within ${condition.timeframe}`; + return `${condition.token} volume spikes by ${condition.threshold}%${timeframe}`; case 'price_level': return `${condition.token} crosses ${condition.direction} $${condition.price}`; default: