chore(plan): admin-redesign 6-phase plan
PLAN.md + 6 subplans + CONTEXT.md Strategy: Incremental | Mode: Automated | Execution: Orchestrator Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
# Feature Context: Admin Panel Redesign
|
||||
|
||||
## Current State
|
||||
|
||||
(будет обновляться после каждой фазы)
|
||||
|
||||
- ⬜ Phase 1 not started — старый switchTab всё ещё единственный роутер
|
||||
- ⬜ Phase 2 not started — все 13 секций в admin.js монолите
|
||||
- ⬜ Phase 3-6 not started
|
||||
|
||||
## Temporary Workarounds
|
||||
|
||||
(пусто — заполняется implementer'ом)
|
||||
|
||||
## Cross-Phase Dependencies
|
||||
|
||||
- **Phase 2 depends on Phase 1:** sections подписываются на router events, чтобы lazy-init по hashchange
|
||||
- **Phases 3, 4, 5 depend on Phase 2:** новые модули будут добавляться в `js/admin/sections/` (структура из фазы 2)
|
||||
- **Phase 6 depends on Phase 2:** deep page для user/session — это новые sections в той же структуре
|
||||
- **Phase 6 removes** старую `.user-panel` overlay из admin.html — фазы 1-5 НЕ должны её удалять
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
### Существующая структура (что менять / что НЕ менять)
|
||||
|
||||
**Точки входа в admin.js:**
|
||||
- `LS.initPage()` — auth + role check
|
||||
- `switchTab(btn)` — текущий tab-роутер; будет обёрнут router'ом, но не удалён до фазы 6
|
||||
- Per-tab `*Inited` флаги (`usersInited`, `sessionsInited`, ...) — переедут в section modules
|
||||
|
||||
**Backward compat обязателен:**
|
||||
- `goAddQuestion(slug)` и подобные cross-tab onclick handlers должны работать
|
||||
- Старые ссылки `<a href="#stats">` (если есть) тоже
|
||||
|
||||
### Конвенции вновь создаваемых модулей
|
||||
|
||||
Каждая section (фаза 2):
|
||||
```js
|
||||
// js/admin/sections/<name>.js
|
||||
(function () {
|
||||
'use strict';
|
||||
let inited = false;
|
||||
async function load() { /* ... */ }
|
||||
window.AdminSections = window.AdminSections || {};
|
||||
window.AdminSections.<name> = {
|
||||
init: async () => { if (inited) return; inited = true; await load(); },
|
||||
reload: load,
|
||||
};
|
||||
})();
|
||||
```
|
||||
|
||||
Router (фаза 1):
|
||||
```js
|
||||
// js/admin/router.js
|
||||
window.AdminRouter = {
|
||||
navigate(hash) { /* update hash + dispatch */ },
|
||||
current() { /* parse current hash */ },
|
||||
on(event, fn) { /* subscribe */ },
|
||||
};
|
||||
```
|
||||
|
||||
### Какие onclick handlers есть сейчас (выборка)
|
||||
|
||||
Из admin.html / admin.js:
|
||||
- `onclick="switchTab(this)"` — на каждой admin-nav-item
|
||||
- `onclick="openUserPanel(event, ${u.id}, '${u.role}')"` — на user row
|
||||
- `onclick="changeRole(this)"` — на role-select
|
||||
- `onclick="goAddQuestion('${slug}')"` — cross-tab
|
||||
|
||||
Эти должны работать без изменений до фазы 6.
|
||||
Reference in New Issue
Block a user