diff --git a/CHANGELOG.md b/CHANGELOG.md index cc11e3c..4f2e013 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/console/backend/tests/test_ui_polish_1nov.py b/console/backend/tests/test_ui_polish_1nov.py new file mode 100644 index 0000000..6d8577a --- /dev/null +++ b/console/backend/tests/test_ui_polish_1nov.py @@ -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'

(.*?)

', 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() diff --git a/console/frontend/app.js b/console/frontend/app.js index 7332fe8..a328476 100644 --- a/console/frontend/app.js +++ b/console/frontend/app.js @@ -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. */ diff --git a/console/frontend/desk.css b/console/frontend/desk.css index e6a6435..a82de3e 100644 --- a/console/frontend/desk.css +++ b/console/frontend/desk.css @@ -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; } diff --git a/console/frontend/desk.js b/console/frontend/desk.js index 4457561..acaf35b 100644 --- a/console/frontend/desk.js +++ b/console/frontend/desk.js @@ -155,10 +155,13 @@ ${money(t.exit)}${signed(t.pnl)}`).join('')}` : '

No closed trades yet. A trade closes when a sell fills — until then there is no win rate to show, only a position.

'; + /* 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 = `

Per-trade P&L carries both legs' fees. The curve is realised equity - and moves only when a trade closes — an open position's P&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).

`; + and moves only when a trade closes — an open position's P&L is on the Paper view, not here.${extremes}

`; return `${kpis}${curve}

Trades

${table}${foot}`; } @@ -250,7 +253,8 @@ function propHtml() { if (S.propBusy && !S.firms) return '

Reading the directory…

'; - if (S.propErr && !S.firms) return `

${esc(S.propErr)}

`; + if (S.propErr && !S.firms) return `
Prop firms aren't available right now +

${esc(S.propErr)}

`; if (!S.firms) return '

Reading the directory…

'; const firms = S.firms.slice(0, FIRMS_SHOWN); @@ -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 `

${esc(d.err)}

`; const st = (d.status && d.status.ticks) || null; if (!st) return '

Reading the tick store…

'; const rows = Object.entries(st.symbols || {}).sort((a, b) => a[0].localeCompare(b[0])); - if (!rows.length) return '

No ticks on disk yet. Run: python3 tools/fx-fetch.py --years 2

'; + /* 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 `
+ No forex tick data on this machine yet +

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):

+
${esc(FX_FETCH)} +
+

Crypto bars come straight from Binance and need nothing here.

+
`; return `

Dukascopy ticks on disk · ${int(st.hours)} instrument-hours · ${size(st.bytes)} · mid-price bars with real volume and median spread · ${d.status.yahoo @@ -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(); @@ -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; diff --git a/console/frontend/drawer.js b/console/frontend/drawer.js index f3e9c54..6a698a2 100644 --- a/console/frontend/drawer.js +++ b/console/frontend/drawer.js @@ -133,7 +133,8 @@ ${isOn ? `` : ``} + 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 ? '' : (r.__native ? '+' : '▶')}${r.__native ? 'Add' : 'Run'}`} `; } @@ -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); diff --git a/console/frontend/index.html b/console/frontend/index.html index 1f09aee..e6639be 100644 --- a/console/frontend/index.html +++ b/console/frontend/index.html @@ -70,7 +70,8 @@

Nothing selected

-

↑↓ move · ↵ run · → details — ▶ Run paints one LuxAlgo script at a time; + Add puts a built-in beside it

+ +

↑↓ move · ↵ run · → details