|
|
@ -2,6 +2,7 @@ |
|
|
|
import React, { useState, useRef, useReducer } from 'react' |
|
|
|
import React, { useState, useRef, useReducer } from 'react' |
|
|
|
import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line
|
|
|
|
import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line
|
|
|
|
import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
|
|
|
|
import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
|
|
|
|
|
|
|
|
const _paq = window._paq = window._paq || [] // eslint-disable-line
|
|
|
|
|
|
|
|
|
|
|
|
interface HomeTabFileProps { |
|
|
|
interface HomeTabFileProps { |
|
|
|
plugin: any |
|
|
|
plugin: any |
|
|
@ -36,7 +37,8 @@ function HomeTabFile ({plugin}: HomeTabFileProps) { |
|
|
|
|
|
|
|
|
|
|
|
const inputValue = useRef(null) |
|
|
|
const inputValue = useRef(null) |
|
|
|
|
|
|
|
|
|
|
|
const processLoading = () => { |
|
|
|
const processLoading = (type: string) => { |
|
|
|
|
|
|
|
_paq.push(['trackEvent', 'hometab', 'filesSection', 'importFrom' + type]) |
|
|
|
const contentImport = plugin.contentImport |
|
|
|
const contentImport = plugin.contentImport |
|
|
|
const workspace = plugin.fileManager.getProvider('workspace') |
|
|
|
const workspace = plugin.fileManager.getProvider('workspace') |
|
|
|
contentImport.import( |
|
|
|
contentImport.import( |
|
|
@ -70,18 +72,22 @@ function HomeTabFile ({plugin}: HomeTabFileProps) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const createNewFile = async () => { |
|
|
|
const createNewFile = async () => { |
|
|
|
|
|
|
|
_paq.push(['trackEvent', 'hometab', 'filesSection', 'createNewFile']) |
|
|
|
plugin.verticalIcons.select('filePanel') |
|
|
|
plugin.verticalIcons.select('filePanel') |
|
|
|
await plugin.call('filePanel', 'createNewFile') |
|
|
|
await plugin.call('filePanel', 'createNewFile') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const uploadFile = async (target) => { |
|
|
|
const uploadFile = async (target) => { |
|
|
|
|
|
|
|
_paq.push(['trackEvent', 'hometab', 'filesSection', 'uploadFile']) |
|
|
|
await plugin.call('filePanel', 'uploadFile', target) |
|
|
|
await plugin.call('filePanel', 'uploadFile', target) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const connectToLocalhost = () => { |
|
|
|
const connectToLocalhost = () => { |
|
|
|
|
|
|
|
_paq.push(['trackEvent', 'hometab', 'filesSection', 'connectToLocalhost']) |
|
|
|
plugin.appManager.activatePlugin('remixd') |
|
|
|
plugin.appManager.activatePlugin('remixd') |
|
|
|
} |
|
|
|
} |
|
|
|
const importFromGist = () => { |
|
|
|
const importFromGist = () => { |
|
|
|
|
|
|
|
_paq.push(['trackEvent', 'hometab', 'filesSection', 'importFromGist']) |
|
|
|
plugin.call('gistHandler', 'load', '') |
|
|
|
plugin.call('gistHandler', 'load', '') |
|
|
|
plugin.verticalIcons.select('filePanel') |
|
|
|
plugin.verticalIcons.select('filePanel') |
|
|
|
} |
|
|
|
} |
|
|
@ -108,7 +114,7 @@ function HomeTabFile ({plugin}: HomeTabFileProps) { |
|
|
|
okLabel='Import' |
|
|
|
okLabel='Import' |
|
|
|
hide={ !state.showModalDialog } |
|
|
|
hide={ !state.showModalDialog } |
|
|
|
handleHide={ () => hideFullMessage() } |
|
|
|
handleHide={ () => hideFullMessage() } |
|
|
|
okFn={ () => processLoading() } |
|
|
|
okFn={ () => processLoading(state.modalInfo.title) } |
|
|
|
> |
|
|
|
> |
|
|
|
<div className="p-2 user-select-auto"> |
|
|
|
<div className="p-2 user-select-auto"> |
|
|
|
{ state.modalInfo.loadItem !== '' && <span>Enter the { state.modalInfo.loadItem } you would like to load.</span> } |
|
|
|
{ state.modalInfo.loadItem !== '' && <span>Enter the { state.modalInfo.loadItem } you would like to load.</span> } |
|
|
|