<commit_before>import React from 'react';
import _ from 'lodash';
import loadArticleAction from '../action/load-article-action';
import navigateAction from '../action/navigate-action';

class TutorialPrevNext extends React.Component {
  
  handleClick(article) {
    let {quickstart, platform, customNavigationAction} = this.props;
    let payload = {
      quickstartId: quickstart.name,
      platformId: platform.name,
      articleId: article.name
    };
    if (customNavigationAction) {
      this.context.executeAction(customNavigationAction, payload);
    }
    else {
      Promise.all([
        this.context.executeAction(loadArticleAction, payload),
        this.context.executeAction(navigateAction, payload)
      ]);
    }
  }

  render() {

    let {platform, currentArticle} = this.props;
    let prev = undefined, next = undefined;

    if (currentArticle) {
      let currentIndex = currentArticle.number - 1;
      if (currentIndex > 0) {
        let prevArticle = platform.articles[currentIndex - 1];
        prev = <a className="tutorial-prevnext-prev" onClick={this.handleClick.bind(this, prevArticle)}>
          <i className="icon-budicon-463" />{prevArticle.title}
        </a>;
      }
      if (currentIndex < platform.articles.length) {
        let nextArticle = platform.articles[currentIndex + 1];
        next = <a className="tutorial-prevnext-next" onClick={this.handleClick.bind(this, nextArticle)}>
          {nextArticle.title} <i className="icon-budicon-461" />
        </a>;
      }
    }
    <commit_msg>Fix for platforms with a single article<commit_after>import React from 'react';
import _ from 'lodash';
import loadArticleAction from '../action/load-article-action';
import navigateAction from '../action/navigate-action';

class TutorialPrevNext extends React.Component {
  
  handleClick(article) {
    let {quickstart, platform, customNavigationAction} = this.props;
    let payload = {
      quickstartId: quickstart.name,
      platformId: platform.name,
      articleId: article.name
    };
    if (customNavigationAction) {
      this.context.executeAction(customNavigationAction, payload);
    }
    else {
      Promise.all([
        this.context.executeAction(loadArticleAction, payload),
        this.context.executeAction(navigateAction, payload)
      ]);
    }
  }

  render() {

    let {platform, currentArticle} = this.props;
    let prev = undefined, next = undefined;

    if (currentArticle) {
      let currentIndex = currentArticle.number - 1;
      if (currentIndex > 0) {
        let prevArticle = platform.articles[currentIndex - 1];
        prev = <a className="tutorial-prevnext-prev" onClick={this.handleClick.bind(this, prevArticle)}>
          <i className="icon-budicon-463" />{prevArticle.title}
        </a>;
      }
      if (platform.articles.length > 1 && currentIndex < platform.articles.length) {
        let nextArticle = platform.articles[currentIndex + 1];
        next = <a className="tutorial-prevnext-next" onClick={this.handleClick.bind(this, nextArticle)}>
          {nextArticle.title} <i className="icon-budicon-461" />
        </a>;
      }
    }
    
{'fraction_non_alphanumeric': 0.12062380649267983, 'fraction_numerical': 0.00668364099299809, 'mean_word_length': 3.0140485312899106, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1994377', 'n_tokens_mistral': 935, 'n_tokens_neox': 876, 'n_words': 190}