fix(simple): clarify market price fallback copy

This commit is contained in:
root 2026-05-06 04:33:41 +00:00
parent cc9268cee8
commit 6b2ddeb837

View File

@ -116,7 +116,7 @@ export function buildSimpleSetupPayload(input: {
const currentMarketPrice = parsePositiveNumber(input.draft.currentMarketPrice); const currentMarketPrice = parsePositiveNumber(input.draft.currentMarketPrice);
if (!currentMarketPrice) { if (!currentMarketPrice) {
throw new Error('Current market price is unavailable. Refresh market data and try again.'); throw new Error('No recent market price is available right now. The app uses live price when available, otherwise the latest close.');
} }
const quantity = parsePositiveNumber(input.draft.quantity); const quantity = parsePositiveNumber(input.draft.quantity);
@ -390,10 +390,10 @@ export function SimpleView() {
if (Number.isFinite(lastClose) && lastClose > 0) { if (Number.isFinite(lastClose) && lastClose > 0) {
updateDraft('currentMarketPrice', lastClose.toFixed(4)); updateDraft('currentMarketPrice', lastClose.toFixed(4));
} else { } else {
throw new Error('No recent market price available'); throw new Error('No recent market data is available for this symbol right now.');
} }
} catch (err: any) { } catch (err: any) {
setError(err?.message ?? 'Failed to load market price'); setError(err?.message ?? 'Failed to load market data');
} finally { } finally {
setLoadingPrice(false); setLoadingPrice(false);
} }
@ -529,6 +529,9 @@ export function SimpleView() {
readOnly readOnly
className="bg-[var(--muted)] text-[var(--foreground)]" className="bg-[var(--muted)] text-[var(--foreground)]"
/> />
<span className="block text-[11px] text-[var(--muted-foreground)]">
Uses live market price when available. Outside market hours, it falls back to the latest close.
</span>
</label> </label>
<Button <Button
type="button" type="button"