Skip to content

[Refactor] 拆分 format_dashboard_mvp() 函数(目前 ~250 行) #160

@wjllance

Description

@wjllance

问题描述

函数目前约 250 行,职责过多,难以维护和测试。

重构建议

将大函数拆分为更小的、职责单一的函数:

建议拆分结构

// 1. 数据准备层
fn prepare_dashboard_data(...) -> DashboardData { }

// 2. 格式化层 - 各个区域
fn format_header(...) -> String { }
fn format_price_section(...) -> String { }
fn format_position_section(...) -> String { }
fn format_order_section(...) -> String { }

// 3. 渲染层
fn render_dashboard(data: DashboardData) -> String { }

好处

  • 提高代码可读性
  • 便于单元测试
  • 支持未来扩展(如不同布局主题)

优先级

P2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions