<commit_before>path = require 'path'
React = require 'react'
{RetinaImg, Flexbox} = require 'nylas-component-kit'
{Utils,
 Actions,
 FileUploadStore} = require 'nylas-exports'

class FileUpload extends React.Component
  @displayName: 'FileUpload'

  render: =>
    <div className={"file-wrap file-upload"}>
      <div className="inner">
        <Flexbox direction="row" style={alignItems: 'center'}>
          <RetinaImg className="file-icon"
                     fallback="file-fallback.png"
                     mode={RetinaImg.Mode.ContentPreserve}
                     name="file-#{@_extension()}.png"/>
          <span className="file-name">
            <span className="uploading">{@props.upload.filename}</span>
          </span>
          <div className="file-action-icon" onClick={@_onClickRemove}>
            <RetinaImg name="remove-attachment.png" mode={RetinaImg.Mode.ContentDark} />
          </div>
        </Flexbox>
      </div>
    </div>

  _onClickRemove: (event) =>
    event.preventDefault()
    Actions.removeAttachment @props.upload

  _extension: =>
    path.extname(@props.upload.filename)[1..-1]

module.exports = FileUpload
<commit_msg>fix(uploads): Display icon regardless of ext capitalization<commit_after>path = require 'path'
React = require 'react'
{RetinaImg, Flexbox} = require 'nylas-component-kit'
{Utils,
 Actions,
 FileUploadStore} = require 'nylas-exports'

class FileUpload extends React.Component
  @displayName: 'FileUpload'

  render: =>
    <div className={"file-wrap file-upload"}>
      <div className="inner">
        <Flexbox direction="row" style={alignItems: 'center'}>
          <RetinaImg className="file-icon"
                     fallback="file-fallback.png"
                     mode={RetinaImg.Mode.ContentPreserve}
                     name="file-#{@_extension()}.png"/>
          <span className="file-name">
            <span className="uploading">{@props.upload.filename}</span>
          </span>
          <div className="file-action-icon" onClick={@_onClickRemove}>
            <RetinaImg name="remove-attachment.png" mode={RetinaImg.Mode.ContentDark} />
          </div>
        </Flexbox>
      </div>
    </div>

  _onClickRemove: (event) =>
    event.preventDefault()
    Actions.removeAttachment @props.upload

  _extension: =>
    path.extname(@props.upload.filename.toLowerCase())[1..-1]

module.exports = FileUpload

{'fraction_non_alphanumeric': 0.1457286432160804, 'fraction_numerical': 0.0016750418760469012, 'mean_word_length': 2.81629392971246, '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': '6431634', 'n_tokens_mistral': 713, 'n_tokens_neox': 703, 'n_words': 126}