<commit_before><commit_msg>Added deck lib<commit_after>import React, { Component, PropTypes } from 'react';
import DeckActions from '../../actions/DeckActions';
import DeckStore from '../../stores/DeckStore';

import Link from '../Link';


import { Button, Glyphicon } from 'react-bootstrap';
import { Panel } from 'react-bootstrap';

import { Modal, Input } from 'react-bootstrap';

class DeckListItem extends Component {
  constructor(props) {
    super(props);
    this.state = { showModal: false };
  }

  close() {
    this.setState({ showModal: false });
  }

  open() {
    this.setState({ showModal: true });
  }
  render() {
    const deck = this.props.deck;
    const userUrl = `/users/${deck.owner}`;
    const deckUrl = `/decks/${deck.gid}`;
    const title = (
      <h4><Glyphicon glyph="align-justify"/>
      {' '}
      <a href={userUrl} onClick={Link.handleClick}>{deck.owner}</a>
      <span>/</span>
      <a href={deckUrl} onClick={Link.handleClick}>{deck.name}</a>
      </h4>
    );
    const subscribers = (deck.subscribers)? (
      <span>{deck.subscribers.length} Subscribers</span>
    ): <span>No Subscribers</span>;
    const cards = (deck.cids)? (
      <span>{deck.cids.length} Cards</span>
    ): <span>No Cards</span>;
    const keywords = (deck.keywords)? <span>Keywords: {
        deck.keywords.map((word) => <span><a>{word}</a>{', '}</span>)
    }</span>: <span>No Keywords</span>;
    return (
      <div>
      <Panel header={title}>
      <blockquote>Description: {deck.description}</blockquote>
      <Button onClick={this.open.bind(this)}>Get Link</Button><br />
      {keywords}<br />
      {subscribers}<br />
      {cards}
      </Panel>
      <Modal show={this.state.showModal} onHide={this.close.bind(this)}>
      <Modal.Header closeButton>
      <Modal.Title>Paste this link into AnkiHub addon</Modal.Title>
      </Modal.Header>
      <Modal.Body>
      <Input type="text" value={`${location.origin}/decks/${deck.gid}`} />
      </Modal.Body>
      </Modal>
      </div>
    );
  }
}
export default DeckListItem;

{'fraction_non_alphanumeric': 0.18574199806013578, 'fraction_numerical': 0.0009699321047526673, 'mean_word_length': 2.998062015503876, 'pattern_counts': {'":': 0, '<': 48, '<?xml version=': 0, '>': 49, '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': '3817307', 'n_tokens_mistral': 686, 'n_tokens_neox': 680, 'n_words': 132}