3.7 KiB
3.7 KiB
APP_FLOW.md
1. Scope
This file defines every user-visible flow for the current product scope.
Primary web route is / (single-page app). Miniapp flow is skeleton-only.
Related docs:
- PRD.md
- FRONTEND_GUIDELINES.md
- BACKEND_STRUCTURE.md
2. Screen List and Route Map
Web /: Main Sankey workspace (header + mapping panels + chart preview).Miniapp /pages/index/index: Layout skeleton only (not full feature parity).
3. Web Flow: Initial Page Load
Trigger:
- User opens
/.
Steps:
- Render header, mapping panels, and chart container.
- Initialize ECharts instance.
- Try loading
/data/example0.xlsx. - Parse file and set default column mapping.
- Build Sankey data and render preview.
Decision points:
- If sample file request fails, show parse error text and keep page interactive.
Success result:
- User sees a chart without manual upload.
Error result:
- User sees a clear message and can still upload a file manually.
4. Web Flow: File Upload (Click)
Trigger:
- User clicks upload icon and selects a local file.
Steps:
- Validate extension (
csv/xls/xlsx). - Parse file to
RawTable. - Reset default mapping by column count.
- Rebuild Sankey data via reactive effect.
- Update upload message with filename and row count.
Decision points:
- Unsupported file type.
- Parse failure (CSV parser/XLSX parser errors).
Success result:
- Mapping list updates to current headers and preview updates.
Error result:
- Error message appears; previous valid state remains usable.
5. Web Flow: File Upload (Drag and Drop)
Trigger:
- User drops one file into upload area.
Steps:
- Read first file from drop payload.
- Reuse the same pipeline as click upload.
Decision points:
- No file in payload.
Success and error behaviors:
- Same as click upload.
6. Web Flow: Mapping Configuration
Trigger:
- User changes any mapping item in the left panels.
Steps:
- Select one source data column (radio).
- Toggle source description columns (checkbox list).
- Toggle target description columns (checkbox list).
- Optional: toggle target total label display.
- Reactive builder recomputes links and warnings.
Decision points:
- Missing source data column -> block build with message.
- Empty target description selection -> block build with message.
- Invalid numeric source value -> row dropped with warning.
- Empty source/target name after rules -> row dropped with warning.
Success result:
- Chart updates immediately.
Error result:
- Build error or warning list shown in preview panel.
7. Web Flow: Preview Controls
Trigger:
- User changes direction, gap, padding, or theme.
Steps:
- Direction toggle swaps link direction (
source<->target). - Gap/padding sliders update chart series layout.
- Theme picker updates node palette.
Decision points:
- Theme popover closes on outside pointer down.
Success result:
- Chart visual changes apply in-place.
8. Web Flow: Export
Trigger:
- User clicks
Export SVGorExport PNG.
Steps:
- Ensure chart instance exists.
- Build filename with timestamp.
- For SVG: prefer serializing DOM
<svg>; fallback togetDataURL. - For PNG: use
getDataURL(type='png', pixelRatio=2). - Trigger browser download.
Decision points:
- No chart instance -> no action.
Success result:
- Downloaded file appears with expected naming.
9. Miniapp Skeleton Flow (Current State)
Trigger:
- Open miniapp index page.
Steps:
- Render static layout blocks.
- Allow opening/closing theme bottom sheet.
Current limitations:
- No real file parsing, no Sankey rendering, no export pipeline.
10. Flow Completion Checklist
A flow is considered complete only when:
- Success path works end-to-end.
- Error path shows deterministic message.
- UI state remains recoverable after errors.