gitpoint / gitpoint/git-point

Refactor and internationalize `IssueEventListItem`

未关闭
#795 6 条评论 1 个 reaction 已指派 1 人 已被 @machour 认领 在 GitHub 查看
good for beginners help wanted
主要语言
JavaScript
星标
4.8k
派生
771
PR 合并指标
30 天内没有已合并 PR

描述

This component could benefit from a refactoring similar to `EventsScreen`, where every event type would be handled by a dedicated method.

Instead of the big switch/case in render(), we could have something like this:

```
render() {
const { repository, event } = this.props;
const handler = camelCase(`handle_${event.event}`); // lodash's camelCase

if (typeof this[handler] === 'function') {
return this[handler](event, repository);
}

return null;
}
```

and implement `handleReviewRequested()`, `handleLabeled()`, etc.

We would then wrap strings with `utils.t()` to internationalize this component.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。