 import Col from 'react-bootstrap/lib/Col'
 
 import {Link} from 'react-router-dom'
+import { LinkContainer } from 'react-router-bootstrap'
 
 import {getClassStartingFromJuly} from '../lib/graduateYearToClass'
 import outcomeToText from '../lib/outcomeToText'

            hljs.highlightBlock(el)

    render: () ->
        <div>
            <pre dangerouslySetInnerHTML={{__html: @props.submit.source }} className={"sourcecode " + langClass(@props.submit.language)}></pre>
            <div><a href={"/api/submitSource/#{@props.submit._id}"}>Скачать</a></div>
        </div>

export SubmitHeader = (props) ->

export class SubmitSource extends React.Component
    constructor: (props) ->
        super(props)
        @state =
            copied: false
        @copy = @copy.bind this

    copy: () ->
        (e) =>
            navigator.clipboard.writeText @props.submit.sourceRaw
            @setState
                copied: true

    componentDidMount: ->
        @doHighlight()

    componentDidUpdate:  (prevProps, prevState) ->
        if @props.submit._id != prevProps.submit._id
            @state =
                copied: false
            @doHighlight()

    doHighlight: ->
