Sprint 5: in-prototype screen documentation

Shared data layer + two access points for design-review docs.

- src/docs.js — SCREEN_DOCS dictionary keyed by screen id with
  title, category, goal, tasks[], rationale[], and optional
  variants note; helpers getScreenDoc(screenId, ctx) resolves home
  variants (home:cards / home:list / home:feed) and compound routes
  (doctor:id, article:id, chat:id, etc.); getAllDocs groups by
  category; resolveRouteForDoc maps doc key back to a concrete
  navigable route

- Toggle "Описания" in Tweaks + plashka above the phone in single
  layout: card with category, full-width title, and full goal text
  (line-clamp removed so whole sentence is readable); tap opens a
  full modal with tasks, rationale, and variants

- Live sync: PhoneApp reports top-of-stack via onCurrentChange prop,
  App tracks innerScreen state so the plashka follows the real nav
  inside the phone (clicking "Записаться" on home now updates the
  plashka to the booking screen)

- DocsScreen route "docs" in Tweaks screen selector — categorized
  list of all ~30 screens with collapsible inline descriptions and
  an "Открыть экран" CTA per row

- Convention: SPRINTS.md "Правила разработки" + memory note — when
  editing any src/screens/* file, update the matching entry in
  src/docs.js to keep in-prototype documentation in sync

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 18:41:15 +05:00
parent 61f7e5776d
commit a9d669e397
5 changed files with 890 additions and 9 deletions
+9 -2
View File
@@ -17,6 +17,7 @@ import { ChatsListScreen, ChatConversationScreen } from './screens/screens-chats
import { ArticlesScreen, ArticleDetailScreen } from './screens/screens-articles.jsx';
import { HomeV2Screen, SearchScreen, ContactsScreen, PricesScreen } from './screens/screens-v2.jsx';
import { DevColorsScreen, DevExamplesScreen } from './screens/screens-dev.jsx';
import { DocsScreen } from './screens/screens-docs.jsx';
function renderScreen(screenId, nav, ctx) {
const parts = screenId.split(':');
@@ -54,17 +55,24 @@ function renderScreen(screenId, nav, ctx) {
case 'prices': return <PricesScreen nav={nav} />;
case 'dev-colors': return <DevColorsScreen nav={nav} ctx={ctx} />;
case 'dev-examples': return <DevExamplesScreen nav={nav} ctx={ctx} />;
case 'docs': return <DocsScreen nav={nav} />;
default: return <div style={{padding: 40, textAlign: 'center'}}>Экран не найден: {screenId}</div>;
}
}
const TAB_IDS = ['home', 'appts', 'doctors', 'chat', 'profile'];
export function PhoneApp({ initialScreen, ctx }) {
export function PhoneApp({ initialScreen, ctx, onCurrentChange }) {
const [stack, setStack] = useState([initialScreen]);
useEffect(() => { setStack([initialScreen]); }, [initialScreen]);
const current = stack[stack.length - 1];
useEffect(() => {
if (onCurrentChange) onCurrentChange(current);
}, [current, onCurrentChange]);
const nav = useMemo(() => ({
push: (id) => setStack(s => [...s, id]),
pop: () => setStack(s => s.length > 1 ? s.slice(0, -1) : s),
@@ -72,7 +80,6 @@ export function PhoneApp({ initialScreen, ctx }) {
reset:() => setStack(['home']),
}), []);
const current = stack[stack.length - 1];
const rootId = current.split(':')[0];
const hasSubId = current.includes(':');
const tabId = hasSubId ? null : (rootId === 'home-v2' ? 'home' : (TAB_IDS.includes(rootId) ? rootId : null));