<commit_before>/* global config */
import 'isomorphic-fetch';
import { Router } from 'routes';
import { toastr } from 'react-redux-toastr';

// Services
import UserService from 'services/UserService';
import GraphService from 'services/GraphService';

import { BASEMAPS } from 'components/ui/map/constants';

/**
 * CONSTANTS
*/
const GET_DATASETS_SUCCESS = 'explore/GET_DATASETS_SUCCESS';
const GET_DATASETS_ERROR = 'explore/GET_DATASETS_ERROR';
const GET_DATASETS_LOADING = 'explore/GET_DATASETS_LOADING';

const GET_FAVORITES_SUCCESS = 'explore/GET_FAVORITES_SUCCESS';
const GET_FAVORITES_ERROR = 'explore/GET_FAVORITES_ERROR';
const GET_FAVORITES_LOADING = 'explore/GET_FAVORITES_LOADING';

const SET_DATASETS_PAGE = 'explore/SET_DATASETS_PAGE';
const SET_DATASETS_SEARCH_FILTER = 'explore/SET_DATASETS_SEARCH_FILTER';
const SET_FILTERS_LOADING = 'explore/SET_FILTERS_LOADING';

const SET_SORTING_ORDER = 'explore/SET_SORTING_ORDER';
const SET_SORTING_DATASETS = 'explore/SET_SORTING_DATASETS';
const SET_SORTING_LOADING = 'explore/SET_SORTING_LOADING';

const SET_DATASETS_FILTERED_BY_CONCEPTS = 'explore/SET_DATASETS_FILTERED_BY_CONCEPTS';
const SET_DATASETS_MODE = 'explore/SET_DATASETS_MODE';

const SET_LAYERGROUP_TOGGLE = 'explore/SET_LAYERGROUP_TOGGLE';
const SET_LAYERGROUP_VISIBILITY = 'explore/SET_LAYERGROUP_VISIBILITY';
const SET_LAYERGROUP_ACTIVE_LAYER = 'explore/SET_LAYERGROUP_ACTIVE_LAYER';
const SET_LAYERGROUP_ORDER = 'explore/SET_LAYERGROUP_ORDER';
const SET_LAYERGROUP_OPACITY = 'explore/SET_LAYERGROUP_OPACITY';
const SET_LAYERGROUPS = 'explore/SET_LAYERGROUPS';

const SET_SIDEBAR = 'explore/SET_SIDEBAR';

const SET_ZOOM = 'explore/SET_ZOOM';
const SET_LATLNG = 'explore/SET_LATLNG';
const SET_BASEMAP = 'explore/SET_BASEMAP';
const SET_LABELS = 'explore/SET_LABELS';

/**
 * Layer
 * @typedef {Object} Layer
 * @property {string} id - ID of the associated layer
 * @property {boolean} active - If the layer is the one to be displayed
 */

/**
 * Group of layers
 * @typedef {Object} LayerGroup
 * @property {string} dataset - ID of the associated dataset
 * @property {boolean} visible - Indicates whether the group is visible
 * @property {Layer[]} layers - Actual list of layers
 */

/**
 * REDUCER
*/
const initialState = {
  datasets: {
    list: [],
    loading: false,
    error: false,
    page: 1,
    limit: 9,
    mode: 'grid' // 'grid' or 'list'
  },
  // List of layers (corresponding to the datasets
  // set as active)
  //
  // NOTES:
  //  * If a layer is removed from the map, it is removed
  // from this list
  //  * This list does not contain the attributes of the
  // layers, just the information necessary to retrieve
  // the layers in the list of datasets
  //  * The groups are sorted according to the order the
  // user has set in the legend
  /** @type {LayerGroup[]} */
  layers: [],
  filters: {
    search: null,
    datasetsFilteredByConcepts: [],
    loading: false
  },
  sidebar: {
    open: true,
    width: 0
  },
  zoom: 3,
  latLng: { lat: 0, lng: 0 },
  basemap: BASEMAPS.dark,
  basemapControl: {<commit_msg>Explore: Change dataset limit per page to 12<commit_after>/* global config */
import 'isomorphic-fetch';
import { Router } from 'routes';
import { toastr } from 'react-redux-toastr';

// Services
import UserService from 'services/UserService';
import GraphService from 'services/GraphService';

import { BASEMAPS } from 'components/ui/map/constants';

/**
 * CONSTANTS
*/
const GET_DATASETS_SUCCESS = 'explore/GET_DATASETS_SUCCESS';
const GET_DATASETS_ERROR = 'explore/GET_DATASETS_ERROR';
const GET_DATASETS_LOADING = 'explore/GET_DATASETS_LOADING';

const GET_FAVORITES_SUCCESS = 'explore/GET_FAVORITES_SUCCESS';
const GET_FAVORITES_ERROR = 'explore/GET_FAVORITES_ERROR';
const GET_FAVORITES_LOADING = 'explore/GET_FAVORITES_LOADING';

const SET_DATASETS_PAGE = 'explore/SET_DATASETS_PAGE';
const SET_DATASETS_SEARCH_FILTER = 'explore/SET_DATASETS_SEARCH_FILTER';
const SET_FILTERS_LOADING = 'explore/SET_FILTERS_LOADING';

const SET_SORTING_ORDER = 'explore/SET_SORTING_ORDER';
const SET_SORTING_DATASETS = 'explore/SET_SORTING_DATASETS';
const SET_SORTING_LOADING = 'explore/SET_SORTING_LOADING';

const SET_DATASETS_FILTERED_BY_CONCEPTS = 'explore/SET_DATASETS_FILTERED_BY_CONCEPTS';
const SET_DATASETS_MODE = 'explore/SET_DATASETS_MODE';

const SET_LAYERGROUP_TOGGLE = 'explore/SET_LAYERGROUP_TOGGLE';
const SET_LAYERGROUP_VISIBILITY = 'explore/SET_LAYERGROUP_VISIBILITY';
const SET_LAYERGROUP_ACTIVE_LAYER = 'explore/SET_LAYERGROUP_ACTIVE_LAYER';
const SET_LAYERGROUP_ORDER = 'explore/SET_LAYERGROUP_ORDER';
const SET_LAYERGROUP_OPACITY = 'explore/SET_LAYERGROUP_OPACITY';
const SET_LAYERGROUPS = 'explore/SET_LAYERGROUPS';

const SET_SIDEBAR = 'explore/SET_SIDEBAR';

const SET_ZOOM = 'explore/SET_ZOOM';
const SET_LATLNG = 'explore/SET_LATLNG';
const SET_BASEMAP = 'explore/SET_BASEMAP';
const SET_LABELS = 'explore/SET_LABELS';

/**
 * Layer
 * @typedef {Object} Layer
 * @property {string} id - ID of the associated layer
 * @property {boolean} active - If the layer is the one to be displayed
 */

/**
 * Group of layers
 * @typedef {Object} LayerGroup
 * @property {string} dataset - ID of the associated dataset
 * @property {boolean} visible - Indicates whether the group is visible
 * @property {Layer[]} layers - Actual list of layers
 */

/**
 * REDUCER
*/
const initialState = {
  datasets: {
    list: [],
    loading: false,
    error: false,
    page: 1,
    limit: 12,
    mode: 'grid' // 'grid' or 'list'
  },
  // List of layers (corresponding to the datasets
  // set as active)
  //
  // NOTES:
  //  * If a layer is removed from the map, it is removed
  // from this list
  //  * This list does not contain the attributes of the
  // layers, just the information necessary to retrieve
  // the layers in the list of datasets
  //  * The groups are sorted according to the order the
  // user has set in the legend
  /** @type {LayerGroup[]} */
  layers: [],
  filters: {
    search: null,
    datasetsFilteredByConcepts: [],
    loading: false
  },
  sidebar: {
    open: true,
    width: 0
  },
  zoom: 3,
  latLng: { lat: 0, lng: 0 },
  basemap: BASEMAPS.dark,
  basemapControl: {
{'fraction_non_alphanumeric': 0.1061732385261797, 'fraction_numerical': 0.0024240465416936006, 'mean_word_length': 4.646897810218978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6097588', 'n_tokens_mistral': 2234, 'n_tokens_neox': 2205, 'n_words': 529}