Files
vf_react/src/views/Community/components/DynamicNewsCard/constants.js
zdl 5368ad3acb refactor: 删除未使用的 lastUpdated 和 cachedCount 状态
- 删除 initialState 中的 lastUpdated 和 cachedCount
  - 删除所有 reducer 中相关的设置代码
  - 更新 selectors 使用 .length 替代 cachedCount
  - 删除 shouldRefresh 工具函数

  简化理由:
  - lastUpdated 未被使用
  - cachedCount 可以通过 events.length 直接获取
2025-11-05 22:33:25 +08:00

41 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// src/views/Community/components/DynamicNewsCard/constants.js
// 动态新闻卡片组件 - 常量配置
// ========== 分页配置常量 ==========
/**
* 分页大小计算依据:
*
* 【四排模式 (FOUR_ROW_PAGE_SIZE)】
* - 容器高度: 800px (VirtualizedFourRowGrid)
* - 单行高度: ~250px (包含卡片 + 间距)
* - 每行显示: 4 列
* - 可视区域: 800px / 250px ≈ 3.2 行
* - overscan 缓冲: 2 行 (上下各预渲染1行)
* - 实际渲染区域: 3.2 + 2 = 5.2 行
* - 单次加载数据量: 7.5 行 × 4 列 = 30 个
* - 设计目标: 提供充足的缓冲数据,确保快速滚动时不出现空白
*
* 【纵向模式 (VERTICAL_PAGE_SIZE)】
* - 每页显示 10 条数据
* - 使用传统分页器,用户手动翻页
*/
export const PAGINATION_CONFIG = {
FOUR_ROW_PAGE_SIZE: 30, // 平铺模式每页数量 (7.5行 × 4列包含缓冲)
VERTICAL_PAGE_SIZE: 10, // 纵向模式每页数量 (传统分页)
INITIAL_PAGE: 1, // 初始页码
};
// ========== 显示模式常量 ==========
export const DISPLAY_MODES = {
FOUR_ROW: 'four-row', // 平铺网格模式
VERTICAL: 'vertical', // 纵向分栏模式
};
export const DEFAULT_MODE = DISPLAY_MODES.VERTICAL;
// ========== Toast 提示配置 ==========
export const TOAST_CONFIG = {
DURATION_ERROR: 3000, // 错误提示持续时间(毫秒)
DURATION_WARNING: 2000, // 警告提示持续时间(毫秒)
};