Web UI: decompose App.tsx (1803 lines) into focused hooks + components
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript
调研方向
Start with App.tsx and the presentation-layer rules in AGENTS.md; the issue gives line ranges for each proposed hook, component, and helper. Follow the suggested sequence, beginning with useScanController and the five duplicated scan flows. Finish when the listed responsibilities are extracted into focused, independently testable pieces and the test suite remains green.
由索引模型根据 Issue 内容生成。
描述
Problem
App.tsx is a 1803-line monolith mixing scan orchestration, theme, barcode mode, drag-drop, global shortcuts, LAN toggle, telemetry and more. AGENTS.md's presentation-layer rules (delegate business logic to core, UI only) are hard to enforce at this size, and several bugs found in this audit trace directly to the tangle (stale closures in the scan flow, shortcut-guard gaps, duplicated scan-merge logic).
Concrete decomposition plan (each hook independently testable)
useScanController—files/totalCount/hasScanned/scanning/loadingMore, generation + abort refs (App.tsx:85-89, 175-196),loadScanResults,runScan,handleLoadMore, and a singlescanWith(params)replacing the five duplicatedtry { await runScan(...) } catch { showToast } finally { finishScan }blocks (App.tsx:666-681, 723-739, 742-758, 832-843, 845-856).useToast— lines 98, 147-168.useExternalEvents— the notification poll +externalConfigApplyRef(lines 445-476).useBarcodeMode— state, buffer ref, capture-phase keydown effect,applyBarcodeValues(lines 132-133, 1085-1191).useAutoRescanTimer—autoRescanInterval+ interval effect (lines 144-145, 1196-1217).useGlobalShortcuts(anyModalOpen, …)— the 200-line keydown effect (lines 1223-1444).useTheme— theme state + persistence effect (fixes #129 at the same time).useDragDropConfig— drag tracker refs + window listeners +handleDroppedConfig(lines 418-511).
Components: extract LanConfirmDialog (lines 1722-1785 — the waitForLanState observe-and-verify flow is ~60 lines of inline JSX + logic).
Business logic that should leave the UI per AGENTS.md:
handleCopyUri's path→URI construction (line 895) → purepathToFileUri()inutils/(currently also wrong for UNC paths).- The barcode
shouldScandecision (lines 1111-1117) →utils/barcodeScanner.ts. - The three duplicated "merge extension/filter from directoryConfig" blocks (lines 531-536, 644-649, 387-394) → one pure helper.
handleCameraDetected's inline duplicate ofrunScan(lines 1043-1082 vs 274-285) → reuse the scan controller.
Suggested sequencing
Do it in slices that keep the suite green (config-editor tests already cover the editor slice): scan controller first (kills the five duplicated blocks), then shortcuts/theme/barcode, then the component extractions.
- 主要语言
- Python
- 星标
- 1
- 派生
- 1
- 平均合并
- 4 小时 46 分钟
- 30 天内合并 PR
- 55
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
falbany/ProFiles 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
falbany/ProFiles#187 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 86/100
aws-samples/sample-spec-driven-presentation-maker#648 ·
维护者通常 1 天内回复
-
firestore: enable live window.yaml pipeline system tests once add_window_fields is in production未关闭
难度 1/5 1 小时以内 新手友好度 64/100
googleapis/google-cloud-python#19115 ·
维护者通常 2 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复