File size: 2,458 Bytes
ef987bb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Practice-question administration dashboard
Extend the supplied `index.html` into a local practice-question dashboard with question, user and permission management. Deliver the root `index.html` for direct, offline browser use. Keep state in memory; do not add login or a backend.
## Question and role management
An administrator can add a question from text, edit it, toggle it between published and unpublished, and delete it. Each action affects only its selected question, and status changes are visible. A regular user can browse but cannot change the question bank. Hide, remove or disable management controls in that role; if a control remains in the DOM, programmatic clicks must not allow mutations. Returning to the admin role restores management.
Edit through the main input, an accessible dialog with a text field and a Save button (保存、确认 or 确定 in Chinese), or a native prompt. Give Edit and Delete buttons recognizable accessible names. Use a native `<select>` for the role selector, distinguishing Administrator and Normal User in English or Chinese (管理员 / 普通用户).
## User records and page hooks
Show local users with basic information and their own answer records. Expose `window.__setUsers(users)` to replace the list with entries shaped as `{id, name, email, records: string[]}` and refresh through the normal page renderer. Display the provided name and email on the corresponding card. An empty list shows no answer records; a no-records message is optional.
Use the following `data-testid` values, retaining the starter's existing hooks:
- Sections: `admin-dashboard`, `question-bank`, `user-management`, `permission-management`.
- Question and role controls: `question-input`, `upload-question`, `question-item`, `edit-question`, `offline-question`, `delete-question`, `role-select`.
- User cards: `user-card` with the corresponding `data-user-id`; use `answer-record` on each actual record inside the card.
## Acceptance Checklist
- All dashboard sections render offline. Adding appends the supplied text; editing, unpublishing/republishing and deletion affect only the selected question.
- Regular users cannot add, edit, change status or delete, including through programmatic clicks. Returning to admin restores those actions.
- User management displays actual answer records. Replacing the list displays each supplied user and only their own records; empty lists show no answer-record entries.
|