6.1 KiB
6.1 KiB
Implementation Plan: Recent Requests Refinement
This document details the technical approach for implementing the recently added Translation, UI, Admin, and Security tasks.
1. Localization & UI Polish
Settings Page Translations
- Social & Privacy Box:
- Target File:
client/src/pages/settings.tsx - Action: Replace hardcoded English text with
t()hooks. - Locales: Add keys under
settings.social.*andsettings.privacy.*inen.jsonandde.json.
- Target File:
- Administration Box:
- Target File:
client/src/pages/settings.tsx - Action: Ensure the "Administration" header and description for the Admin button are properly translated keys (
settings.admin.*).
- Target File:
Achievements Page Polish
- Tabs (Inventory & History):
- Target File:
client/src/pages/AchievementsPage.tsx - Issue: Tabs likely have hardcoded labels or empty content.
- Action:
- Translate Tab Triggers (
Inventory,History). - Inventory Tab: Implement a grid showing unlocked "Rewards" (Themes, Icons) purchased by the user. If empty, show "No items yet".
- History Tab: Implement a list showing
xp_transactions(filter by typepurchaseorreward).
- Translate Tab Triggers (
- Locales: Add
achievements.tabs.*,achievements.inventory.*,achievements.history.*.
- Target File:
Tasks Page Layout
- Calendar Bar Positioning:
- Target File:
client/src/components/TasksWithCalendar.tsx(or similar container). - Action:
- Modify the container styling to ensure the
CalendarBaris pinned to the bottom. - Use CSS
sticky bottom-0orfixed bottom-0(depending on scroll container). - Height Check: Ensure the bottom bar's specific height is sufficient to show the calendar dates and the headline ("Next 7 Days") without cutting off.
- Modify the container styling to ensure the
- Target File:
Task Creation & Sharing
- Smart Input (NLP):
- Target File:
client/src/components/TaskInput.tsx(orSmartTaskInput). - Action: Verify the placeholder text is using
t('taskCreation.smartPlaceholder'). Test that typing "Buy milk tomorrow" correctly parses "tomorrow" in both English and German contexts (requires checkingnlp.tsfor locale support).
- Target File:
- Single Task Sharing:
- Target File:
client/src/components/TaskCard.tsx. - Action: Ensure a "Share" button/icon is visible on the card (possibly under a "More" menu or direct action).
- Logic: It should trigger the
ShareAccessModalbut pre-filled for just that singular task ID (Task Sharing MVP).
- Target File:
2. Admin & Account Features
Admin User Management
- Translations:
- Target File:
client/src/pages/AdminUserManagement.tsx - Action: Audit table headers (ID, Username, Role, Actions) and ensure they are translated keys.
- Target File:
- Safe User Deletion:
- Action: Add a "Delete" (Trash) icon button next to a user.
- UI: Opens a
Dialog. - Validation: "To confirm deletion, type the number of users to delete (1) or the username". (User request mentions "number of users to be deleted", but usually single deletion requires unique ID confirmation. Will implement: "Type 'DELETE' to confirm").
- Backend: Ensure
DELETE /api/users/:idendpoint exists and has admin checks.
SMTP Settings Separation
- Target File:
client/src/pages/AdminUserManagement.tsx. - Action:
- Remove the "Email Settings" card from
AdminUserManagement.tsx. - Create a new route/page
client/src/pages/AdminEmailSettings.tsxOR add aTabscomponent to the Admin page:[Users] [Email Settings]. - Recommendation: Use Tabs within the existing Admin page for better UX.
- Remove the "Email Settings" card from
Account Box Enhancements
- Password Change:
- Target File:
client/src/pages/settings.tsx. - Action: Add "Change Password" button.
- UI: Opens
DialogwithCurrent Password,New Password,Confirm Password. - Backend: Create
POST /api/user/password-change(requires current password validation).
- Target File:
- Profile Data:
- Target File:
client/src/pages/settings.tsx. - Action: Hide the numeric
id. Displayemail. - Edit Email: Add "Change Email" button -> Opens Modal -> New Email input. Backend requires validation.
- Target File:
3. Security & Sessions (Phase 3)
2-Factor Authentication (2FA)
- Database:
- File:
shared/schema.ts - Change: Add
emailOtp(string, nullable) andemailOtpExpires(timestamp) touserstable.
- File:
- Auth Flow (
server/auth.ts):- Login Step 1: User POSTs
username/password. - Logic: If password correct -> Generate 6-digit Random Code -> Save to DB -> Send via
EmailService. - Response: Return
200 OKbut with specific flag{ status: "2FA_REQUIRED", userId: ... }. Do NOT set session cookie yet. - Login Step 2: User POSTs
code. - Logic: Verify code matches & not expired -> Set Session Cookie -> Log in.
- Login Step 1: User POSTs
- Frontend:
- File:
client/src/pages/AuthPage.tsx - UI: Add state for
showTwoFactorInput. If Step 1 succeeds, switch form to simple "Enter 6-digit code" input.
- File:
Persistent Sessions ("Remember Me")
- Frontend:
- File:
client/src/pages/AuthPage.tsx - UI: Add
<Checkbox>"Stay logged in" to Login form. - Logic: Pass
rememberMe: truein the login payload.
- File:
- Backend:
- File:
server/auth.ts/server/index.ts - Logic:
- If
rememberMeis true, set the session cookiemaxAgeto 30 days (1000 * 60 * 60 * 24 * 30). - Default
maxAgecan remain 24h.
- If
- Config: Ensure
express-sessionstore (Memory or Database) is configured to handle potential long-lived sessions (Postgres store is recommended for production persistence).
- File:
4. Execution Order
- Refactor Admin & Account Settings (SMTP Tabs, Translations, Password Modal).
- Fix Achievements & Tasks UI (Tabs, Calendar Bar).
- Implement Security Core (Schema Update, 2FA Flow, Session Config).
- Final Localization Sweep.