3.9 KiB
Role Switch And Production Copy Implementation Plan
For agentic workers: REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Добавить служебный вход по специальному email с выбором роли, убрать demo/PWA-подачу из интерфейса и подготовить клиентскую showcase-ссылку для показа.
Architecture: Обычный OTP flow остается без изменений. Новая служебная ветка определяется на уровне login/auth helper-логики через специальный email roles@local и использует локальный fallback-профиль выбранной роли без OTP. UI-copy в логине, overview и клиентской странице упрощается до рабочего нейтрального тона, а PWA explanatory panel убирается из overview.
Tech Stack: React 18, Vite, existing UI kit, Vitest, local fallback auth, Supabase Auth.
Chunk 1: Role Switch Entry
Task 1: Зафиксировать тестами служебный вход по специальному email
Files:
-
Modify:
src/components/auth/OtpLoginForm.test.jsx -
Modify:
src/context/AuthContext.test.js -
Step 1: Add failing tests for service email mode
-
Step 2: Run targeted auth tests and confirm failure
-
Step 3: Verify copy no longer references demo mode in production path
Task 2: Реализовать special-email вход без OTP
Files:
-
Modify:
src/context/AuthContext.jsx -
Modify:
src/pages/LoginPage.jsx -
Modify:
src/components/auth/OtpLoginForm.jsx -
Step 1: Add helper constants for
roles@localand service mode detection -
Step 2: Route special-email flow to local role-based sign-in
-
Step 3: Update login form labels/buttons for service mode
-
Step 4: Re-run targeted auth tests and confirm pass
Chunk 2: Production Copy Cleanup
Task 3: Убрать demo/PWA explanatory copy
Files:
-
Modify:
src/pages/DashboardPage.jsx -
Modify:
src/pages/LoginPage.jsx -
Modify:
src/components/auth/OtpLoginForm.jsx -
Modify:
README.mdif needed -
Step 1: Remove PWA explanatory panel from overview
-
Step 2: Replace demo-oriented labels/messages with neutral product copy
-
Step 3: Re-run affected UI tests
Chunk 3: Client Showcase Link
Task 4: Добавить локальную клиентскую showcase-ссылку
Files:
-
Modify:
src/services/deliveryInvitationApi.js -
Modify:
src/pages/ClientDeliveryPage.jsx -
Modify:
src/components/client/DeliveryChoiceFlow.test.jsx -
Modify or Create: related test file if needed
-
Step 1: Add failing test for showcase token payload
-
Step 2: Implement local invitation for showcase token
-
Step 3: Verify tomorrow/after-tomorrow and half-day slots are shown
-
Step 4: Re-run client tests and confirm pass
Chunk 4: Final Verification
Task 5: Проверка итогового сценария
Files:
-
Reference:
src/pages/LoginPage.jsx -
Reference:
src/pages/DashboardPage.jsx -
Reference:
src/pages/ClientDeliveryPage.jsx -
Step 1: Run targeted test suite
Run: npm test -- src/context/AuthContext.test.js src/components/auth/OtpLoginForm.test.jsx src/components/client/DeliveryChoiceFlow.test.jsx src/components/client/DeliverySlotsPicker.test.jsx
Expected: PASS
- Step 2: Run broader UI regression checks
Run: npm test -- src/components/orders/OrdersTable.test.jsx src/components/orders/OrderDetailPanel.test.jsx src/components/orders/OrderFilters.test.jsx src/services/orderService.test.js
Expected: PASS