git-point icon indicating copy to clipboard operation
git-point copied to clipboard

Refactor and internationalize `IssueEventListItem`

Open machour opened this issue 6 years ago • 6 comments

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.

machour avatar Apr 26 '18 09:04 machour

I actually have to do this while migrating the Issue Screen to GraphQL

machour avatar Apr 27 '18 10:04 machour

Is this issue unassigned? If so, I'd like to work on it.

arashcoder avatar Jun 09 '18 05:06 arashcoder

Hi @arashcoder! This work have already been done in a PR I'm working on.

machour avatar Jun 09 '18 09:06 machour

@machour Not a push. Just ping to check your PR status.

chinesedfan avatar Dec 27 '18 02:12 chinesedfan

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 avatar Dec 27 '18 08:12 machour

@machour has this task been done now?

bobbylemm avatar Apr 30 '20 13:04 bobbylemm