<commit_before>/*
 * Copyright (C) 2019 - present Instructure, Inc.
 *
 * This file is part of Canvas.
 *
 * Canvas is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3 of the License.
 *
 * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

import {getIconByType} from '@canvas/mime/react/mimeClassIconHelper'
import {useScope as useI18nScope} from '@canvas/i18n'
import LoadingIndicator from '@canvas/loading-indicator'
import previewUnavailable from '../../../images/PreviewUnavailable.svg'
import PropTypes from 'prop-types'
import React, {Component} from 'react'
import {SubmissionFile} from '@canvas/assignments/graphql/student/File'

import {Button, IconButton} from '@instructure/ui-buttons'
import {Flex} from '@instructure/ui-flex'
import {IconDownloadLine} from '@instructure/ui-icons'
import {ScreenReaderContent} from '@instructure/ui-a11y-content'
import {Text} from '@instructure/ui-text'
import theme from '@instructure/canvas-theme'
import {Tooltip} from '@instructure/ui-tooltip'

const I18n = useI18nScope('assignments_2')

export default class FilePreview extends Component {
  static propTypes = {
    files: PropTypes.arrayOf(SubmissionFile.shape)
  }

  state = {
    selectedFile: 0
  }

  translateMimeClass(mimeClass) {
    switch (mimeClass) {
      case 'audio':
        return I18n.t('audio')
      case 'code':
        return I18n.t('code')
      case 'doc':
        return I18n.t('doc')
      case 'flash':
        return I18n.t('flash')
      case 'html':
        return I18n.t('html')
      case 'image':
        return I18n.t('image')
      case 'pdf':
        return I18n.t('pdf')
      case 'ppt':
        return I18n.t('ptt')
      case 'text':<commit_msg>Show correct file extension for PowerPoint files<commit_after>/*
 * Copyright (C) 2019 - present Instructure, Inc.
 *
 * This file is part of Canvas.
 *
 * Canvas is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3 of the License.
 *
 * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

import {getIconByType} from '@canvas/mime/react/mimeClassIconHelper'
import {useScope as useI18nScope} from '@canvas/i18n'
import LoadingIndicator from '@canvas/loading-indicator'
import previewUnavailable from '../../../images/PreviewUnavailable.svg'
import PropTypes from 'prop-types'
import React, {Component} from 'react'
import {SubmissionFile} from '@canvas/assignments/graphql/student/File'

import {Button, IconButton} from '@instructure/ui-buttons'
import {Flex} from '@instructure/ui-flex'
import {IconDownloadLine} from '@instructure/ui-icons'
import {ScreenReaderContent} from '@instructure/ui-a11y-content'
import {Text} from '@instructure/ui-text'
import theme from '@instructure/canvas-theme'
import {Tooltip} from '@instructure/ui-tooltip'

const I18n = useI18nScope('assignments_2')

export default class FilePreview extends Component {
  static propTypes = {
    files: PropTypes.arrayOf(SubmissionFile.shape)
  }

  state = {
    selectedFile: 0
  }

  translateMimeClass(mimeClass) {
    switch (mimeClass) {
      case 'audio':
        return I18n.t('audio')
      case 'code':
        return I18n.t('code')
      case 'doc':
        return I18n.t('doc')
      case 'flash':
        return I18n.t('flash')
      case 'html':
        return I18n.t('html')
      case 'image':
        return I18n.t('image')
      case 'pdf':
        return I18n.t('pdf')
      case 'ppt':
        return I18n.t('ppt')
      case 'text':
{'fraction_non_alphanumeric': 0.10854133272269292, 'fraction_numerical': 0.015113350125944584, 'mean_word_length': 3.6124604012671595, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5530979', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1275, 'n_words': 441}