<commit_before>import React from 'react'
import os from 'os'
import { connect } from 'redux-bundler-react'
import { withTranslation, Trans } from 'react-i18next'
import Box from '../components/box/Box'
import Checkbox from '../components/checkbox/Checkbox'
import Title from './Title'

const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0

const keys = {
  option: '⌥ option',
  cmd: '⌘ command',
  ctrlMac: '⌃ control',
  alt: 'ALT',
  ctrl: 'CTRL'
}

const CheckboxSetting = ({ children, title, ...props }) => (
  <div className='mt2'>
    <div className='flex items-center'>
      <div className='w2'>
        <Checkbox {...props} className='mr1' />
      </div>
      <p className='ma0 f6 b'>{title}</p>
    </div>

    <p className='pl4 charcoal mw7 mb0 mt1 f6 lh-copy'>
      <span>{children}</span>
    </p>
  </div>
)

const Key = ({ children }) => <span className='monospace br2 bg-snow ph1'>{ children }</span>

export function DesktopSettings ({ t, doDesktopSettingsToggle, desktopSettings }) {
  return (
    <Box className='mb3 pa4'>
      <Title>{t('ipfsDesktop')}</Title>

      <CheckboxSetting checked={desktopSettings.autoLaunch || false}
        title={t('launchOnStartup')}
        onChange={() => doDesktopSettingsToggle('autoLaunch')} />
      <CheckboxSetting checked={desktopSettings.ipfsOnPath || false}
        title={t('ipfsCmdTools')}
        disabled={os.platform() === 'win32'}
        onChange={() => doDesktopSettingsToggle('ipfsOnPath')}>
        <Trans<commit_msg>fix: disable launch on startup on unsupported platforms (#1265)<commit_after>import React from 'react'
import os from 'os'
import { connect } from 'redux-bundler-react'
import { withTranslation, Trans } from 'react-i18next'
import Box from '../components/box/Box'
import Checkbox from '../components/checkbox/Checkbox'
import Title from './Title'

const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0

const keys = {
  option: '⌥ option',
  cmd: '⌘ command',
  ctrlMac: '⌃ control',
  alt: 'ALT',
  ctrl: 'CTRL'
}

const CheckboxSetting = ({ children, title, ...props }) => (
  <div className='mt2'>
    <div className='flex items-center'>
      <div className='w2'>
        <Checkbox {...props} className='mr1' />
      </div>
      <p className='ma0 f6 b'>{title}</p>
    </div>

    <p className='pl4 charcoal mw7 mb0 mt1 f6 lh-copy'>
      <span>{children}</span>
    </p>
  </div>
)

const Key = ({ children }) => <span className='monospace br2 bg-snow ph1'>{ children }</span>

export function DesktopSettings ({ t, doDesktopSettingsToggle, desktopSettings }) {
  return (
    <Box className='mb3 pa4'>
      <Title>{t('ipfsDesktop')}</Title>

      <CheckboxSetting checked={desktopSettings.autoLaunch || false}
        title={t('launchOnStartup')}
        disabled={!(['win32', 'darwin', 'linux'].includes(os.platform()) && process.env.NODE_ENV !== 'development')}
        onChange={() => doDesktopSettingsToggle('autoLaunch')} />
      <CheckboxSetting checked={desktopSettings.ipfsOnPath || false}
        title={t('ipfsCmdTools')}
        disabled={os.platform() === 'win32'}
        onChange={() => doDesktopSettingsToggle('ipfsOnPath')}>
        <Trans
{'fraction_non_alphanumeric': 0.17204638044500156, 'fraction_numerical': 0.013788780946411783, 'mean_word_length': 3.6941176470588237, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 53, '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': '6517073', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1002, 'n_words': 244}