<commit_before>import React, { Component } from "react";
import { connect } from "react-redux";
import { push } from "react-router-redux";
import PropTypes from "prop-types";

import { updateSelectedPreviewPage } from "../config/actions";

import Select from "../components/Select";

const propTypes = {
    dispatch: PropTypes.func.isRequired,
    preview: PropTypes.object.isRequired,
    rootPath: PropTypes.string.isRequired,
    workingOn: PropTypes.object.isRequired
};

export class PreviewNav extends Component {
    constructor(props) {
        super(props);

        this.handleSelectChange = this.handleSelectChange.bind(this);
    }

    mapPagesToSelect(pages) {
        if (pages) {
            try {
                return pages.map(page => {
                    return {
                        id: page.uri,
                        name: this.createPageTitle(page)
                    };
                });
            } catch (err) {
                console.error("Error mapping pages to select", err);
            }
        }
        return;
    }<commit_msg>Add mapping for data vis pages<commit_after>import React, { Component } from "react";
import { connect } from "react-redux";
import { push } from "react-router-redux";
import PropTypes from "prop-types";

import { updateSelectedPreviewPage } from "../config/actions";

import Select from "../components/Select";

const propTypes = {
    dispatch: PropTypes.func.isRequired,
    preview: PropTypes.object.isRequired,
    rootPath: PropTypes.string.isRequired,
    workingOn: PropTypes.object.isRequired
};

export class PreviewNav extends Component {
    constructor(props) {
        super(props);

        this.handleSelectChange = this.handleSelectChange.bind(this);
    }

    mapPagesToSelect(pages) {
        if (pages) {
            try {
                return pages.map(page => {
                    if (page.type === "visualisation" && page.files) {
                        return {
                            id: page.uri,
                            name: this.createPageTitle(page),
                            isGroup: true,
                            groupOptions: page.files.map(file => {
                                return { id: `/visualisations/dvc221/${file}`, name: file };
                            })
                        };
                    }
                    return {
                        id: page.uri,
                        name: this.createPageTitle(page)
                    };
                });
            } catch (err) {
                console.error("Error mapping pages to select", err);
            }
        }
        return;
    }
{'fraction_non_alphanumeric': 0.1054013503375844, 'fraction_numerical': 0.0011252813203300824, 'mean_word_length': 1.564423076923077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6934034', 'n_tokens_mistral': 678, 'n_tokens_neox': 659, 'n_words': 151}