Skip to content

Commit

Permalink
Remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MattWong-ca committed Dec 7, 2024
1 parent 481e7a9 commit c47e403
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
5 changes: 1 addition & 4 deletions src/bundles/files/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ const actions = () => ({
* @param {string} src
* @param {string} name
*/
// HERE

doFilesAddPath: (root, src, name = '') => perform(ACTIONS.ADD_BY_PATH, async (ipfs, { store }) => {
ensureMFS(store)

Expand All @@ -405,9 +405,6 @@ const actions = () => ({
* @param {string} root - Destination directory in IPFS
*/
doFilesAddBulkCid: (source, root) => spawn(ACTIONS.ADD_BY_PATH, async function * (ipfs, { store }) {
console.log('Action parameters:', { source, root })
console.log('Arguments:', arguments)

ensureMFS(store)

// Ensure source is properly passed
Expand Down
32 changes: 8 additions & 24 deletions src/files/modals/bulk-import-modal/BulkImportModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class BulkImportModal extends React.Component {
}

state = {
path: '',
name: '',
// path: '',
// name: '',
selectedFile: null
}

Expand All @@ -33,30 +33,18 @@ class BulkImportModal extends React.Component {
}

onChange = (event) => {
const target = event.target
const value = target.value
const name = target.name
this.setState({ [name]: value })
}

onBulkCidInputChange = (event) => {
const files = event.target.files
console.log('files: ', files)
this.setState({ selectedFile: files[0] })
// console.log('input: ', input)
// this.setState({ selectedFile: input.files })
}

selectFile = async () => {
return this.bulkCidInputt.click()
}

onSubmit = async () => {
console.log('BulkImportModal onSubmit:', this.state.selectedFile)
if (this.state.selectedFile) {
const normalizedFiles = normalizeFiles([this.state.selectedFile])
console.log('Calling onBulkCidImport with:', { normalizedFiles, root: '/files' })
await this.props.onBulkCidImport(normalizedFiles, '/files')
await this.props.onBulkCidImport(normalizedFiles)
}
}

Expand All @@ -72,13 +60,9 @@ class BulkImportModal extends React.Component {
return 'b--red-muted focus-outline-red'
}

// get isDisabled () {
// if (this.state.path === '') {
// return true
// }

// return !this.validatePath(this.state.path)
// }
get isDisabled () {
return !this.state.selectedFile
}

render () {
const {
Expand All @@ -100,7 +84,7 @@ class BulkImportModal extends React.Component {
className='dn'
multiple
accept='.txt'
onChange={this.onBulkCidInputChange}
onChange={this.onChange}
// className='input-reset'
// id='bulk-import'
ref={el => {
Expand Down Expand Up @@ -136,7 +120,7 @@ class BulkImportModal extends React.Component {

<ModalActions>
<Button className='ma2 tc' bg='bg-gray' onClick={onCancel}>{t('actions.cancel')}</Button>
<Button className='ma2 tc' bg='bg-teal' /* disabled={this.isDisabled} */ onClick={this.onSubmit}>{t('app:actions.import')}</Button>
<Button className='ma2 tc' bg='bg-teal' disabled={this.isDisabled} onClick={this.onSubmit}>{t('app:actions.import')}</Button>
</ModalActions>
</Modal>
)
Expand Down

0 comments on commit c47e403

Please sign in to comment.