gitpoint / gitpoint/git-point

Refactor and internationalize `IssueEventListItem`

Offen
#795 6 Kommentare 1 Reaktion 1 zugewiesene Person Beansprucht von @machour Auf GitHub ansehen
good for beginners help wanted
Vorherrschende Sprache
JavaScript
Sterne
4.8k
Forks
771
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.