<commit_before>import React from 'react'
import Sidebar from './Sidebar.js'
import Edgenote from './Edgenote.js'
import LoadingIcon from './LoadingIcon.js'
import gatherEdgenotes from '../gatherEdgenotes.js'
import { I18n } from "./I18n.js"

class EdgenoteGallery extends React.Component {
  constructor() {
    super()
    this.state = {
      edgenote_ids: []
    }
  }

  setEdgenotes(contents) {
    let edgenote_ids = gatherEdgenotes(contents)
    this.setState({edgenote_ids: edgenote_ids})
  }

  componentDidMount() {
    let contents = window.caseData.segments.length > 0 ? window.caseData.segments.map((x) => {return x[1]}) : ""
    this.setEdgenotes(contents)
  }

  renderEdgenotes() {
    let block
    if (this.state.edgenote_ids.length != 0) {
      block = <div className="edgenotes">
                {
                  this.state.edgenote_ids.map( (id) => {
                    return (
                      <Edgenote
                        random={true}
                        path_prefix={""}
                        selected_id={this.state.selected_id}
                        id={id}
                        key={`edgenote_${id}`}
                        handleHoverID={this.props.id}
                      />
                    )
                  } )
                }
              </div>
    } else {
      block =  <LoadingIcon />
    }
    return block
  }

  render() {
    return (
      <div className="window">
        <Sidebar
          caseID={this.props.params.id}
          title={this.props.title}
          metadata={this.props.metadata}
        />
        <main id="EdgenoteGallery">
          <div id="EdgenoteGalleryHeader">
            <h1><I18n meaning="edgenote_gallery" /></h1>
          </div>
          {this.renderEdgenotes()}
        </main>
        {this.props.children}
      </div>
    )<commit_msg>Shows the cover image on the Edgenote Gallery page.<commit_after>import React from 'react'
import Sidebar from './Sidebar.js'
import Edgenote from './Edgenote.js'
import LoadingIcon from './LoadingIcon.js'
import gatherEdgenotes from '../gatherEdgenotes.js'
import { I18n } from "./I18n.js"

class EdgenoteGallery extends React.Component {
  constructor() {
    super()
    this.state = {
      edgenote_ids: []
    }
  }

  setEdgenotes(contents) {
    let edgenote_ids = gatherEdgenotes(contents)
    this.setState({edgenote_ids: edgenote_ids})
  }

  componentDidMount() {
    let contents = window.caseData.segments.length > 0 ? window.caseData.segments.map((x) => {return x[1]}) : ""
    this.setEdgenotes(contents)
  }

  renderEdgenotes() {
    let block
    if (this.state.edgenote_ids.length != 0) {
      block = <div className="edgenotes">
                {
                  this.state.edgenote_ids.map( (id) => {
                    return (
                      <Edgenote
                        random={true}
                        path_prefix={""}
                        selected_id={this.state.selected_id}
                        id={id}
                        key={`edgenote_${id}`}
                        handleHoverID={this.props.id}
                      />
                    )
                  } )
                }
              </div>
    } else {
      block =  <LoadingIcon />
    }
    return block
  }

  render() {
    let {slug, coverURL, title, segmentTitles} = this.props
    let selectedSegment = parseInt(this.props.params.selectedSegment) - 1
    return (
      <div className="window">
        <Sidebar
          slug={slug}
          coverURL={coverURL}
          title={title}
          segmentTitles={segmentTitles}
          selectedSegment={selectedSegment}
        />
        <main id="EdgenoteGallery">
          <div id="EdgenoteGalleryHeader">
            <h1><I18n meaning="edgenote_gallery" /></h1>
          </div>
          {this.renderEdgenotes()}
        </main>
        {this.props.children}
      </div>
    )
{'fraction_non_alphanumeric': 0.12226184411614875, 'fraction_numerical': 0.0058583800305654615, 'mean_word_length': 1.6302746148693905, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 37, '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': '5985764', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1164, 'n_words': 204}