gitpoint/git-point

Refactor and internationalize `IssueEventListItem`

Open

#795 创建于 2018年4月26日

在 GitHub 查看
 (6 评论) (1 反应) (1 负责人)JavaScript (4,684 star) (837 fork)batch import
good for beginnershelp wanted

描述

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.

贡献者指南

Refactor and internationalize `IssueEventListItem` · gitpoint/git-point#795 | Good First Issue