diff --git a/docs/lld/06-frontend.md b/docs/lld/06-frontend.md index 714f45f7..493845d8 100644 --- a/docs/lld/06-frontend.md +++ b/docs/lld/06-frontend.md @@ -174,6 +174,8 @@ It uses no jQuery, DataTables, select2 or Font Awesome. **Opening a question** (`js/question-loader.js`, `fetchLanguageTmplAndSetEditorcode` in `index.html`, `getCodeTemplate` in `common.js`). A question on `/practice?name=` that has no description or no starter for the chosen language is written by Genie when it is first opened. A card (`#question-loading`, over `.editor-body`) says so from the moment the page loads, not only when the fetch starts: "Getting your question ready…", then "Genie (GPT-6 Luna) is writing “Two Sum” and a starter for Python. This usually takes 5 to 20 seconds." (the model chosen in Genie's model menu), with "Still working. A busy model can take up to a minute." after 20 seconds and a Cancel button throughout (Esc cancels too). The request is dropped after **60 seconds** (`QuestionLoader.settings.timeoutMs`; the proxy's own limit to the model is 90 seconds, `openAITimeout`, and a visitor should not wait for that). Whatever goes wrong, the card turns into an error card (`role=alert`) that says why, with Try again and Close: `getCodeTemplate` and `apiFailure` throw an Error with `.kind` (`timeout`, `offline` when the request could not be made, `limit` for 429, `auth` for 401 and 403, `off` when Genie or the model is switched off (503 `GenieDisabled`, `model_unavailable`; the proxy's own words are shown), `empty` when the model answered with nothing in it (the proxy's 502 `model_empty` for an OpenRouter model, or a reply without content seen by the page; the card says which model and why as far as the reply told, for example that it used its whole answer budget thinking), `format` for an answer that cannot be used, otherwise `server` with the HTTP status), and `describeFailure` turns each into a title, a sentence and, where there is one, the status. Cancel is not an error: the card goes away. Close, and a cancel, leave the editor with the question's header (name, level, description) without the starter code; a description that is not there says so instead of "null". A newer load (another language picked meanwhile) stops the older one without showing an error. A question that is already complete (description and a starter for the language) shows no card. Before this, a failure only wrote to the console, there was no time limit, nothing showed during the 4-second wait, and the description Genie wrote was never saved, so a starter question opened as "Problem Description: null". Tests: `src/js/test/question-loader.test.mjs`. +**The IDE's dropdowns** (`js/select-menu.js`, `.sm-*` and `.select-wrap.has-menu` in `css/ui-refresh.css`). The language picker (`#optionlist`), the editor's syntax mode (`#select-lang`) and the theme (`#select-theme`) carry `data-select-menu`, and `SelectMenu.init()` replaces the list the browser draws with a button and a menu of the IDE's own: dark, with a check on the current choice, a search box when a list has more than 8 options (names, extensions and group names are searched, so `.js` finds both JavaScripts and `dark` the dark themes), a file extension next to each language (`data-ext` on the `