Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,29 @@ All notable changes to this project are documented here. Format: [Keep a Changel

### Fixed

- **UI polish pass** (1 Nov). Every surface was swept in Chromium at 1280 px and in the 620 px Hermes pane, dark
and light: screenshots, plus checks for clipped text, things off screen and tiny targets. Nothing was broken;
these were the rough edges.
- **Hermes pane:** the floating "Scripts / <> Script / Full screen" strip sat over the second chart's symbol and
price scale. Vela's compact bar already has all three, so the strip now appears only when neither bar is on
screen.
- **Replay:** in the narrow pane the capsule covered the time axis. It now sits above it. Its drag handle is a
24 px target, up from 16 px.
- **Script pane, stacked under the chart:** a dead 30 px band under the run list is gone, because the chart's
row now takes what the pane leaves.
- **Editor footer:** "Ln 31, C…" was cut off at desktop width. The theme picker and size control are slightly
narrower, so the caret position fits.
- **Trader's desk:**
- Prop firms said "The directory could not be read: No live MCP session" in red. It now says, in a card, that
the directory comes from the LuxAlgo Library, which isn't connected, and that the paper account, journal
and chart don't need it.
- Data was one sentence with a command in it. It is now a setup card: what the tick data is for, the command
with a Copy button, and that crypto needs nothing.
- Journal no longer prints "Best — · worst — · 0 fills kept" before there are trades.
- **Indicators panel:** the footer hint wrapped onto two lines. It is one line now, and the Run-vs-Add rule is in
the buttons' tooltips.
- Pinned by `test_ui_polish_1nov.py`.

- **Alerts did nothing in a narrow pane** (31 Oct). Vela's `openAlertsMenu(anchor)` reads the anchor's box with
no guard. In the Hermes pane (620 px) the ⋯ menu is reached from Vela's bottom sheet, so there is no
anchor, and the call threw. The list is now drawn by the menu itself.
Expand Down
68 changes: 68 additions & 0 deletions console/backend/tests/test_ui_polish_1nov.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"""UI polish pass (1 Nov): what a sweep of every surface found, at 1280 px and the 620 px Hermes pane, dark and light.

Each test names what was wrong on screen; the fix is pinned by its source shape.
"""

import re
import unittest
from pathlib import Path

FRONT = Path(__file__).resolve().parents[2] / "frontend"
APP = (FRONT / "app.js").read_text(encoding="utf-8")
DRAWER = (FRONT / "drawer.js").read_text(encoding="utf-8")
DESK = (FRONT / "desk.js").read_text(encoding="utf-8")
DESK_CSS = (FRONT / "desk.css").read_text(encoding="utf-8")
CSS = (FRONT / "styles.css").read_text(encoding="utf-8")
HTML = (FRONT / "index.html").read_text(encoding="utf-8")


class TheNarrowPane(unittest.TestCase):
def test_the_floating_strip_stays_off_when_velas_compact_bar_is_there(self):
# "Scripts / <> Script / Full screen" floated over the second chart's symbol and price scale, though
# Vela's compact bar already had all three (its Indicators icon, and Script / Full screen in its ⋮ sheet)
self.assertIn("shownOnScreen('.vela-widget-topbar') || shownOnScreen('.vela-mb-more')", APP)
self.assertIn("shown('.vela-widget-topbar') || shown('.vela-mb-indicators')", DRAWER)

def test_the_replay_capsule_clears_the_time_axis(self):
self.assertIn("@media (max-width: 640px) { .ta-replay:not(.ta-replay--free) { bottom: 92px; } }", CSS)

def test_the_replay_drag_handle_is_a_real_target(self):
rule = re.search(r"\.ta-replay__drag \{([^}]*)\}", CSS).group(1)
self.assertIn("min-width: 24px", rule)

def test_no_dead_band_under_the_stacked_script_pane(self):
self.assertIn('.main[data-detail="on"] { grid-template-rows: minmax(0, 1fr) auto; }', CSS)


class TheEditorFooter(unittest.TestCase):
def test_the_caret_position_has_room(self):
# "Ln 31, C…" was cut at desktop width: the theme picker and the size control are a little narrower
self.assertIn("max-width: 108px", re.search(r"\.script__themesel \{([^}]*)\}", CSS).group(1))


class TheDesk(unittest.TestCase):
def test_an_offline_library_is_said_in_plain_words(self):
self.assertIn("The prop-firm directory comes from the LuxAlgo Library, which isn\\'t connected right now.", DESK)
self.assertIn("Prop firms aren't available right now", DESK)

def test_an_empty_tick_store_is_a_setup_card_with_a_copyable_command(self):
self.assertIn("const FX_FETCH = 'python3 tools/fx-fetch.py --years 2';", DESK)
self.assertIn('data-copy="${esc(FX_FETCH)}"', DESK)
self.assertIn("navigator.clipboard.writeText(copyBtn.dataset.copy)", DESK)
self.assertIn(".desk__setup {", DESK_CSS)
self.assertEqual(re.findall(r"#[0-9a-fA-F]{3,8}\b", DESK_CSS.split(".desk__setup {", 1)[1].split(".desk__cmd code", 1)[0]), [])

def test_the_journal_note_has_no_row_of_dashes_when_empty(self):
self.assertIn("const extremes = trades.length", DESK)


class ThePanel(unittest.TestCase):
def test_the_footer_hint_is_one_line_and_the_rule_moved_to_the_buttons(self):
note = re.search(r'<p class="drawer__note muted">(.*?)</p>', HTML).group(1)
self.assertNotIn("paints one LuxAlgo script", note)
self.assertIn("Run: one LuxAlgo script at a time, it replaces the last", DRAWER)
self.assertIn("Add: built-ins stack beside what is on the chart", DRAWER)


if __name__ == "__main__":
unittest.main()
7 changes: 5 additions & 2 deletions console/frontend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1282,9 +1282,12 @@ async function main() {
/* The door is unreachable in Vela's compact mode too: under ~640px Vela hides its desktop row
(0-width), so "no row" must mean "no USABLE row", not "no element" — else a narrow pane has no
toolbar and no way in (the doc's compact-mode check). */
/* 1 Nov: Vela's compact bar is a usable door too. Under ~640 px (the Hermes pane) its Indicators icon opens
the picker and its ⋮ sheet lists Script and Full screen, so the floating strip only repeated them, and it
sat over the second chart's symbol and price scale. It now shows only when neither bar is on screen. */
const shownOnScreen = (sel) => { const e = document.querySelector(sel); return !!(e && e.getBoundingClientRect().width > 0); };
const showFallbacks = () => {
const row = document.querySelector('.vela-widget-topbar');
const usable = !!(row && row.getBoundingClientRect().width > 0);
const usable = shownOnScreen('.vela-widget-topbar') || shownOnScreen('.vela-mb-more');
for (const b of [el.scriptFallback, el.fullFallback]) if (b) b.hidden = usable;
setPaneTop();
/* The status dot is a widget action in Vela's row; the statusbar copy is the fallback only. */
Expand Down
9 changes: 9 additions & 0 deletions console/frontend/desk.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@
.desk__body h3:first-child { margin-top: 0; }
.desk__note { margin: 10px 0 0; color: var(--lx-fg-faint); font-size: var(--d-small); }
.desk__empty { margin: 4px 0 0; color: var(--lx-fg-faint); font-size: var(--d-small); }
/* A setup step or an offline source, said as a card (1 Nov): what it is, what to do, what still works. */
.desk__setup { margin: 2px 0 0; padding: 16px 16px 14px; border: 1px solid var(--lx-border-soft); border-radius: var(--lx-radius-lg);
background: var(--lx-surface-2); }
.desk__setup > b { display: block; font-size: var(--d-body); color: var(--lx-fg-bright); font-weight: var(--lx-fw-semibold); }
.desk__setup p { margin: 6px 0 0; color: var(--lx-fg-muted); font-size: var(--d-small); line-height: 1.5; }
.desk__setup .desk__note { margin-top: 10px; }
.desk__cmd { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 6px 6px 12px; border-radius: var(--lx-radius-md);
background: var(--lx-canvas); border: 1px solid var(--lx-border-soft); }
.desk__cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-family: var(--lx-font-mono); font-size: var(--d-small); color: var(--lx-fg); }

/* KPI cards — the only raised things on the page, like the edge sheet's hero/ask cards */
.desk__kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 6px; }
Expand Down
36 changes: 30 additions & 6 deletions console/frontend/desk.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,13 @@
<td>${money(t.exit)}</td><td class="${cls(t.pnl)}">${signed(t.pnl)}</td></tr>`).join('')}</tbody></table>`
: '<p class="desk__empty">No closed trades yet. A trade closes when a sell fills — until then there is no win rate to show, only a position.</p>';

/* Best / worst / fills kept only once there is something to report: with no trades the line read
"Best — · worst — · 0 fills kept", a row of dashes (1 Nov). */
const extremes = trades.length
? ` Best ${st.best == null ? '—' : signed(st.best)} · worst ${st.worst == null ? '—' : signed(st.worst)} ·
${st.fills_kept || 0} fills kept (old ones are trimmed).` : '';
const foot = `<p class="desk__note">Per-trade P&amp;L carries both legs' fees. The curve is realised equity
and moves only when a trade closes — an open position's P&amp;L is on the Paper view, not here.
Best ${st.best == null ? '—' : signed(st.best)} · worst ${st.worst == null ? '—' : signed(st.worst)} ·
${st.fills_kept || 0} fills kept (old ones are trimmed).</p>`;
and moves only when a trade closes — an open position's P&amp;L is on the Paper view, not here.${extremes}</p>`;

return `${kpis}${curve}<h3>Trades</h3>${table}${foot}`;
}
Expand Down Expand Up @@ -250,7 +253,8 @@

function propHtml() {
if (S.propBusy && !S.firms) return '<p class="desk__empty">Reading the directory…</p>';
if (S.propErr && !S.firms) return `<p class="desk__bad">${esc(S.propErr)}</p><p class="desk__note"><button type="button" class="desk__btn" data-retry>Try again</button></p>`;
if (S.propErr && !S.firms) return `<div class="desk__setup"><b>Prop firms aren't available right now</b>
<p>${esc(S.propErr)}</p><p><button type="button" class="desk__btn" data-retry>Try again</button></p></div>`;
if (!S.firms) return '<p class="desk__empty">Reading the directory…</p>';

const firms = S.firms.slice(0, FIRMS_SHOWN);
Expand Down Expand Up @@ -350,13 +354,23 @@
return n >= 1e9 ? `${(n / 1e9).toFixed(2)} GB` : `${(n / 1e6).toFixed(1)} MB`;
};

const FX_FETCH = 'python3 tools/fx-fetch.py --years 2';
function dataHtml() {
const d = S.data;
if (d.err) return `<p class="desk__bad">${esc(d.err)}</p>`;
const st = (d.status && d.status.ticks) || null;
if (!st) return '<p class="desk__empty">Reading the tick store…</p>';
const rows = Object.entries(st.symbols || {}).sort((a, b) => a[0].localeCompare(b[0]));
if (!rows.length) return '<p class="desk__empty">No ticks on disk yet. Run: python3 tools/fx-fetch.py --years 2</p>';
/* An empty store is a setup step, not an error (1 Nov): say what the data is for, give the command as
something to copy, and say what works without it. */
if (!rows.length) return `<div class="desk__setup">
<b>No forex tick data on this machine yet</b>
<p>Forex and metals bars are built from Dukascopy ticks kept on this machine. Download two years once, from the
plugin folder (it needs the network):</p>
<div class="desk__cmd"><code>${esc(FX_FETCH)}</code>
<button type="button" class="desk__btn" data-copy="${esc(FX_FETCH)}">Copy</button></div>
<p class="desk__note">Crypto bars come straight from Binance and need nothing here.</p>
</div>`;
return `
<p class="desk__note"><b>Dukascopy ticks</b> on disk · ${int(st.hours)} instrument-hours · ${size(st.bytes)} ·
mid-price bars with real volume and median spread · ${d.status.yahoo
Expand Down Expand Up @@ -447,7 +461,10 @@
S.firmsNote = (firms && firms.note) || '';
S.offers = (offers && offers.offers) || [];
} catch (err) {
S.propErr = `The directory could not be read: ${err.message}`;
/* "No live MCP session" is the Library being offline: say that in plain words (1 Nov). */
S.propErr = /MCP|mcp_unavailable|not connected/i.test(String(err.message))
? 'The prop-firm directory comes from the LuxAlgo Library, which isn\'t connected right now. Your paper account, the journal and the chart don\'t need it.'
: `The directory could not be read: ${err.message}`;
} finally {
S.propBusy = false;
render();
Expand Down Expand Up @@ -556,6 +573,13 @@
runSim(simBtn.dataset.sim, simBtn.dataset.challenge, simBtn.dataset.label || '');
return;
}
const copyBtn = ev.target.closest('[data-copy]');
if (copyBtn) {
try { await navigator.clipboard.writeText(copyBtn.dataset.copy); copyBtn.textContent = 'Copied'; }
catch (err) { say('Copy did not work here: select the command and copy it', true); }
setTimeout(() => { if (copyBtn.isConnected) copyBtn.textContent = 'Copy'; }, 1600);
return;
}
if (ev.target.closest('[data-retry]')) {
if (S.tab === 'propfirms') pullPropFirms(); else pull();
return;
Expand Down
8 changes: 5 additions & 3 deletions console/frontend/drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@
${isOn
? `<button type="button" class="drow__run is-remove" data-remove="1" aria-label="Take it off the chart">✕<span>Remove</span></button>`
: `<button type="button" class="drow__run" data-run="1" ${running || (r.__native && !r.supported) ? 'disabled' : ''}
aria-label="${r.__native ? 'Add to the chart' : 'Run on the chart'}">${running ? '<span class="spin" aria-hidden="true"></span>' : (r.__native ? '+' : '▶')}<span>${r.__native ? 'Add' : 'Run'}</span></button>`}
aria-label="${r.__native ? 'Add to the chart' : 'Run on the chart'}"
title="${r.__native ? 'Add: built-ins stack beside what is on the chart' : 'Run: one LuxAlgo script at a time, it replaces the last'}">${running ? '<span class="spin" aria-hidden="true"></span>' : (r.__native ? '+' : '▶')}<span>${r.__native ? 'Add' : 'Run'}</span></button>`}
</li>`;
}

Expand Down Expand Up @@ -441,8 +442,9 @@ function setOpen(on) {
unreachable. */
function showFallbackIfNeeded() {
/* A 0-width row is Vela's compact mode — the desktop row is hidden, so the door is gone with it. */
const row = document.querySelector('.vela-widget-topbar');
const usable = !!(row && row.getBoundingClientRect().width > 0);
/* …and the compact bar's own Indicators icon is a door again (it opens the picker), so the strip stays off there. */
const shown = (sel) => { const e = document.querySelector(sel); return !!(e && e.getBoundingClientRect().width > 0); };
const usable = shown('.vela-widget-topbar') || shown('.vela-mb-indicators');
if (fallback) fallback.hidden = usable;
}
window.addEventListener('ws-failed', showFallbackIfNeeded);
Expand Down
3 changes: 2 additions & 1 deletion console/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ <h2 class="detail__title">Nothing selected</h2>
<svg class="i-moon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.2 9.6A5.6 5.6 0 0 1 6.4 2.8a5.6 5.6 0 1 0 6.8 6.8Z"/></svg>
</button>
</div>
<p class="drawer__note muted"><kbd>↑</kbd><kbd>↓</kbd> move · <kbd>↵</kbd> run · <kbd>→</kbd> details — ▶ Run paints one LuxAlgo script at a time; + Add puts a built-in beside it</p>
<!-- One line (1 Nov): the run-vs-add rule moved into the buttons' tooltips, where it is read at the moment it matters. -->
<p class="drawer__note muted"><kbd>↑</kbd><kbd>↓</kbd> move · <kbd>↵</kbd> run · <kbd>→</kbd> details</p>
</aside>

<!-- Edge Stats (4 Oct): LuxAlgo's open-source engine — "how often did this setup actually work?", with
Expand Down
Loading
Loading