git-point
git-point copied to clipboard
Refactor and internationalize `IssueEventListItem`
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.
I actually have to do this while migrating the Issue Screen to GraphQL
Is this issue unassigned? If so, I'd like to work on it.
Hi @arashcoder! This work have already been done in a PR I'm working on.
@machour Not a push. Just ping to check your PR status.
Hi,
The PR that included this won't be finished as comments pagination have been done separately.
Here's the event screen with my modifications: https://github.com/machour/git-point/blob/refactor/issues-and-pulls/src/auth/screens/events.screen.js
I'd have zero problems if someone copied into his/her own PR and submitted, I'll probably won't have the time any soon.
@machour has this task been done now?