<commit_before>import React, { useCallback } from 'react'
import { connect } from 'react-redux'
import { useClient } from 'cozy-client'
import {
  isAvailableOffline,
  toggleAvailableOffline
} from 'drive/mobile/modules/offline/duck'

import { ActionMenuItem } from 'cozy-ui/transpiled/react/ActionMenu'
import Icon from 'cozy-ui/transpiled/react/Icon'
import Switch from 'cozy-ui/transpiled/react/MuiCozyTheme/Switch'
const MakeAvailableOfflineMenuItem = connect(
  (state, ownProps) => ({
    checked: isAvailableOffline(state, ownProps.file.id)
  }),
  (dispatch, ownProps) => ({
    toggleOfflineAvailability: client =>
      dispatch(toggleAvailableOffline(ownProps.file, client))
  })
)(({ checked, toggleOfflineAvailability, children, ...rest }) => {
  const client = useClient()
  const onToggle = useCallback(
    e => {
      e.stopPropagation()
      return toggleOfflineAvailability(client)
    },
    [client, toggleOfflineAvailability]
  )
  return (
    <ActionMenuItem
      {...rest}
      left={<Icon icon="phone-download" />}
      right={
        <Switch
          id={children}
          checked={checked}
          onClick={ev => onToggle(ev)}
          classes={{
            switchBase: 'u-h-half'
          }}
        />
      }
    >
      {children}
    </ActionMenuItem>
  )
})

export default MakeAvailableOfflineMenuItem<commit_msg>fix: Display the text for DownloadPhone action<commit_after>import React, { useCallback } from 'react'
import { connect } from 'react-redux'
import { useClient } from 'cozy-client'
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
import Icon from 'cozy-ui/transpiled/react/Icon'
import Switch from 'cozy-ui/transpiled/react/MuiCozyTheme/Switch'
import { ActionMenuItem } from 'cozy-ui/transpiled/react/ActionMenu'

import {
  isAvailableOffline,
  toggleAvailableOffline
} from 'drive/mobile/modules/offline/duck'

const MakeAvailableOfflineMenuItem = connect(
  (state, ownProps) => ({
    checked: isAvailableOffline(state, ownProps.file.id)
  }),
  (dispatch, ownProps) => ({
    toggleOfflineAvailability: client =>
      dispatch(toggleAvailableOffline(ownProps.file, client))
  })
)(({ checked, toggleOfflineAvailability, ...rest }) => {
  const { t } = useI18n()
  const client = useClient()
  const onToggle = useCallback(
    e => {
      e.stopPropagation()
      return toggleOfflineAvailability(client)
    },
    [client, toggleOfflineAvailability]
  )
  return (
    <ActionMenuItem
      {...rest}
      left={<Icon icon="phone-download" />}
      right={
        <Switch
          id={'offline-switch'}
          checked={checked}
          onClick={ev => onToggle(ev)}
          classes={{
            switchBase: 'u-h-half'
          }}
        />
      }
    >
      {t('SelectionBar.phone-download')}
    </ActionMenuItem>
  )
})

export default MakeAvailableOfflineMenuItem
{'fraction_non_alphanumeric': 0.12849162011173185, 'fraction_numerical': 0.002094972067039106, 'mean_word_length': 3.1401734104046244, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4625484', 'n_tokens_mistral': 879, 'n_tokens_neox': 874, 'n_words': 169}