# Static course portal content audit notes

Session pattern: user asked to audit `alg.run.beinginfuture.com` and hide non-first module entries on the main dashboard.

## Useful workflow

1. Open the public prototype in a browser and inspect the rendered accessibility snapshot first. Confirm what the learner can see, not just what JSON claims exists.
2. Locate the prototype root from `/root/prototype-manager/prototypes.json` when the hostname is managed by the Paperclip prototype manager. For `alg`, the root was under a Paperclip project `_default` directory and served by `python3 -m http.server`.
3. Inspect the source of truth data file. For the static course portal, lessons were stored in `curriculum.json`; UI rendering lived in `src/app.js`.
4. Programmatically audit the target module before editing. Example check:

```python
import json, pathlib
p = pathlib.Path('curriculum.json')
data = json.loads(p.read_text())
mod = next(m for m in data['modules'] if m['id'] == 'A')
for lesson in mod['lessons']:
    print(lesson['id'], lesson['title']['ru'], len(lesson.get('content') or []), bool(lesson.get('exercise')), bool(lesson.get('quiz_question')))
```

5. Treat `exercise`, `quiz_question`, and `freqtrade_connection` as supporting material, not sufficient educational content. A lesson with zero `content` sections is effectively empty for learners even if it has a quiz.
6. Fill missing lessons with structured sections in all supported languages when the schema is multilingual (`ru`, `en`, `zh` in this portal). Preserve stable lesson IDs and order.
7. If the user asks to hide future modules from the dashboard, hide only entry points on the main course/sidebar views unless they explicitly ask to delete data. Keep the full curriculum data intact so later modules can be re-enabled.
8. For this static portal, no rebuild/restart was needed because it was served directly by `http.server`; cache-bust the browser URL with `?v=<change>` for verification.

## Pattern: course map visible, only first module enterable

When the user asks for the main screen to describe the whole course while only the first module is enterable:

1. Keep the full curriculum JSON intact; do not delete future modules.
2. Render every module card on the course dashboard with module description, lesson count, estimated hours, and learning outcomes where present.
3. Gate only navigation affordances:
   - first module keeps clickable `data-module` / `data-lesson` buttons;
   - future modules render as disabled/non-button rows (`aria-disabled="true"`) and a localized "coming soon" pill;
   - sidebar may list all modules, but only the first should be a real button.
4. Add CSS for locked cards/rows instead of relying on hidden content. Future modules should be visible as a course map, visually subdued, and clearly not enterable.
5. If lesson completion should advance linearly, implement helpers over the full flattened curriculum order (for example `getAllLessons()` and `getNextLesson()`), then make the "Done" button mark the current lesson complete and switch `state.lessonId` to the next lesson before re-rendering. This can intentionally advance from the last lesson of module A into B even if B is locked from dashboard entry.

## Verification checklist

- `npm run check` passes: JS syntax plus JSON parse.
- Existing Playwright test passes if present.
- Programmatic audit reports zero lessons with empty `content`.
- Browser main dashboard shows all modules as course map, but only the first module has clickable entry points.
- Browser lesson views for filled lessons show educational sections plus exercise/quiz where expected.
- Browser verification covers `Done → next lesson` by checking localStorage/DOM after click; if `browser_click` appears not to change state, execute `document.querySelector('[data-complete]').click()` in console to distinguish stale accessibility refs from app logic.
- Console has zero errors.

## Pitfalls

- Clicking cached/old accessibility refs after rerenders may not navigate correctly; use `data-lesson` selectors or re-snapshot after state changes.
- Do not mistake hidden future module links for curriculum deletion. The user asked not to show entry points on the dashboard, not to remove modules from the course data.
