Skip to content

Commit

Permalink
wip: import car
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias committed Aug 18, 2021
1 parent 6d5bd6d commit 59c908b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions public/locales/en/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"downloadInstead": "Try <1>downloading</1> it instead.",
"cantBePreviewed": "Sorry, this file can’t be previewed",
"addByPath": "From IPFS",
"fromDagCar": "From CAR Archive",
"newFolder": "New folder",
"generating": "Generating…",
"actions": {
Expand Down
2 changes: 2 additions & 0 deletions src/bundles/files/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const cliCmdKeys = {
ADD_DIRECTORY: 'addNewDirectory',
CREATE_NEW_DIRECTORY: 'createNewDirectory',
FROM_IPFS: 'fromIpfs',
FROM_DAG_CAR: 'fromDagCar',
ADD_NEW_PEER: 'addNewPeer'
}

Expand Down Expand Up @@ -128,5 +129,6 @@ export const cliCommandList = {
* @param {string} path
*/
[cliCmdKeys.FROM_IPFS]: (path) => `ipfs cp /ipfs/<cid> "${path}/<dest-name>"`,
[cliCmdKeys.FROM_DAG_CAR]: () => 'ipfs dag import <car-file>',
[cliCmdKeys.ADD_NEW_PEER]: () => 'ipfs swarm connect <peer-multiaddr>'
}
11 changes: 11 additions & 0 deletions src/files/file-input/FileInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { normalizeFiles } from '../../lib/files'
import DocumentIcon from '../../icons/StrokeDocument'
import FolderIcon from '../../icons/StrokeFolder'
import NewFolderIcon from '../../icons/StrokeNewFolder'
import DataIcon from '../../icons/StrokeData'
import DecentralizationIcon from '../../icons/StrokeDecentralization'
// Components
import { Dropdown, DropdownMenu, Option } from '../dropdown/Dropdown'
Expand Down Expand Up @@ -50,6 +51,11 @@ class FileInput extends React.Component {
this.toggleDropdown()
}

onAddByCar = () => {
window.alert('TODO')
// TODO
}

onNewFolder = () => {
this.props.onNewFolder()
this.toggleDropdown()
Expand Down Expand Up @@ -87,6 +93,11 @@ class FileInput extends React.Component {
<DecentralizationIcon className='fill-aqua w2 mr1' />
{t('addByPath')}
</Option>
<Option onClick={this.onAddByCar} id='add-by-car' onCliTutorMode={() => this.onCliTutorMode(cliCmdKeys.FROM_DAG_CAR)}
isCliTutorModeEnabled={isCliTutorModeEnabled}>
<DataIcon className='fill-aqua w2 mr1' />
{t('fromDagCar')}
</Option>
<Option onClick={this.onNewFolder} id='add-new-folder' onCliTutorMode={() => this.onCliTutorMode(cliCmdKeys.CREATE_NEW_DIRECTORY)}
isCliTutorModeEnabled={isCliTutorModeEnabled}>
<NewFolderIcon className='fill-aqua w2 h2 mr1' />
Expand Down

0 comments on commit 59c908b

Please sign in to comment.