<commit_before>import { connect } from 'react-redux'

import List from 'butter-component-list';
import ContentDetail from 'butter-component-content-details';
import ButterSettings from 'butter-component-settings';

import settingsTabs from './settings-tabs'

import ListView from './components/listview'
import PlayerView from './components/player'
import {actionDispatcher} from './redux/persist'

const locationToTabId = (location) => (
    location.pathname.split('/').pop()
)

const tabConnect = ((mapStateToProps, mapDispatchToProps) => (
    connect(({tabs, collections, cache,  ...state}, {location, ...props}) => {
        const tab = tabs[locationToTabId(location)]
        const cols = tab.providers.map(provider => collections[provider])

        const tabState = cols.reduce((acc, col) => ({
            items: acc.items.concat(
                col.items.map(i => cache[i])
            ),
            isFetching: acc.isFetching ? acc.isFetching : col.isFetching,
            failed: acc.failed ? acc.failed : col.failed
        }), {items: []})

        return mapStateToProps({
            ...state,
            tabState

        }, {
            ...props,
            location
        })
    }, mapDispatchToProps)
))

const ListContainer = tabConnect(
    ({tabState, persist}) => ({
        ...tabState,
        persist
    }),
    (dispatch, {location, history}) => ({
        actions: {
            show: (item) => history.push(`/movies/${locationToTabId(location)}/${item.id}`),
            ...actionDispatcher(dispatch)
        }
    })
)(List)

const ButterSettingsContainer = connect (({settings}, props) => ({
    location: props.location,
    navbar: {goBack: {
        action: () => (props.history.goBack()),
    }},
    tabs: settingsTabs,
    settings<commit_msg>hook-in play action for list<commit_after>import { connect } from 'react-redux'

import List from 'butter-component-list';
import ContentDetail from 'butter-component-content-details';
import ButterSettings from 'butter-component-settings';

import settingsTabs from './settings-tabs'

import ListView from './components/listview'
import PlayerView from './components/player'
import {actionDispatcher} from './redux/persist'

const locationToTabId = (location) => (
    location.pathname.split('/').pop()
)

const tabConnect = ((mapStateToProps, mapDispatchToProps) => (
    connect(({tabs, collections, cache,  ...state}, {location, ...props}) => {
        const tab = tabs[locationToTabId(location)]
        const cols = tab.providers.map(provider => collections[provider])

        const tabState = cols.reduce((acc, col) => ({
            items: acc.items.concat(
                col.items.map(i => cache[i])
            ),
            isFetching: acc.isFetching ? acc.isFetching : col.isFetching,
            failed: acc.failed ? acc.failed : col.failed
        }), {items: []})

        return mapStateToProps({
            ...state,
            tabState

        }, {
            ...props,
            location
        })
    }, mapDispatchToProps)
))

const ListContainer = tabConnect(
    ({tabState, persist}) => ({
        ...tabState,
        persist
    }),
    (dispatch, {location, history}) => ({
        actions: {
            show: (item) => history.push(`/movies/${locationToTabId(location)}/${item.id}`),
            play: (item) => history.push(`/movies/${locationToTabId(location)}/${item.id}/play`),
            ...actionDispatcher(dispatch)
        }
    })
)(List)

const ButterSettingsContainer = connect (({settings}, props) => ({
    location: props.location,
    navbar: {goBack: {
        action: () => (props.history.goBack()),
    }},
    tabs: settingsTabs,
    settings
{'fraction_non_alphanumeric': 0.15353371242891958, 'fraction_numerical': 0.0, 'mean_word_length': 2.54510556621881, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, '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': '4778330', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1053, 'n_words': 220}