<commit_before>var _ = require('lodash');
var React = require('react');
var api = require('data/api');
var RegionTitleMenu     = require('component/RegionTitleMenu.jsx');
var IndicatorDropdownMenu = require('component/IndicatorDropdownMenu.jsx');
var CampaignDropdownMenu = require('component/CampaignDropdownMenu.jsx');
var Modal = require('react-modal');

var appElement = document.getElementById('main');
Modal.setAppElement(appElement);
Modal.injectCSS();

var SubmissionModal = React.createClass({
	propTypes: {
	  source_submission_id 	: React.PropTypes.number.isRequired,
    },

	getInitialState: function() {
		return {
				modalIsOpen: false,
			 	source_submission_id: null
			}
	},

  openModal: function() {
    this.setState({ modalIsOpen: true });
		console.log('call the api and get the image data..')

    // api.get_source_object_map({id: this.props.source_object_map_id})
		// .then(response => this.setState({
		// 		source_object_code: response.objects[0].source_object_code,
		// 		content_type: response.objects[0].content_type,
		// }));
  },

  closeModal: function() {
    this.setState({modalIsOpen: false});
  },


render : function(){

  var source_submission_id = this.props.source_submission_id
  var modalStyle = {width:400, height:300, marginLeft:400};

	console.log('raaaeeender')

  return <div>
						<button
							className="tiny"
							onClick={this.openModal}
						> view raw data!
						</button>
	          <Modal
	            style={modalStyle}
	            isOpen={this.state.modalIsOpen}
	            onRequestClose={this.closeModal}
	          >
	              <h1> Ssource_submission_id: {source_submission_id} </h1>
	          </Modal>
					</div>

},
});

module.exports = SubmissionModal;
<commit_msg>get image rendering in pop up<commit_after>var _ = require('lodash');
var React = require('react');
var api = require('data/api');
var RegionTitleMenu     = require('component/RegionTitleMenu.jsx');
var IndicatorDropdownMenu = require('component/IndicatorDropdownMenu.jsx');
var CampaignDropdownMenu = require('component/CampaignDropdownMenu.jsx');
var Modal = require('react-modal');

var appElement = document.getElementById('main');
Modal.setAppElement(appElement);
Modal.injectCSS();

var SubmissionModal = React.createClass({
	propTypes: {
	  source_submission_id 	: React.PropTypes.number.isRequired,
    },

	getInitialState: function() {
		return {
				modalIsOpen: false,
			 	source_submission_id: null
			}
	},

  openModal: function() {
    this.setState({ modalIsOpen: true });
		console.log('call the api and get the image data..')

    api.admin.submission({id: this.props.source_submission_id})
		.then(response => this.setState({
				img_location: response.objects[0].img_location,
		}));
  },

  closeModal: function() {
    this.setState({modalIsOpen: false});
  },


render : function(){

  var source_submission_id = this.props.source_submission_id
  var modalStyle = {width:400, height:300, marginLeft:400};

  return <div>
						<button
							className="tiny"
							onClick={this.openModal}
						> view raw data!
						</button>
	          <Modal
	            style={modalStyle}
	            isOpen={this.state.modalIsOpen}
	            onRequestClose={this.closeModal}
	          >
	              <h1> Source_submission_id: {source_submission_id} </h1>

								<img src={this.state.img_location} />

	          </Modal>
					</div>

},
});

module.exports = SubmissionModal;

{'fraction_non_alphanumeric': 0.13425925925925927, 'fraction_numerical': 0.007233796296296296, 'mean_word_length': 3.454896907216495, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 22, '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': '6602644', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1072, 'n_words': 194}