{"size": 1225, "ext": "js", "max_stars_repo_path": "src/containers/TracklistTrackContainer.js", "max_stars_repo_name": "karsonkalt/onrotation_react", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/containers/TracklistTrackContainer.js", "max_issues_repo_name": "karsonkalt/onrotation_react", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/containers/TracklistTrackContainer.js", "max_forks_repo_name": "karsonkalt/onrotation_react", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.6851851852, "max_line_length": 71, "alphanum_fraction": 0.5208163265}
import { Component } from "react";
import TracklistTrack from "../components/TracklistTrack";

class TracklistTrackContainer extends Component {
  endTime = (index, tracks) => {
    return tracks[index + 1] && tracks[index + 1].cueTime
      ? tracks[index + 1].cueTime
      : "9:99:99";
  };

  renderTracks = () => {
    return this.props.tracks.map(
      (
        {
          name,
          artist,
          label,
          order,
          cueTime,
          identifier,
          id,
          suggestedTrackIdentification,
          identifiedDate,
        },
        index,
        tracks
      ) => {
        return (
          <TracklistTrack
            name={name}
            artist={artist}
            label={label}
            identifier={identifier}
            cueTime={cueTime}
            endTime={this.endTime(index, tracks)}
            order={order}
            id={id}
            suggestedTrackIdentification={suggestedTrackIdentification}
            identifiedDate={identifiedDate}
            playedSeconds={this.props.playedSeconds}
            key={id}
          />
        );
      }
    );
  };

  render() {
    return this.renderTracks();
  }
}

export default TracklistTrackContainer;
