"use strict"; import classNames from "classnames"; import ResultMixin from "./resultmixin.jsx"; import Panel from "./panel.jsx"; import PropTypes from "prop-types"; import createReactClass from "create-react-class"; import {CSSTransition, TransitionGroup} from "react-transition-group"; var PT = PropTypes; var Results = createReactClass({ propTypes: { collhits: PT.object.isRequired, searchedLanguage: PT.array.isRequired, toggleResultModal: PT.func.isRequired, getDownloadLink: PT.func.isRequired, getToWeblichtLink: PT.func.isRequired, queryTypeId: PT.string.isRequired, }, mixins: [ResultMixin], renderPanelInfo: function(corpusHit) { var corpus = corpusHit.corpus; var inline = {display:"inline-block"}; return (
{" "}
); }, renderResultPanel: function(corpusHit) { if (corpusHit.kwics.length === 0 && !corpusHit.exception && corpusHit.diagnostics.length === 0) { return false; } return ( {this.renderPanelBody(corpusHit)} ); }, renderProgressMessage: function() { var collhits = this.props.collhits; var done = collhits.results.length - collhits.inProgress; var msg = collhits.hits + " matching collections found in " + done + " searched collections"; var percents = Math.round(100 * collhits.hits / collhits.results.length); var styleperc = {width: percents+"%"}; return (
{msg}
{collhits.inProgress > 0 ?
{percents > 2 ? false :
}
: false}
); }, render: function() { var collhits = this.props.collhits; if (!collhits.results) { return false; } var showprogress = collhits.inProgress > 0; return (
{ showprogress ? this.renderProgressMessage() :
}
{ showprogress ? false :
{collhits.hits + " matching collections found"}
} { collhits.hits === 0 ? false :
{this.renderDisplayKWIC()} {this.props.queryTypeId !== "fcs" ? "" : this.renderDisplayADV()} { collhits.inProgress === 0 ?
{this.renderDownloadLinks()}
:false }
}
{collhits.results.map(this.renderResultPanel)}
); } }); var _ = window._ = window._ || { keys: function() { var ret = []; for (var x in o) { if (o.hasOwnProperty(x)) { ret.push(x); } } return ret; }, pairs: function(o){ var ret = []; for (var x in o) { if (o.hasOwnProperty(x)) { ret.push([x, o[x]]); } } return ret; }, values: function(o){ var ret = []; for (var x in o) { if (o.hasOwnProperty(x)) { ret.push(o[x]); } } return ret; }, uniq: function(a) { var r = []; for (var i = 0; i < a.length; i++) { if (r.indexOf(a[i]) < 0) { r.push(a[i]); } } return r; }, }; module.exports = Results;