<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 { CatalogEntryView } from "readium-desktop/common/views/catalog";

import PublicationCard from "readium-desktop/renderer/components/publication/PublicationCard";

import Slider from "readium-desktop/renderer/components/utils/Slider";

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

import { Link, RouteComponentProps } from "react-router-dom";

import CatalogMenu from "readium-desktop/renderer/components/publication/menu/CatalogMenu";

import GridTagLayout from "./GridTagLayout";
import SortMenu from "./SortMenu";

interface GridViewProps extends RouteComponentProps {
    catalogEntries: CatalogEntryView[];
}

interface GridViewState {
    tabEntries: CatalogEntryView[];
    status: string;
}

export default class GridView extends React.Component<GridViewProps, GridViewState> {
    public constructor(props: any) {
        super(props);

        this.state = {
            tabEntries: this.props.catalogEntries.slice(),
            status: "count",
        };
        this.sortByAlpha = this.sortByAlpha.bind(this);
        this.sortbyCount = this.sortbyCount.bind(this);
    }

    public render(): React.ReactElement<{}> {
        return (
            <>
                { this.props.catalogEntries.map((entry, i: number) => {
                        return (
                            <section key={ i }>
<<<<<<< HEAD
                                <div className={styles.title}>
=======
                            {
                                i <= 1 ? (
                                <div className={ styles.title }>
>>>>>>> upstream/develop
                                    <h1>{ entry.title }</h1>
                                </div>
                                ) :
                                (<></>)
                            }
                            {
                                i <= 1 ? (
                                    <Slider
                                        className={ styles.slider }
                                        content={ entry.publications.map((pub) =>
                                            <PublicationCard
                                                key={ pub.identifier }
                                                publication={ pub }
                                                menuContent={ CatalogMenu }
                                            />,
                                        )}
                                    />
                                ) :
                                (<></>)
                            }
                            </section>
                        );
                })}
                <GridTagLayout
                entries={this.state.tabEntries}
                content={
                    <SortMenu
                        onClickAlphaSort={this.sortByAlpha}
                        onClickCountSort={this.sortbyCount}
                    />}
                />
            </>
        );
    }

    private sortbyCount() {
        this.setState({
            status: "count",
        });
        this.state.tabEntries.sort((a, b) => {
            if (a.totalCount < b.totalCount) {
                return (1);
            } else if (a.totalCount > b.totalCount) {
                return (-1);
            }
            return (0);
        });
    }

    private sortByAlpha() {
        this.setState({
            status: "alpha",
        });
        this.state.tabEntries.sort((a, b) => {
            if (a.title > b.title) {
                return (1);
            } else if (a.title < b.title) {
                return (-1);
            }
            return (0);
        });
    }

}
<commit_msg>resolve conflict in Gridview 2.0<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 { CatalogEntryView } from "readium-desktop/common/views/catalog";

import PublicationCard from "readium-desktop/renderer/components/publication/PublicationCard";

import Slider from "readium-desktop/renderer/components/utils/Slider";

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

import { Link, RouteComponentProps } from "react-router-dom";

import CatalogMenu from "readium-desktop/renderer/components/publication/menu/CatalogMenu";

import GridTagLayout from "./GridTagLayout";
import SortMenu from "./SortMenu";

interface GridViewProps extends RouteComponentProps {
    catalogEntries: CatalogEntryView[];
}

interface GridViewState {
    tabEntries: CatalogEntryView[];
    status: string;
}

export default class GridView extends React.Component<GridViewProps, GridViewState> {
    public constructor(props: any) {
        super(props);

        this.state = {
            tabEntries: this.props.catalogEntries.slice(),
            status: "count",
        };
        this.sortByAlpha = this.sortByAlpha.bind(this);
        this.sortbyCount = this.sortbyCount.bind(this);
    }

    public render(): React.ReactElement<{}> {
        return (
            <>
                { this.props.catalogEntries.map((entry, i: number) => {
                        return (
                            <section key={ i }>
                            {
                                i <= 1 ? (
                                <div className={ styles.title }>
                                    <h1>{ entry.title }</h1>
                                </div>
                                ) :
                                (<></>)
                            }
                            {
                                i <= 1 ? (
                                    <Slider
                                        className={ styles.slider }
                                        content={ entry.publications.map((pub) =>
                                            <PublicationCard
                                                key={ pub.identifier }
                                                publication={ pub }
                                                menuContent={ CatalogMenu }
                                            />,
                                        )}
                                    />
                                ) :
                                (<></>)
                            }
                            </section>
                        );
                })}
                <GridTagLayout
                entries={this.state.tabEntries}
                content={
                    <SortMenu
                        onClickAlphaSort={this.sortByAlpha}
                        onClickCountSort={this.sortbyCount}
                    />}
                />
            </>
        );
    }

    private sortbyCount() {
        this.setState({
            status: "count",
        });
        this.state.tabEntries.sort((a, b) => {
            if (a.totalCount < b.totalCount) {
                return (1);
            } else if (a.totalCount > b.totalCount) {
                return (-1);
            }
            return (0);
        });
    }

    private sortByAlpha() {
        this.setState({
            status: "alpha",
        });
        this.state.tabEntries.sort((a, b) => {
            if (a.title > b.title) {
                return (1);
            } else if (a.title < b.title) {
                return (-1);
            }
            return (0);
        });
    }

}

{'fraction_non_alphanumeric': 0.10255465487595185, 'fraction_numerical': 0.0036845983787767134, 'mean_word_length': 1.091703056768559, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5991426', 'n_tokens_mistral': 1908, 'n_tokens_neox': 1820, 'n_words': 414}