<commit_before>// ==LICENSE-BEGIN==
// Copyright 2017 European Digital Reading Lab. All rights reserved.
// Licensed to the Readium Foundation under one or more contributor license agreements.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file exposed on Github (readium) in the project repository.
// ==LICENSE-END==

import * as React from "react";

import { Store } from "redux";

import { History } from "history";

import { ConnectedRouter } from "connected-react-router";

import Dropzone from "react-dropzone";

import { RootState } from "readium-desktop/renderer/redux/states";

import { lazyInject } from "readium-desktop/renderer/di";

import PageManager from "readium-desktop/renderer/components/PageManager";

import { Provider } from "react-redux";

import DialogManager from "readium-desktop/renderer/components/dialog/DialogManager";

import * as dialogActions from "readium-desktop/common/redux/actions/dialog";

import { DialogType } from "readium-desktop/common/models/dialog";

import SameFileImportManager from "./utils/SameFileImportManager";

import * as styles from "readium-desktop/renderer/assets/styles/app.css";

export default class App extends React.Component<any, undefined> {
    @lazyInject("store")
    private store: Store<RootState>;

    @lazyInject("history")
    private history: History;

    constructor(props: any) {
        super(props);

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

    // Called when files are droped on the dropzone
    public onDrop(acceptedFiles: File[]) {
        this.store.dispatch(
            dialogActions.open(
                DialogType.FileImport,
                {
                    files: acceptedFiles.map((file) => {
                        return {
                            name: file.name,
                            path: file.path,
                        };
                    }),
                },
        ));
    }

    public render(): React.ReactElement<{}> {
        return (
            <Provider store={ this.store }>
                <ConnectedRouter history={ this.history }>
                    <div className={styles.root}>
                        <Dropzone
                            onDrop={ this.onDrop }
                        >
                            {({getRootProps, getInputProps}) => {
                                const rootProps = getRootProps({onClick: (e) => e.stopPropagation()});
                                rootProps.tabIndex = -1;
                                return <div
                                    {...rootProps}
                                    style={{
                                        position: "absolute",
                                        top: 0,
                                        bottom: 0,
                                        left: 0,
                                        right: 0,
                                    }}
                                >
                                    <input aria-hidden {...getInputProps({onClick: (evt) => evt.preventDefault()})} />
                                    <PageManager/>
                                    <DialogManager />
                                    <SameFileImportManager />
                                </div>;
                            }}
                        </Dropzone>
                    </div>
                </ConnectedRouter>
            </Provider>
        );
    }
}<commit_msg>fix horizontal scrollbar<commit_after>// ==LICENSE-BEGIN==
// Copyright 2017 European Digital Reading Lab. All rights reserved.
// Licensed to the Readium Foundation under one or more contributor license agreements.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file exposed on Github (readium) in the project repository.
// ==LICENSE-END==

import * as React from "react";

import { Store } from "redux";

import { History } from "history";

import { ConnectedRouter } from "connected-react-router";

import Dropzone from "react-dropzone";

import { RootState } from "readium-desktop/renderer/redux/states";

import { lazyInject } from "readium-desktop/renderer/di";

import PageManager from "readium-desktop/renderer/components/PageManager";

import { Provider } from "react-redux";

import DialogManager from "readium-desktop/renderer/components/dialog/DialogManager";

import * as dialogActions from "readium-desktop/common/redux/actions/dialog";

import { DialogType } from "readium-desktop/common/models/dialog";

import SameFileImportManager from "./utils/SameFileImportManager";

import * as styles from "readium-desktop/renderer/assets/styles/app.css";

export default class App extends React.Component<any, undefined> {
    @lazyInject("store")
    private store: Store<RootState>;

    @lazyInject("history")
    private history: History;

    constructor(props: any) {
        super(props);

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

    // Called when files are droped on the dropzone
    public onDrop(acceptedFiles: File[]) {
        this.store.dispatch(
            dialogActions.open(
                DialogType.FileImport,
                {
                    files: acceptedFiles.map((file) => {
                        return {
                            name: file.name,
                            path: file.path,
                        };
                    }),
                },
        ));
    }

    public render(): React.ReactElement<{}> {
        return (
            <Provider store={ this.store }>
                <ConnectedRouter history={ this.history }>
                    <div className={styles.root}>
                        <Dropzone
                            onDrop={ this.onDrop }
                        >
                            {({getRootProps, getInputProps}) => {
                                const rootProps = getRootProps({onClick: (e) => e.stopPropagation()});
                                rootProps.tabIndex = -1;
                                return <div
                                    {...rootProps}
                                    style={{
                                        position: "absolute",
                                        overflowX: "hidden",
                                        top: 0,
                                        bottom: 0,
                                        left: 0,
                                        right: 0,
                                    }}
                                >
                                    <input aria-hidden {...getInputProps({onClick: (evt) => evt.preventDefault()})} />
                                    <PageManager/>
                                    <DialogManager />
                                    <SameFileImportManager />
                                </div>;
                            }}
                        </Dropzone>
                    </div>
                </ConnectedRouter>
            </Provider>
        );
    }
}
{'fraction_non_alphanumeric': 0.0977677309974569, 'fraction_numerical': 0.002543091268719977, 'mean_word_length': 1.2740122068743978, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 25, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '222890', 'n_tokens_mistral': 1657, 'n_tokens_neox': 1585, 'n_words': 408}