<commit_before><template>
    <div>
        <article-navigator action="previous" :link="getPreviousArticle" v-if="getPreviousArticle">
            <i class="material-icons" slot="content">keyboard_arrow_left</i>
        </article-navigator>
        <article-navigator action="next" :link="getNextArticle" v-if="getNextArticle">
            <i class="material-icons" slot="content">keyboard_arrow_right</i>
        </article-navigator>
    </div>
</template>

<script>
    const _ = require('lodash')

    export default {
        components: {
            articleNavigator: require('./article-navigator.vue')
        },

        watch: {
            '$route' : 'getArticlePosition'
        },

        computed: {
            /**
             * Returns the previous article slug.
             *
             * @returns {boolean|number}
             * */
            getPreviousArticle() {
                if (this.getArticlePosition() <= 0) {
                    return false
                }
                else
                    return this.$store.state.searchArticles[this.getArticlePosition() - 1].slug
            },

            /**
             * Returns the next article slug.
             *
             * @returns {boolean|number}
             * */
            getNextArticle() {
                if (this.getArticlePosition() === this.$store.state.searchArticles.length - 1) {
                    return false
                }
                else
                    return this.$store.state.searchArticles[this.getArticlePosition() + 1].slug
            }
        },

        methods: {
            /**
             * Returns the index of the current article viewed from our flatten articles array.
             *
             * NOTES: This won't work as intended if there are duplicate articles with the same slug since
             * we trim duplicate articles based on slug uniqueness.
             *
             * @returns {number|boolean}
             */
            getArticlePosition() {
                // Get the article slug.
                let current = this.$route.fullPath.substr(1)

                // Return where we are in a flat array of articles.
                return _.findIndex(this.$store.state.searchArticles, (article) => {
                    return article.slug === current
                })

            }
        }
    }
</script><commit_msg>Hide navigator on mobile viewport.<commit_after><template>
    <div v-if="!isMobile">
        <article-navigator action="previous" :link="getPreviousArticle" v-if="getPreviousArticle">
            <i class="material-icons" slot="content">keyboard_arrow_left</i>
        </article-navigator>
        <article-navigator action="next" :link="getNextArticle" v-if="getNextArticle">
            <i class="material-icons" slot="content">keyboard_arrow_right</i>
        </article-navigator>
    </div>
</template>

<script>
    const _ = require('lodash')

    export default {
        components: {
            articleNavigator: require('./article-navigator.vue')
        },

        watch: {
            '$route' : 'getArticlePosition'
        },

        computed: {
            /**
             * Returns the previous article slug.
             *
             * @returns {boolean|number}
             * */
            getPreviousArticle() {
                if (this.getArticlePosition() <= 0) {
                    return false
                }
                else
                    return this.$store.state.searchArticles[this.getArticlePosition() - 1].slug
            },

            /**
             * Returns the next article slug.
             *
             * @returns {boolean|number}
             * */
            getNextArticle() {
                if (this.getArticlePosition() === this.$store.state.searchArticles.length - 1) {
                    return false
                }
                else
                    return this.$store.state.searchArticles[this.getArticlePosition() + 1].slug
            },

            isMobile() {
                return window.innerWidth < 993
            }
        },

        methods: {
            /**
             * Returns the index of the current article viewed from our flatten articles array.
             *
             * NOTES: This won't work as intended if there are duplicate articles with the same slug since
             * we trim duplicate articles based on slug uniqueness.
             *
             * @returns {number|boolean}
             */
            getArticlePosition() {
                // Get the article slug.
                let current = this.$route.fullPath.substr(1)

                // Return where we are in a flat array of articles.
                return _.findIndex(this.$store.state.searchArticles, (article) => {
                    return article.slug === current
                })

            }
        }
    }
</script>
{'fraction_non_alphanumeric': 0.10574572127139364, 'fraction_numerical': 0.0026487367563162185, 'mean_word_length': 1.3911349245007307, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 33, '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': '4905993', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1163, 'n_words': 272}